If we know where alex, haddock and happy are then tell Cabal; fixes trac #2373
[ghc-hetmet.git] / libraries / Makefile
index e3cb634..20161c9 100644 (file)
@@ -150,6 +150,18 @@ ifneq "$(HSCOLOUR)" ""
 CONFIGURE_OPTS += --with-hscolour=$(HSCOLOUR)
 endif
 
+ifneq "$(ALEX)" ""
+CONFIGURE_OPTS += --with-alex=$(ALEX)
+endif
+
+ifneq "$(HADDOCK)" ""
+CONFIGURE_OPTS += --with-haddock=$(HADDOCK)
+endif
+
+ifneq "$(HAPPY)" ""
+CONFIGURE_OPTS += --with-happy=$(HAPPY)
+endif
+
 DEPLOYMENT_OPTS = $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS)) \
                   $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
 
@@ -161,8 +173,7 @@ subdirs:
 HERE_ABS=$(FPTOOLS_TOP_ABS)/libraries
 
 IFBUILDABLE=ifBuildable/ifBuildable $(HERE_ABS)/boot-packages
-CABAL=$(HERE_ABS)/cabal-bin $(GHC) $(BOOTSTRAPPING_CONF)
-BOOTSTRAPPING_CONF=$(HERE_ABS)/bootstrapping.conf
+CABAL=$(HERE_ABS)/cabal-bin $(GHC) $(HERE_ABS)/bootstrapping.conf
 
 CABAL_GHC_FLAGS = -Wall
 ifeq "$(ghc_ge_605)" "NO"
@@ -173,19 +184,19 @@ BOOTSTRAPPING_FLAGS = $(CABAL_GHC_FLAGS) -DCABAL_VERSION=1,3 -odir $(HERE_ABS)/b
 
 .PHONY: boot
 
-boot: ifBuildable/ifBuildable cabal-bin $(BOOTSTRAPPING_CONF)
+boot: ifBuildable/ifBuildable cabal-bin bootstrapping.conf
 
 cabal-bin: cabal-bin.hs
        $(GHC) $(BOOTSTRAPPING_FLAGS) --make cabal-bin -o cabal-bin
 
-$(BOOTSTRAPPING_CONF): cabal-bin
+bootstrapping.conf: cabal-bin
        echo "[]" > $@.tmp
        -cd filepath && $(CABAL) clean     --distpref=dist-bootstrapping
-       cd filepath && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --package-db=$@.tmp
+       cd filepath && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --package-db=$(HERE_ABS)/$@.tmp
        cd filepath && $(CABAL) build     --distpref=dist-bootstrapping
        cd filepath && $(CABAL) install   --distpref=dist-bootstrapping --inplace
        -cd Cabal    && $(CABAL) clean     --distpref=dist-bootstrapping
-       cd Cabal    && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --package-db=$@.tmp
+       cd Cabal    && $(CABAL) configure --distpref=dist-bootstrapping --with-compiler=$(GHC) --package-db=$(HERE_ABS)/$@.tmp
        cd Cabal    && $(CABAL) build     --distpref=dist-bootstrapping
        cd Cabal    && $(CABAL) install   --distpref=dist-bootstrapping --inplace
        mv $@.tmp $@
@@ -353,10 +364,12 @@ endif
 distclean: clean
 
 clean: $(foreach SUBDIR,$(SUBDIRS),clean.library.$(SUBDIR))
+       -cd filepath && $(CABAL) clean --distpref=dist-bootstrapping
+       -cd Cabal    && $(CABAL) clean --distpref=dist-bootstrapping
        $(RM) -rf bootstrapping/*
        $(RM) -f bootstrapping.conf     bootstrapping.conf.old
        $(RM) -f bootstrapping.conf.tmp bootstrapping.conf.tmp.old
-       $(RM) -f cabal-bin
+       $(RM) -f cabal-bin cabal-bin.exe
        $(RM) -rf ifBuildable
        $(RM) -rf installPackage
        $(RM) -f libraries.txt index.html doc-index.html doc-index*.html
@@ -369,7 +382,6 @@ $(foreach SUBDIR,$(SUBDIRS),clean.library.$(SUBDIR)): \
 clean.library.%:
        $(RM) -f stamp/configure.library.*.$* $*/unbuildable
        -cd $* && $(CABAL) clean
-       -cd $* && $(CABAL) clean --distpref=dist-bootstrapping
        $(RM) -f $*/Setup $*/Setup.exe $*/Setup.hi $*/Setup.o
        $(RM) $*/GNUmakefile $*/Makefile.local
 endif