Move the register-inplace special-case stuff into the ghc-prim package
[ghc-hetmet.git] / libraries / Makefile
index 4168ae5..6a38e3d 100644 (file)
@@ -163,12 +163,15 @@ boot: $(BOOTSTRAP_STAMPS) ifBuildable/ifBuildable \
 
 # We ought to be depending on %/Setup.*hs, but make makes that difficult.
 
 
 # We ought to be depending on %/Setup.*hs, but make makes that difficult.
 
+# -fffi is only needed for GHC 6.4 at the time of writing
+CABAL_GHC_FLAGS = -Wall -cpp -fffi
+
 $(foreach SUBDIR,$(SUBDIRS),$(SUBDIR)/setup/Setup): \
 %/setup/Setup: $(BOOTSTRAP_STAMPS)
        -$(RM) -rf $*/setup
        mkdir $*/setup
        $(CP) $*/Setup.*hs $*/setup
 $(foreach SUBDIR,$(SUBDIRS),$(SUBDIR)/setup/Setup): \
 %/setup/Setup: $(BOOTSTRAP_STAMPS)
        -$(RM) -rf $*/setup
        mkdir $*/setup
        $(CP) $*/Setup.*hs $*/setup
-       cd $*/setup && $(GHC) -Wall -cpp --make Setup.*hs -o Setup \
+       cd $*/setup && $(GHC) $(CABAL_GHC_FLAGS) --make Setup.*hs -o Setup \
                              $(BOOTSTRAP_INC_2_UP)
 
 installPackage/installPackage: installPackage.hs $(BOOTSTRAP_STAMPS)
                              $(BOOTSTRAP_INC_2_UP)
 
 installPackage/installPackage: installPackage.hs $(BOOTSTRAP_STAMPS)
@@ -176,11 +179,11 @@ installPackage/installPackage: installPackage.hs $(BOOTSTRAP_STAMPS)
        mkdir installPackage
        $(CP) installPackage.hs installPackage/
 ifeq "$(stage)" "2"
        mkdir installPackage
        $(CP) installPackage.hs installPackage/
 ifeq "$(stage)" "2"
-       cd installPackage && ../$(HC) -Wall -cpp \
+       cd installPackage && ../$(HC) $(CABAL_GHC_FLAGS) \
                                    --make installPackage -o installPackage \
                                    $(BOOTSTRAP_INC_1_UP) $(DEPLOYMENT_OPTS)
 else
                                    --make installPackage -o installPackage \
                                    $(BOOTSTRAP_INC_1_UP) $(DEPLOYMENT_OPTS)
 else
-       cd installPackage && $(GHC) -Wall -cpp \
+       cd installPackage && $(GHC) $(CABAL_GHC_FLAGS) \
                                    --make installPackage -o installPackage \
                                    $(BOOTSTRAP_INC_1_UP)
 endif
                                    --make installPackage -o installPackage \
                                    $(BOOTSTRAP_INC_1_UP)
 endif
@@ -288,7 +291,9 @@ stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).%: %/setup/Setup
 # needs to be done.  However, we're careful not to overwrite GNUmakefile
 # if it hasn't changed, so that dependency-generation isn't forced
 # every time.
 # needs to be done.  However, we're careful not to overwrite GNUmakefile
 # if it hasn't changed, so that dependency-generation isn't forced
 # every time.
-$(foreach SUBDIR,$(SUBDIRS),make.library.$(SUBDIR)):\
+# I doubt that the makefile way will work with ndp, so filter it out and use
+# a rule below to call build.library.ndp instead
+$(foreach SUBDIR,$(filter-out ndp,$(SUBDIRS)),make.library.$(SUBDIR)):\
 make.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
                 %/setup/Setup ifBuildable/ifBuildable installPackage/installPackage
        if ifBuildable/ifBuildable $*; then \
 make.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
                 %/setup/Setup ifBuildable/ifBuildable installPackage/installPackage
        if ifBuildable/ifBuildable $*; then \
@@ -298,9 +303,12 @@ make.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
          setup/Setup makefile -f GNUmakefile; \
          cmp -s GNUmakefile GNUmakefile.tmp && mv GNUmakefile.tmp GNUmakefile; \
          $(MAKE) $(MFLAGS) && \
          setup/Setup makefile -f GNUmakefile; \
          cmp -s GNUmakefile GNUmakefile.tmp && mv GNUmakefile.tmp GNUmakefile; \
          $(MAKE) $(MFLAGS) && \
-         ../installPackage/installPackage register --inplace; \
+         setup/Setup register --inplace; \
        fi
 
        fi
 
+# Hack for ndp, as described above
+make.library.ndp: build.library.ndp
+
 # Build the library using 'setup build' (not the default)
 $(foreach SUBDIR,$(SUBDIRS),build.library.$(SUBDIR)):\
 build.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
 # Build the library using 'setup build' (not the default)
 $(foreach SUBDIR,$(SUBDIRS),build.library.$(SUBDIR)):\
 build.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
@@ -308,6 +316,7 @@ build.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
        if ifBuildable/ifBuildable $*; then \
          cd $* && \
          setup/Setup build $(addprefix --ghc-option=,$(GhcLibHcOpts)); \
        if ifBuildable/ifBuildable $*; then \
          cd $* && \
          setup/Setup build $(addprefix --ghc-option=,$(GhcLibHcOpts)); \
+         setup/Setup register --inplace; \
        fi
 
 .PHONY: doc html
        fi
 
 .PHONY: doc html