Define CABAL in mk/cabal-flags.mk, rather than everywhere we use it
[ghc-hetmet.git] / libraries / Makefile
index 8f2c927..65778ee 100644 (file)
@@ -70,9 +70,6 @@ SUBDIRS += $(wildcard ALUT)
 SUBDIRS += $(wildcard stm)
 SUBDIRS += $(wildcard xhtml)
 SUBDIRS += $(wildcard cgi)
-ifeq "$(GhcLibsWithObjectIO)" "YES"
-SUBDIRS += $(wildcard ObjectIO)
-endif
 SUBDIRS += $(wildcard parallel)
 SUBDIRS_BUILD += $(wildcard ndp)
 SUBDIRS_BUILD += $(wildcard dph/dph-base)
@@ -157,14 +154,13 @@ subdirs:
 HERE_ABS=$(FPTOOLS_TOP_ABS)/libraries
 
 IFBUILDABLE=ifBuildable/ifBuildable $(HERE_ABS)/boot-packages
-CABAL=$(HERE_ABS)/cabal-bin $(GHC) $(HERE_ABS)/bootstrapping.conf
 
 CABAL_GHC_FLAGS = -Wall
 ifeq "$(ghc_ge_605)" "NO"
 CABAL_GHC_FLAGS += -cpp
 endif
 
-BOOTSTRAPPING_FLAGS = $(CABAL_GHC_FLAGS) -DCABAL_VERSION=1,3 -odir $(HERE_ABS)/bootstrapping -hidir $(HERE_ABS)/bootstrapping -i$(HERE_ABS)/Cabal -i$(HERE_ABS)/filepath
+BOOTSTRAPPING_FLAGS = $(CABAL_GHC_FLAGS) -DCABAL_VERSION=1,3 -odir $(HERE_ABS)/bootstrapping -hidir $(HERE_ABS)/bootstrapping -i$(HERE_ABS)/Cabal -i$(HERE_ABS)/filepath -i$(HERE_ABS)/hpc
 
 .PHONY: boot
 
@@ -183,6 +179,10 @@ bootstrapping.conf: cabal-bin
        cd Cabal    && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --with-hc-pkg=$(GHC_PKG) --package-db=$(HERE_ABS)/$@.tmp
        cd Cabal    && $(CABAL) build     --distpref=dist-bootstrapping
        cd Cabal    && $(CABAL) install   --distpref=dist-bootstrapping --inplace
+       -cd hpc    && $(CABAL) clean     --distpref=dist-bootstrapping
+       cd hpc    && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --with-hc-pkg=$(GHC_PKG) --package-db=$(HERE_ABS)/$@.tmp
+       cd hpc    && $(CABAL) build     --distpref=dist-bootstrapping
+       cd hpc    && $(CABAL) install   --distpref=dist-bootstrapping --inplace
        mv $@.tmp $@
 
 installPackage/installPackage: installPackage.hs
@@ -249,7 +249,8 @@ ALL_CONFIGURE_FLAGS = \
 
 $(foreach SUBDIR,$(SUBDIRS), \
                  stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).$(SUBDIR)): \
-stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).%: cabal-bin
+stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).%: cabal-bin \
+                                                          bootstrapping.conf
        -$(RM) -f stamp/configure.library.*.$* $*/unbuildable
        $(MKDIRHIER) `dirname $@`
        ( cd $* && $(CABAL) configure $(ALL_CONFIGURE_FLAGS) ) \
@@ -268,7 +269,7 @@ stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).%: cabal-bin
 # make.*, so filter them out and use an alternate rule below instead.
 $(foreach SUBDIR,$(filter-out $(SUBDIRS_BUILD),$(SUBDIRS)),make.library.$(SUBDIR)):\
 make.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
-                cabal-bin ifBuildable/ifBuildable
+                cabal-bin ifBuildable/ifBuildable bootstrapping.conf
        if $(IFBUILDABLE) $*; then \
          cd $* && \
          cmp -s $(MAKEFILE_LOCAL) Makefile.local || cp $(MAKEFILE_LOCAL) .; \
@@ -288,7 +289,7 @@ make.library.%: build.library.%
 # Build the library using 'setup build' (not the default)
 $(foreach SUBDIR,$(SUBDIRS),build.library.$(SUBDIR)):\
 build.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
-                 cabal-bin ifBuildable/ifBuildable
+                 cabal-bin ifBuildable/ifBuildable bootstrapping.conf
        if $(IFBUILDABLE) $*; then \
          cd $* && \
          $(CABAL) build $(BUILD_FLAGS); \
@@ -309,7 +310,7 @@ endif
 
 $(foreach SUBDIR,$(SUBDIRS),doc.library.$(SUBDIR)):\
 doc.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
-               cabal-bin ifBuildable/ifBuildable
+               cabal-bin ifBuildable/ifBuildable bootstrapping.conf
        if $(IFBUILDABLE) $*; then \
          cd $* && $(CABAL) haddock --html-location='../$$pkg' \
                                    $(CABAL_HADDOCK_FLAGS); \
@@ -327,6 +328,7 @@ distclean: clean
 clean: $(foreach SUBDIR,$(SUBDIRS),clean.library.$(SUBDIR))
        -cd filepath && $(CABAL) clean --distpref=dist-bootstrapping
        -cd Cabal    && $(CABAL) clean --distpref=dist-bootstrapping
+       -cd hpc      && $(CABAL) clean --distpref=dist-bootstrapping
        $(RM) -rf bootstrapping/*
        $(RM) -f bootstrapping.conf     bootstrapping.conf.old
        $(RM) -f bootstrapping.conf.tmp bootstrapping.conf.tmp.old