~ chicken-core (chicken-5) fb814d66b47d570a4a34cab60941b26f6e07f944
commit fb814d66b47d570a4a34cab60941b26f6e07f944
Author: Peter Bex <peter.bex@xs4all.nl>
AuthorDate: Sat Jan 21 20:18:01 2012 +0100
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Mon Jan 23 05:48:30 2012 +0100
Add option to enable profiling more easily for specific compilation objects
diff --git a/README b/README
index 8d0d0679..2d529456 100644
--- a/README
+++ b/README
@@ -217,6 +217,15 @@
LLVM version of gcc and with "clang", the LLVM-based C compiler,
just set C_COMPILER to "llvm-gcc" or "clang".
+ PROFILE_OBJECTS=
+ This variable allows you to profile (parts of) Chicken itself.
+ Just pass in a whitespace-separated list of objects, without
+ the .scm-extension. (An "object" here is an individual
+ .scm-file which gets compiled to a .c-file)
+ To build with profiling support, run "make spotless" first.
+ Be warned that this is a highly experimental option and
+ profiling doesn't work for every component of Chicken.
+
2.5. Uninstalling Chicken
To remove CHICKEN from your file-system, enter (probably as
diff --git a/defaults.make b/defaults.make
index 03a014d8..474f9cd7 100644
--- a/defaults.make
+++ b/defaults.make
@@ -285,6 +285,8 @@ CHICKEN_PROGRAM_OPTIONS += -no-trace
CHICKEN_COMPILER_OPTIONS += -no-trace
endif
+CHICKEN_PROGRAM_OPTIONS += $(if $(PROFILE_OBJECTS),-profile)
+
# targets
CHICKEN_PROGRAM = $(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)
diff --git a/rules.make b/rules.make
index 7ec86133..7fc04e8a 100644
--- a/rules.make
+++ b/rules.make
@@ -494,7 +494,11 @@ endef
$(foreach lib, $(SETUP_API_OBJECTS_1),\
$(eval $(call declare-emitted-import-lib-dependency,$(lib))))
-bootstrap-lib = $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
+define profile-flags
+$(if $(filter $(basename $(1)),$(PROFILE_OBJECTS)),-profile)
+endef
+
+bootstrap-lib = $(CHICKEN) $(call profile-flags, $@) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@
library.c: $(SRCDIR)library.scm $(SRCDIR)banner.scm $(SRCDIR)common-declarations.scm
$(bootstrap-lib)
Trap