diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-12-28 18:40:37 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-12-28 18:40:37 -0500 |
commit | 1ed6fe4326b46d0693bffbea34d6850a046a939c (patch) | |
tree | 64d6aae10588cfbe64209741c5b4805bc4eed60f /modules.mk | |
parent | 8fe05997a4ffe4d193a4ba763edc2a25e49dafc5 (diff) |
Make timestamp files for builddeps rules to avoid extra work
Diffstat (limited to 'modules.mk')
-rw-r--r-- | modules.mk | 78 |
1 files changed, 59 insertions, 19 deletions
@@ -11,60 +11,100 @@ modules = \ # powertop only needs to be used when running './powertop.trisquel6' all_modules = $(modules) powertop +# Easy names for src/% and tmp/builddeps-%.stamp +$(addprefix get,$(all_modules)): get%: PHONY src/% +$(addprefix builddeps-,$(all_modules)): builddeps-%: PHONY tmp/builddeps-%.stamp + +# The "all" rules getall: $(addprefix src/,$(modules)) builddeps: $(addprefix builddeps-,$(modules)) cleandeps: $(addprefix cleandeps-,$(all_modules)) - rm -rf bin/* + rm -rf bin/* tmp/* -# The generic rules +# If we depend on a file in src/*/*, we should generate it by calling +# the builddep rule. +$(foreach module,$(all_modules),$(eval src/$(module)/%: | tmp/builddeps-$(module).stamp; test -e $$@)) -$(foreach module,$(all_modules),$(eval src/$(module)/%: builddeps-$(module); test -e $$@)) + +# The generic rules +# "get" rules +$(addprefix src/,$(all_modules)): \ src/%: get source-locations.sh ./get $* -builddeps-%: src/% + test -e $@ + touch $@ + +# "builddeps" rules +tmp/builddeps-%.stamp: src/% $(MAKE) -C $< -cleandeps-%: + touch $@ + +# "cleandeps" rules +$(addprefix cleandeps-,$(all_modules)): \ +cleandeps-%: PHONY cleandeps-%-custom + rm -f tmp/builddeps-%.stamp +cleandeps-%-custom: PHONY test ! -f src/$*/Makefile || $(MAKE) -C src/$* clean + # The overrides -builddeps-coreboot:: src/coreboot - $(MAKE) -C $</util/cbfstool - $(MAKE) -C $</util/nvramtool - $(MAKE) -C $< crossgcc-i386 -cleandeps-coreboot:: +$(addprefix src/coreboot/util/,cbfstool nvramtool crossgcc): \ +src/coreboot/util/%: | src/coreboot + test -d $@ +tmp/builddeps-coreboot.stamp:: \ + tmp/builddeps-coreboot-cbfstool.stamp \ + tmp/builddeps-coreboot-nvramtool.stamp \ + tmp/builddeps-coreboot-crossgcc.stamp + touch $@ +tmp/builddeps-coreboot-cbfstool.stamp:: src/coreboot/util/cbfstool + $(MAKE) -C $< + touch $@ +tmp/builddeps-coreboot-nvramtool.stamp:: src/coreboot/util/nvramtool + $(MAKE) -C $< + touch $@ +tmp/builddeps-coreboot-crossgcc.stamp:: src/coreboot/util/crossgcc + $(MAKE) -C src/coreboot crossgcc-i386 + touch $@ +cleandeps-coreboot-custom:: PHONY test ! -f src/coreboot/Makefile || $(MAKE) -C src/coreboot clean test ! -f src/coreboot/Makefile || $(MAKE) -C src/coreboot/util/cbfstool clean test ! -f src/coreboot/Makefile || $(MAKE) -C src/coreboot/util/nvramtool clean test ! -f src/coreboot/Makefile || $(MAKE) -C src/coreboot crossgcc-clean + rm -f tmp/builddeps-coreboot-*.stamp -builddeps-flashrom:: src/flashrom +tmp/builddeps-flashrom.stamp:: src/flashrom $(MAKE) -C $< patchname=_normal PROGRAM=flashrom $(MAKE) -C $< patchname=_lenovobios_macronix $(MAKE) -C $< patchname=_sst + touch $@ -builddeps-grub:: src/grub +tmp/builddeps-grub.stamp:: src/grub cd $< && { test -x ./configure || ./autogen.sh; } cd $< && { test -f ./Makefile || ./configure --with-platform=coreboot; } $(MAKE) -C $< + touch $@ -builddeps-powertop:: src/powertop +tmp/builddeps-powertop.stamp:: src/powertop cd $< && { text -x ./configure || ./autogen.sh; } cd $< && { test -f ./Makefile || ./configure; } $(MAKE) -C $< + touch $@ -builddeps-grubinvaders:: src/grubinvaders +tmp/builddeps-grubinvaders.stamp:: src/grubinvaders cd $< && ./compile.sh -cleandeps-grubinvaders:: + touch $@ +cleandeps-grubinvaders-custom:: PHONY test ! -d src/grubinvaders || { cd src/grubinvaders && ./clean.sh; } -builddeps-seabios:: src/seabios resources/seabios/config/config +tmp/builddeps-seabios.stamp:: src/seabios resources/seabios/config/config cp resources/seabios/config/config $</.config $(MAKE) -C $< + touch $@ -builddeps-dejavu:: src/dejavu ; -cleandeps-dejavu:: ; +tmp/builddeps-dejavu.stamp:: src/dejavu ; touch $@ +cleandeps-dejavu-custom:: PHONY ; -cleandeps-i945pwm:: +cleandeps-i945pwm-custom:: PHONY rm -f src/i945pwm/i945-pwm |