summaryrefslogtreecommitdiffstats
path: root/src/Makefile.housekeeping
diff options
context:
space:
mode:
authorMichael Brown2021-02-04 03:45:45 +0100
committerMichael Brown2021-02-04 03:53:25 +0100
commitbfb72ec2342409ff196bc5efa34ea367cb8c963e (patch)
treeee4eb5e9ef9f2a851942784e5aaac1e585037379 /src/Makefile.housekeeping
parent[efi] Fix erroneous comparison of a pointer against userptr_t (diff)
downloadipxe-bfb72ec2342409ff196bc5efa34ea367cb8c963e.tar.gz
ipxe-bfb72ec2342409ff196bc5efa34ea367cb8c963e.tar.xz
ipxe-bfb72ec2342409ff196bc5efa34ea367cb8c963e.zip
[build] Avoid spurious "make clean" when building for the first time
The function trace recorder build logic defaults to making "clean" a dependency of the first build in a clean checkout. This is redundant and causes problems if the build process spins up multiple make invocations to handle multiple build architectures. Fix by replacing with logic based on the known-working patterns used for the ASSERT and PROFILE build parameters. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/Makefile.housekeeping')
-rw-r--r--src/Makefile.housekeeping61
1 files changed, 32 insertions, 29 deletions
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index 91be542a..f379ff4e 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -468,35 +468,6 @@ ASFLAGS += --fatal-warnings
HOST_CFLAGS += -Werror
endif
-# Function trace recorder state in the last build. This is needed
-# in order to correctly rebuild whenever the function recorder is
-# enabled/disabled.
-#
-FNREC_STATE := $(BIN)/.fnrec.state
-ifeq ($(wildcard $(FNREC_STATE)),)
-FNREC_OLD := <invalid>
-else
-FNREC_OLD := $(shell cat $(FNREC_STATE))
-endif
-ifeq ($(FNREC_OLD),$(FNREC))
-$(FNREC_STATE) :
-else
-$(FNREC_STATE) : clean
-$(shell $(ECHO) "$(FNREC)" > $(FNREC_STATE))
-endif
-
-VERYCLEANUP += $(FNREC_STATE)
-MAKEDEPS += $(FNREC_STATE)
-
-ifeq ($(FNREC),1)
-# Enabling -finstrument-functions affects gcc's analysis and leads to spurious
-# warnings about use of uninitialised variables.
-#
-CFLAGS += -Wno-uninitialized
-CFLAGS += -finstrument-functions
-CFLAGS += -finstrument-functions-exclude-file-list=core/fnrec.c
-endif
-
# Enable per-item sections and section garbage collection. Note that
# some older versions of gcc support -fdata-sections but treat it as
# implying -fno-common, which would break our build. Some other older
@@ -808,6 +779,38 @@ include/ipxe/profile.h : $(PROFILE_LIST)
.PRECIOUS : include/ipxe/profile.h
+# (Single-element) list of function recorder configuration
+#
+FNREC_LIST := $(BIN)/.fnrec.list
+ifeq ($(wildcard $(FNREC_LIST)),)
+FNREC_OLD := <invalid>
+else
+FNREC_OLD := $(shell cat $(FNREC_LIST))
+endif
+ifneq ($(FNREC_OLD),$(FNREC))
+$(shell $(ECHO) "$(FNREC)" > $(FNREC_LIST))
+endif
+
+$(FNREC_LIST) : $(MAKEDEPS)
+
+VERYCLEANUP += $(FNREC_LIST)
+
+# Function recorder configuration
+#
+ifeq ($(FNREC),1)
+# Enabling -finstrument-functions affects gcc's analysis and leads to spurious
+# warnings about use of uninitialised variables.
+#
+CFLAGS += -Wno-uninitialized
+CFLAGS += -finstrument-functions
+CFLAGS += -finstrument-functions-exclude-file-list=core/fnrec.c
+endif
+
+include/compiler.h : $(FNREC_LIST)
+ $(Q)$(TOUCH) $@
+
+.PRECIOUS : include/compiler.h
+
# These files use .incbin inline assembly to include a binary file.
# Unfortunately ccache does not detect this dependency and caches
# builds even when the binary file has changed.