diff options
author | Ian Lynagh <igloo@earth.li> | 2009-04-26 11:42:15 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2009-04-26 11:42:15 +0000 |
commit | 34cc75e1a62638f2833815746ebce0a9114dc26b (patch) | |
tree | ef21e8fd7af1356beea9cce7d6efb8a65374e24c /rules/build-dependencies.mk | |
parent | 74e1368d4688ee16f6decdf2cd3ebe27506b26ba (diff) | |
download | haskell-34cc75e1a62638f2833815746ebce0a9114dc26b.tar.gz |
GHC new build system megapatch
Diffstat (limited to 'rules/build-dependencies.mk')
-rw-r--r-- | rules/build-dependencies.mk | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk new file mode 100644 index 0000000000..860a2f6ff3 --- /dev/null +++ b/rules/build-dependencies.mk @@ -0,0 +1,48 @@ + +define build-dependencies # args: $1 = dir, $2 = distdir + +ifeq "$$($1_$2_ghc_ge_609)" "YES" +$1_$2_MKDEPENDHS_FLAGS = -include-pkg-deps -dep-makefile $$($1_$2_depfile) $$(foreach way,$$(filter-out v,$$($1_$2_WAYS)),-dep-suffix $$(way)) +else +$1_$2_MKDEPENDHS_FLAGS = -optdep--include-pkg-deps -optdep-f -optdep$$($1_$2_depfile) $$(foreach way,$$(filter-out v,$$($1_$2_WAYS)),-optdep-s -optdep$$(way)) +endif + +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 + $(RM) $$@ $$@.tmp + touch $$@.tmp +ifneq "$$($1_$2_C_SRCS)$$($1_$2_S_SRCS)" "" + $$(MKDEPENDC) -f $$($1_$2_depfile).tmp $$($1_MKDEPENDC_OPTS) $$(foreach way,$$($1_WAYS),-s $$(way)) -- $$($1_$2_v_ALL_CC_OPTS) -- $$($1_$2_C_FILES) $$($1_$2_S_FILES) || ( $$(RM) $$@; exit 1 ) + sed -e "s|$1/\([^ :]*o[ :]\)|$1/$2/build/\1|g" -e "s|$(TOP)/||" <$$($1_$2_depfile).tmp >$$($1_$2_depfile) +endif +ifneq "$$($1_$2_HS_SRCS)" "" + $$($1_$2_HC_MK_DEPEND) -M $$($1_$2_MKDEPENDHS_FLAGS) \ + $$(filter-out -split-objs, $$($1_$2_v_ALL_HC_OPTS)) \ + $$($1_$2_HS_SRCS) || ( $$(RM) $$@; exit 1 ) +endif + echo "$1_$2_depfile_EXISTS = YES" >> $$@ +ifneq "$$($1_$2_SLASH_MODS)" "" + for dir in $$(sort $$(foreach mod,$$($1_$2_SLASH_MODS),$1/$2/build/$$(dir $$(mod)))); do \ + if test ! -d $$$$dir; then mkdir -p $$$$dir; fi \ + done +endif + +endif # $1_$2_NO_BUILD_DEPS + +# Note sed magic above: mkdependC can't do -odir stuff, so we have to +# munge the dependencies it generates to refer to the correct targets. + +# Seems as good a place as any to attach the unlit dependency +$$($1_$2_depfile) : $$(UNLIT) + +ifneq "$$(NO_INCLUDE_DEPS)" "YES" +include $$($1_$2_depfile) +else +ifeq "$$(DEBUG)" "YES" +$$(warning not building dependencies in $1) +endif +endif + +endef |