@@ -340,25 +340,28 @@ common rts-cmm-sources-base
340340 -- then have the `AutoApply.cmm` in `rts-c-sources-base` include them. This
341341 -- would mean they are included in the sublibraries which will in turn apply
342342 -- the sublibrary specific (c)flags.
343- autogen- cmm-sources :
343+ cmm-sources :
344344 AutoApply.cmm
345345 AutoApply_V16.cmm
346346
347347 if arch(x86_64)
348348 cmm-sources :
349349 Jumps_V32.cmm (-mavx2)
350350 Jumps_V64.cmm (-mavx512f)
351- autogen-cmm-sources :
352351 AutoApply_V32.cmm (-mavx2)
353352 AutoApply_V64.cmm (-mavx512f)
354353 else
355354 cmm-sources :
356355 Jumps_V32.cmm
357356 Jumps_V64.cmm
358- autogen-cmm-sources :
359357 AutoApply_V32.cmm
360358 AutoApply_V64.cmm
361359
360+ -- this is required so we don't have ghc inject ghc-internal (which depends on the rts)
361+ -- during the build phase of this library.
362+ ghc-options : -no-ghc-internal
363+
364+
362365common rts-c-sources-base
363366 if !arch(javascript)
364367 cmm-sources :
@@ -637,19 +640,42 @@ library
637640 ghc-options : -this-unit-id rts -ghcversion-file=include/ghcversion.h -optc-DFS_NAMESPACE=rts
638641 cmm-options : -this-unit-id rts
639642
643+ -- [The AutoApply story]
644+ --
645+ -- We use GenApply to generate the AutoApply[_V{16,32,64}].cmm files.
646+ -- However cabal will run the ./configure script only for the main library.
647+ -- To work around this shortcoming, we'll generate .cmm.h files (same
648+ -- content as .cmm), and create AutoApply*.cmm files that just
649+ --
650+ -- #include <rts/AutoApply_...cmm.h>
651+ --
652+ -- This way each sublib has it's own properly parameterized .cmm file, while
653+ -- we only generate them once and stick them into the rts library.
654+ --
655+ -- This is a hack, and it would be great if sublibs had access to their
656+ -- parent libraries auto-gen folders, however as sublibs are supposed to be
657+ -- separate components, this is a non-trivial (impossible?) task to resolve.
640658 autogen-includes :
641659 ghcautoconf.h
642660 ghcplatform.h
643661 DerivedConstants.h
644662 rts/EventLogConstants.h
645663 rts/EventTypes.h
664+ AutoApply.cmm.h
665+ AutoApply_V16.cmm.h
666+ AutoApply_V32.cmm.h
667+ AutoApply_V64.cmm.h
646668
647669 install-includes :
648670 ghcautoconf.h
649671 ghcplatform.h
650672 DerivedConstants.h
651673 rts/EventLogConstants.h
652674 rts/EventTypes.h
675+ AutoApply.cmm.h
676+ AutoApply_V16.cmm.h
677+ AutoApply_V32.cmm.h
678+ AutoApply_V64.cmm.h
653679
654680 install-includes :
655681 -- Common headers for non-JS builds
@@ -771,10 +797,8 @@ library nonthreaded-nodebug
771797 import : rts-base-config, rts-cmm-sources-base, rts-c-sources-base, rts-link-options, rts-global-build-flags
772798
773799 visibility : public
774-
775800 ghc-options : -optc-DRtsWay="v"
776801
777-
778802library threaded-nodebug
779803 import : rts-base-config, rts-cmm-sources-base, rts-c-sources-base, rts-link-options, rts-global-build-flags, rts-threaded-flags
780804 visibility : public
0 commit comments