There are now 104 calls to mkdirhier, down from 1201, when validating.
PLATFORM_H = ghc_boot_platform.h
-compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk
- "$(MKDIRHIER)" $(dir $@)
+compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
"$(RM)" $(RM_OPTS) $@
@echo "Creating $@..."
@echo "#ifndef __PLATFORM_H__" >$@
# For stage2 and above, the BUILD platform is the HOST of stage1, and
# the HOST platform is the TARGET of stage1. The TARGET remains the same
# (stage1 is the cross-compiler, not stage2).
-compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk
- "$(MKDIRHIER)" $(dir $@)
+compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
"$(RM)" $(RM_OPTS) $@
@echo "Creating $@..."
@echo "#ifndef __PLATFORM_H__" >$@
.PHONY: default all haddock
+# We need second expansion for the way we handle directories, so that
+# | $$$$(dir $$$$@)/.
+# expands to the directoy of a rule that uses a % pattern.
+.SECONDEXPANSION:
+
default : all
# Catch make if it runs away into an infinite loop
endif
# -----------------------------------------------------------------------------
+# Directories
+
+%/. : $(MKDIRHIER)
+ "$(MKDIRHIER)" $@
+
+# -----------------------------------------------------------------------------
# Special magic for the ghc-prim package
# We want the ghc-prim package to include the GHC.Prim module when it
PRIMOPS_TXT = $(GHC_COMPILER_DIR)/prelude/primops.txt
-libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs : $(GENPRIMOP_INPLACE) $(PRIMOPS_TXT)
- "$(MKDIRHIER)" $(dir $@)
+libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs : $(GENPRIMOP_INPLACE) $(PRIMOPS_TXT) | $$(dir $$@)/.
"$(GENPRIMOP_INPLACE)" --make-haskell-wrappers <$(PRIMOPS_TXT) >$@
libraries/ghc-prim/GHC/Prim.hs : $(GENPRIMOP_INPLACE) $(PRIMOPS_TXT)
libraries/ghc-prim/dist-install/build/autogen/GHC/PrimopWrappers.hs
libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs: \
- $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE) $(MKDIRHIER)
- "$(MKDIRHIER)" $(dir $@)
+ $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE) \
+ | $$(dir $$@)/.
"$(GENPRIMOP_INPLACE)" --make-haskell-source < $< > $@
libraries/ghc-prim/dist-install/build/autogen/GHC/PrimopWrappers.hs: \
- $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE) $(MKDIRHIER)
- "$(MKDIRHIER)" $(dir $@)
+ $(PRIMOPS_TXT) $(GENPRIMOP_INPLACE) \
+ | $$(dir $$@)/.
"$(GENPRIMOP_INPLACE)" --make-haskell-wrappers < $< > $@
# -----------------------------------------------------------------------------
$(rts_AUTO_APPLY_CMM): $(GENAPPLY_INPLACE)
"$(GENAPPLY_INPLACE)" >$@
-rts/dist/build/sm/Evac_thr.c : rts/sm/Evac.c
- "$(MKDIRHIER)" $(dir $@)
+rts/dist/build/sm/Evac_thr.c : rts/sm/Evac.c | $$(dir $$@)/.
cp $< $@
-rts/dist/build/sm/Scav_thr.c : rts/sm/Scav.c
- "$(MKDIRHIER)" $(dir $@)
+rts/dist/build/sm/Scav_thr.c : rts/sm/Scav.c | $$(dir $$@)/.
cp $< $@
rts_H_FILES = $(wildcard includes/*.h) $(wildcard rts/*.h)
ifneq "$$($1_$2_NO_BUILD_DEPS)" "YES"
-$$($1_$2_depfile) : $$(MKDIRHIER) $$(MKDEPENDC) $$($1_$2_HS_SRCS) $$($1_$2_HS_BOOT_SRCS) $$($1_$2_HC_MK_DEPEND_DEP) $$($1_$2_C_FILES) $$($1_$2_S_FILES)
- "$$(MKDIRHIER)" $1/$2/build
+$$($1_$2_depfile) : $$(MKDEPENDC) $$($1_$2_HS_SRCS) $$($1_$2_HS_BOOT_SRCS) $$($1_$2_HC_MK_DEPEND_DEP) $$($1_$2_C_FILES) $$($1_$2_S_FILES) | $$$$(dir $$$$@)/.
"$$(RM)" $$(RM_OPTS) $$@.tmp
touch $$@.tmp
ifneq "$$($1_$2_C_SRCS)$$($1_$2_S_SRCS)" ""
# INPLACE_BIN etc. might be empty if we're cleaning
ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
ifneq "$$(BINDIST)" "YES"
-$1/$2/$$($1_$2_PROG).prl: $1/$$($1_PERL_SRC) $$(UNLIT)
- "$$(MKDIRHIER)" $1/$2
+$1/$2/$$($1_$2_PROG).prl: $1/$$($1_PERL_SRC) $$(UNLIT) | $$$$(dir $$$$@)/.
"$$(UNLIT)" $$(UNLIT_OPTS) $$< $$@
$1/$2/$$($1_$2_PROG): $1/$2/$$($1_$2_PROG).prl
cat $$< >> $$@
$$(EXECUTABLE_FILE) $$@
-$$($1_$2_INPLACE): $1/$2/$$($1_$2_PROG)
- "$$(MKDIRHIER)" $$(dir $$@)
+$$($1_$2_INPLACE): $1/$2/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
"$$(CP)" $$< $$@
$$(EXECUTABLE_FILE) $$@
endif
$(call hs-objs,$1,$2,v)
ifeq "$$(BootingFromHc)" "NO"
-$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
"$$($1_$2_HC)" -o $$@ $$($1_$2_v_ALL_HC_OPTS) $$(LD_OPTS) $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS)
else
-$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
"$$(CC)" -o $$@ $$($1_$2_v_ALL_CC_OPTS) $$(LD_OPTS) $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) $$($1_$2_v_EXTRA_CC_OPTS)
endif
# INPLACE_BIN might be empty if we're distcleaning
ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
-$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) $$(MKDIRHIER)
- "$$(MKDIRHIER)" $$(dir $$@)
+$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
"$$(CP)" -p $$< $$@
touch $$@
endif
# UseGhcForCc is only relevant when not booting from HC files.
ifeq "$4 $$(BootingFromHc)" "YES NO"
-$1/$2/build/%.$$($3_osuf) : $1/%.c $$(MKDIRHIER) $$($1_$2_HC_DEP)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.$$($3_osuf) : $1/%.c $$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
"$$($1_$2_HC)" $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@
$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.c $$($1_$2_HC_DEP)
$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.$$($3_way_)s $$($1_$2_HC_DEP)
"$$($1_$2_HC)" $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@
-$1/$2/build/%.$$($3_osuf) : $1/%.S $$(MKDIRHIER) $$($1_$2_HC_DEP)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.$$($3_osuf) : $1/%.S $$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
"$$($1_$2_HC)" $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@
$1/$2/build/%.$$($3_way_)s : $1/$2/build/%.c $$($1_$2_HC_DEP)
else
-$1/$2/build/%.$$($3_osuf) : $1/%.c $$(MKDIRHIER)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.$$($3_osuf) : $1/%.c | $$$$(dir $$$$@)/.
"$$(CC)" $$($1_$2_$3_ALL_CC_OPTS) -c $$< -o $$@
$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.c
$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.$$($3_way_)s
"$$(AS)" $$($1_$2_$3_ALL_AS_OPTS) -o $$@ $$<
-$1/$2/build/%.$$($3_osuf) : $1/%.S $$(MKDIRHIER)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.$$($3_osuf) : $1/%.S | $$$$(dir $$$$@)/.
"$$(CC)" $$($1_$2_$3_ALL_CC_OPTS) -c $$< -o $$@
$1/$2/build/%.$$($3_way_)s : $1/$2/build/%.c
ifneq "$$(BootingFromHc)" "YES"
-$1/$2/build/%.$$($3_way_)o : $1/%.cmm $$(rts_H_FILES) $$($1_$2_HC_DEP)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.$$($3_way_)o : $1/%.cmm $$(rts_H_FILES) $$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
"$$($1_$2_HC)" $$($1_$2_$3_MOST_HC_OPTS) -c $$< -o $$@
-$1/$2/build/%.$$($3_way_)o : $1/$2/build/%.cmm $$(rts_H_FILES) $$($1_$2_HC_DEP)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.$$($3_way_)o : $1/$2/build/%.cmm $$(rts_H_FILES) $$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
"$$($1_$2_HC)" $$($1_$2_$3_MOST_HC_OPTS) -c $$< -o $$@
-$1/$2/build/%.$$($3_way_)hc : $1/%.cmm $$(rts_H_FILES) $$($1_$2_HC_DEP)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.$$($3_way_)hc : $1/%.cmm $$(rts_H_FILES) $$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
"$$($1_$2_HC)" $$($1_$2_$3_MOST_HC_OPTS) -C $$< -o $$@
-$1/$2/build/%.$$($3_way_)hc : $1/$2/build/%.cmm $$(rts_H_FILES) $$($1_$2_HC_DEP)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.$$($3_way_)hc : $1/$2/build/%.cmm $$(rts_H_FILES) $$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
"$$($1_$2_HC)" $$($1_$2_$3_MOST_HC_OPTS) -C $$< -o $$@
-$1/$2/build/%.$$($3_way_)s : $1/%.cmm $$(rts_H_FILES) $$($1_$2_HC_DEP)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.$$($3_way_)s : $1/%.cmm $$(rts_H_FILES) $$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
"$$($1_$2_HC)" $$($1_$2_$3_MOST_HC_OPTS) -S $$< -o $$@
-$1/$2/build/%.$$($3_way_)s : $1/$2/build/%.cmm $$(rts_H_FILES) $$($1_$2_HC_DEP)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.$$($3_way_)s : $1/$2/build/%.cmm $$(rts_H_FILES) $$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
"$$($1_$2_HC)" $$($1_$2_$3_MOST_HC_OPTS) -S $$< -o $$@
endif
$1_$2_HADDOCK_FLAGS += --hyperlink-source
endif
-$$($$($1_PACKAGE)_HADDOCK_FILE) : $$(MKDIRHIER) $$(INPLACE_BIN)/haddock$$(exeext) $$(GHC_CABAL_INPLACE) $$($1_$2_HS_SRCS) $$($$($1_PACKAGE)_HADDOCK_DEPS)
- "$$(MKDIRHIER)" $$(dir $$@)
+$$($$($1_PACKAGE)_HADDOCK_FILE) : $$(INPLACE_BIN)/haddock$$(exeext) $$(GHC_CABAL_INPLACE) $$($1_$2_HS_SRCS) $$($$($1_PACKAGE)_HADDOCK_DEPS) | $$$$(dir $$$$@)/.
"$$(GHC_CABAL_INPLACE)" haddock $2 $1 --with-haddock=$$(TOP)/$$(INPLACE_BIN)/haddock --with-ghc=$$(TOP)/$$(INPLACE_BIN)/ghc-stage2 $$($1_$2_HADDOCK_FLAGS) $$($1_$2_HADDOCK_OPTS)
# Make the haddocking depend on the library .a file, to ensure
ifneq "$$(BootingFromHc)" "YES"
-$1/$2/build/%.hs : $1/$4/%.ly $$(MKDIRHIER)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.hs : $1/$4/%.ly | $$$$(dir $$$$@)/.
"$$(HAPPY)" $$($1_$2_$3_ALL_HAPPY_OPTS) $$< -o $$@
-$1/$2/build/%.hs : $1/$4/%.y $$(MKDIRHIER)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.hs : $1/$4/%.y | $$$$(dir $$$$@)/.
"$$(HAPPY)" $$($1_$2_$3_ALL_HAPPY_OPTS) $$< -o $$@
-$1/$2/build/%.hs : $1/$4/%.x $$(MKDIRHIER)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.hs : $1/$4/%.x | $$$$(dir $$$$@)/.
"$$(ALEX)" $$($1_$2_$3_ALL_ALEX_OPTS) $$< -o $$@
-$1/$2/build/%_hsc.c $1/$2/build/%_hsc.h $1/$2/build/%.hs : $1/$4/%.hsc $$(HSC2HS_INPLACE)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%_hsc.c $1/$2/build/%_hsc.h $1/$2/build/%.hs : $1/$4/%.hsc $$(HSC2HS_INPLACE) | $$$$(dir $$$$@)/.
"$$(HSC2HS_INPLACE)" $$($1_$2_$3_ALL_HSC2HS_OPTS) $$< -o $$@
# Compiling Haskell source
# XXX: for some reason these get used in preference to the direct
# .hs->.o rule, I don't know why --SDM
-$1/$2/build/%.$$($3_osuf) : $1/$4/%.hc includes/ghcautoconf.h includes/ghcplatform.h $$(MKDIRHIER)
- "$$(MKDIRHIER)" $$(dir $$@)
+$1/$2/build/%.$$($3_osuf) : $1/$4/%.hc includes/ghcautoconf.h includes/ghcplatform.h | $$$$(dir $$$$@)/.
"$$(CC)" $$($1_$2_$3_ALL_CC_OPTS) -Iincludes -x c -c $$< -o $$@
$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.hc includes/ghcautoconf.h includes/ghcplatform.h
CABAL_VERSION := $(subst .,$(comma),$(CABAL_DOTTED_VERSION))
CABAL_CONSTRAINT := --constraint="Cabal == $(CABAL_DOTTED_VERSION)"
-$(GHC_CABAL_INPLACE) : $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext)
- "$(MKDIRHIER)" $(dir $@)
+$(GHC_CABAL_INPLACE) : $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext) | $$(dir $$@)/.
"$(CP)" $< $@
-$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/ghc-cabal.hs $(MKDIRHIER)
- "$(MKDIRHIER)" bootstrapping
- "$(MKDIRHIER)" $(dir $@)
+$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/ghc-cabal.hs | $$(dir $$@)/. bootstrapping/.
"$(GHC)" $(SRC_HC_OPTS) --make $(GHC_CABAL_DIR)/ghc-cabal.hs -o $@ \
-Wall $(WERROR) \
-DCABAL_VERSION=$(CABAL_VERSION) \
$(GHC_CABAL_DIR)_dist-dummy-ghc_PROG = dummy-ghc$(exeext)
# depend on project.mk, so we pick up the new version number if it changes.
-$(GHC_CABAL_DIR)/dist-dummy-ghc/build/dummy-ghc.hs : $(GHC_CABAL_DIR)/ghc.mk $(MKDIRHIER) mk/project.mk
- "$(MKDIRHIER)" $(dir $@)
+$(GHC_CABAL_DIR)/dist-dummy-ghc/build/dummy-ghc.hs : $(GHC_CABAL_DIR)/ghc.mk mk/project.mk | $$(dir $$@)/.
echo "import System.Environment; import System.Cmd; import System.Exit" >$@
echo "main :: IO ()" >>$@
echo "main = do args <- getArgs; if args == [\"--numeric-version\"] then putStrLn \"$(ProjectVersion)\" else do e <- rawSystem \"$(GHC_STAGE0)\" args; exitWith e" >>$@
else
-$(GHC_PKG_INPLACE) : utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG)$(exeext) $(MKDIRHIER)
- "$(MKDIRHIER)" $(INPLACE_PACKAGE_CONF)
+$(GHC_PKG_INPLACE) : utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG)$(exeext) | $$(dir $$@)/. $(INPLACE_PACKAGE_CONF)/.
"$(RM)" $(RM_OPTS) $(INPLACE_PACKAGE_CONF)/*
ifeq "$(Windows)" "YES"
cp $< $@
# depend on ghc-cabal, otherwise we build Cabal twice when building in parallel
# The binary package is not warning-clean, so we need a few -fno-warns here.
-utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG)$(exeext): utils/ghc-pkg/Main.hs utils/ghc-pkg/Version.hs $(GHC_CABAL_INPLACE) $(MKDIRHIER)
- "$(MKDIRHIER)" bootstrapping
- "$(MKDIRHIER)" utils/ghc-pkg/dist/build
+utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG)$(exeext): utils/ghc-pkg/Main.hs utils/ghc-pkg/Version.hs $(GHC_CABAL_INPLACE) | bootstrapping/. $$(dir $$@)/.
"$(GHC)" $(SRC_HC_OPTS) --make utils/ghc-pkg/Main.hs -o $@ \
-Wall -fno-warn-unused-imports \
-DCABAL_VERSION=$(CABAL_VERSION) \
#
# -----------------------------------------------------------------------------
-$(MKDEPENDC) : utils/mkdependC/mkdependC.prl $(MKDIRHIER)
- "$(MKDIRHIER)" $(dir $@)
+$(MKDEPENDC) : utils/mkdependC/mkdependC.prl | $$(dir $$@)/.
"$(RM)" $(RM_OPTS) $@
echo '#!$(PERL)' >> $@
echo '$$DEFAULT_TMPDIR = "$(DEFAULT_TMPDIR)";' >> $@
ifneq "$(BINDIST)" "YES"
# hack: the build system has trouble with Main modules not called Main.hs
-utils/runghc/dist/build/Main.hs : utils/runghc/runghc.hs $(MKDIRHIER)
- "$(MKDIRHIER)" $(dir $@)
+utils/runghc/dist/build/Main.hs : utils/runghc/runghc.hs | $$(dir $$@)/.
"$(CP)" $< $@
endif