diff options
Diffstat (limited to 'Makefile.inc')
-rw-r--r-- | Makefile.inc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Makefile.inc b/Makefile.inc index 7ce236031e..3840505cd5 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -464,11 +464,24 @@ export $(COREBOOT_EXPORTS) ####################################################################### # generate build support files -$(obj)/build.h: .xcompile + +build_h := $(obj)/build.h + +# We have to manually export variables that `genbuild_h.sh` uses +# when we call it through the `$(shell)` function. This is fragile +# but as variables newly added to `genbuild_h.sh` would just not +# work, we'd notice that instantly at least. +build_h_exports := BUILD_TIMELESS KERNELVERSION COREBOOT_EXTRA_VERSION + +# Report new `build.ht` as dependency if `build.h` differs. +build_h_check := \ + export $(foreach exp,$(build_h_exports),$(exp)="$($(exp))"); \ + util/genbuild_h/genbuild_h.sh >$(build_h)t 2>/dev/null; \ + cmp -s $(build_h)t $(build_h) >/dev/null 2>&1 || echo $(build_h)t + +$(build_h): $$(shell $$(build_h_check)) @printf " GEN build.h\n" - rm -f $(obj)/build.h - util/genbuild_h/genbuild_h.sh > $(obj)/build.ht - mv $(obj)/build.ht $(obj)/build.h + mv $< $@ build-dirs: mkdir -p $(objcbfs) $(objgenerated) |