diff options
author | Michael Brown <mcb30@ipxe.org> | 2016-07-05 13:45:54 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2016-07-05 13:49:51 +0100 |
commit | 5430465185ba037c1f9c06cd3ec486b56dafb539 (patch) | |
tree | b7fd666b6c4d4a8ca89692c47e886ef5daa9e3a2 /src/Makefile.housekeeping | |
parent | 46719f2264fc63deaa712f4dc164d3b33c66e05f (diff) | |
download | ipxe-5430465185ba037c1f9c06cd3ec486b56dafb539.tar.gz |
[profile] Allow profiling to be globally enabled or disabled
As with assertions, profiling is enabled for objects built with any
debug level (including an explicit debug level of zero).
Allow profiling to be globally enabled or disabled by adding PROFILE=1
or PROFILE=0 respectively to the build command line.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/Makefile.housekeeping')
-rw-r--r-- | src/Makefile.housekeeping | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index a02acc8dd..f09db3728 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -747,6 +747,33 @@ include/assert.h : $(ASSERT_LIST) .PRECIOUS : include/assert.h +# (Single-element) list of profiling configuration +# +PROFILE_LIST := $(BIN)/.profile.list +ifeq ($(wildcard $(PROFILE_LIST)),) +PROFILE_OLD := <invalid> +else +PROFILE_OLD := $(shell cat $(PROFILE_LIST)) +endif +ifneq ($(PROFILE_OLD),$(PROFILE)) +$(shell $(ECHO) "$(PROFILE)" > $(PROFILE_LIST)) +endif + +$(PROFILE_LIST) : $(MAKEDEPS) + +VERYCLEANUP += $(PROFILE_LIST) + +# Profiling configuration +# +ifneq ($(PROFILE),) +CFLAGS += -DPROFILING=$(PROFILE) +endif + +include/ipxe/profile.h : $(PROFILE_LIST) + $(Q)$(TOUCH) $@ + +.PRECIOUS : include/ipxe/profile.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. |