diff options
author | Ian Lynagh <igloo@earth.li> | 2009-12-09 12:39:29 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2009-12-09 12:39:29 +0000 |
commit | aea784af873f089a40af71849d83f59008562a58 (patch) | |
tree | 750cdda524b53717b2171d9c5e49bedb97e52d58 /rules/build-dependencies.mk | |
parent | 6ca3201b4bb8e5bfa0cd37646f1b0753fb975b29 (diff) | |
download | haskell-aea784af873f089a40af71849d83f59008562a58.tar.gz |
Eliminate mkdependC
We now just call gcc to get the dependencies directly
Diffstat (limited to 'rules/build-dependencies.mk')
-rw-r--r-- | rules/build-dependencies.mk | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk index dfb98d2c65..a2bae25963 100644 --- a/rules/build-dependencies.mk +++ b/rules/build-dependencies.mk @@ -10,35 +10,48 @@ # # ----------------------------------------------------------------------------- - define build-dependencies # args: $1 = dir, $2 = distdir +$1_$2_depfile_haskell = $$($1_$2_depfile_base).haskell +$1_$2_depfile_c_asm = $$($1_$2_depfile_base).c_asm + +$1_$2_C_FILES_DEPS = $$(filter-out $$($1_$2_C_FILES_NODEPS),$$($1_$2_C_FILES)) + 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)) +$1_$2_MKDEPENDHS_FLAGS = -include-pkg-deps -dep-makefile $$($1_$2_depfile_haskell).tmp $$(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)) +$1_$2_MKDEPENDHS_FLAGS = -optdep--include-pkg-deps -optdep-f -optdep$$($1_$2_depfile_haskell).tmp $$(foreach way,$$(filter-out v,$$($1_$2_WAYS)),-optdep-s -optdep$$(way)) endif ifneq "$$($1_$2_NO_BUILD_DEPS)" "YES" -$$($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 $$$$@)/. +$$($1_$2_depfile_haskell) : $$($1_$2_HS_SRCS) $$($1_$2_HS_BOOT_SRCS) $$($1_$2_HC_MK_DEPEND_DEP) | $$$$(dir $$$$@)/. "$$(RM)" $$(RM_OPTS) $$@.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) - sed -e "s|$1/\([^ :]*o[ :]\)|$1/$2/build/\1|g" -e "s|$$(TOP)/||" -e "s|$2/build/$2/build|$2/build|g" <$$($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) endif - echo "$1_$2_depfile_EXISTS = YES" >> $$@ + echo "$1_$2_depfile_haskell_EXISTS = YES" >> $$@.tmp 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 + mv $$@.tmp $$@ + +$$($1_$2_depfile_c_asm) : $$($1_$2_C_FILES_DEPS) $$($1_$2_S_FILES) | $$$$(dir $$$$@)/. + "$$(RM)" $$(RM_OPTS) $$@.tmp + touch $$@.tmp +ifneq "$$(strip $$($1_$2_C_FILES_DEPS)$$($1_$2_S_FILES))" "" + $$(foreach f,$$($1_$2_C_FILES_DEPS) $$($1_$2_S_FILES), \ + $$(foreach w,$$($1_$2_WAYS), \ + $$(call addCFileDeps,$1,$2,$$($1_$2_depfile_c_asm),$$f,$$w))) + "$$(RM)" $$(RM_OPTS) $$@.bit +endif + echo "$1_$2_depfile_c_asm_EXISTS = YES" >> $$@.tmp + mv $$@.tmp $$@ endif # $1_$2_NO_BUILD_DEPS @@ -46,10 +59,11 @@ endif # $1_$2_NO_BUILD_DEPS # 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) +$$($1_$2_depfile_haskell) : $$(UNLIT) ifneq "$$(NO_INCLUDE_DEPS)" "YES" -include $$($1_$2_depfile) +include $$($1_$2_depfile_haskell) +include $$($1_$2_depfile_c_asm) else ifeq "$$(DEBUG)" "YES" $$(warning not building dependencies in $1) @@ -57,3 +71,17 @@ endif endif endef + +define addCFileDeps + +# $1 = dir +# $2 = distdir +# $3 = depfile +# $4 = file +# $5 = way +# The formatting of this definition (e.g. the blank line above) is +# important, in order to get make to generate the right makefile code. + $(CPP) $($1_$2_MKDEPENDC_OPTS) $($1_$2_$5_ALL_CC_OPTS) $($(basename $4)_CC_OPTS) -MM $4 -MF $3.bit + sed -e "1s|\.o|\.$($5_osuf)|" -e "1s|^|$(dir $4)|" -e "1s|$1/|$1/$2/build/|" -e "s|$(TOP)/||g" -e "s|$2/build/$2/build|$2/build|g" $3.bit >> $3.tmp +endef + |