- -$(RM) -f stamp/configure.library.*.$*
- cd $* && setup/Setup configure \
- $(CONFIGURE_OPTS) \
- --prefix=$(prefix) \
- --with-compiler=../../compiler/ghc-inplace$(dot_bat) \
- --with-hc-pkg=../../utils/ghc-pkg/ghc-pkg-inplace$(dot_bat) \
- --with-hsc2hs=../../utils/hsc2hs/hsc2hs-inplace$(dot_bat) \
- --with-ld=$(LD) \
- --datasubdir=ghc \
- --haddock-args="--use-contents=../index.html --use-index=../doc-index.html" \
- --configure-option=--with-cc=$(CC)
- touch $@
-
+ -$(RM) -f stamp/configure.library.*.$* $*/unbuildable
+ ( cd $* && setup/Setup configure \
+ $(CONFIGURE_OPTS) \
+ --prefix=/NONEXISTANT \
+ --bindir=/NONEXISTANT \
+ --libdir=/NONEXISTANT \
+ --libsubdir='$$pkgid' \
+ --libexecdir=/NONEXISTANT \
+ --datadir=/NONEXISTANT \
+ --docdir=/NONEXISTANT \
+ --haddockdir=/NONEXISTANT \
+ --htmldir=/NONEXISTANT \
+ --with-compiler=../../compiler/stage1/ghc-inplace \
+ --with-hc-pkg=../../utils/ghc-pkg/ghc-pkg-inplace \
+ --with-hsc2hs=../../utils/hsc2hs/hsc2hs-inplace \
+ --with-ld=$(LD) \
+ --haddock-options="--use-contents=../index.html \
+ --use-index=../doc-index.html" \
+ $(FLAGGED_CONFIGURE_ARGS) \
+ --configure-option=--with-cc=$(CC) ) \
+ && touch $@ || touch $*/unbuildable
+# We don't touch $@ if configure failed as we would prefer to try
+# configuring it next time round, rather than assuming it'll still fail.
+# This is particularly important for bootlibs, where failure means the
+# build dies!
+
+# Build the library using 'make'
+# We re-run 'setup makefile' each time, just in case any preprocessing
+# 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)):\
+make.library.%: stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).% \
+ %/setup/Setup ifBuildable/ifBuildable installPackage/installPackage
+ if ifBuildable/ifBuildable $*; then \
+ cd $* && \
+ cmp -s ../Makefile.local Makefile.local || cp ../Makefile.local .; \
+ mv GNUmakefile GNUmakefile.tmp; \
+ setup/Setup makefile -f GNUmakefile; \
+ cmp -s GNUmakefile GNUmakefile.tmp && mv GNUmakefile.tmp GNUmakefile; \
+ $(MAKE) $(MFLAGS) && \
+ ../installPackage/installPackage register --inplace; \
+ fi
+
+# Build the library using 'setup build' (not the default)