summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-11 22:42:59 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-11 22:42:59 -0700
commite2699f281ab50a2f2fe620fd5926ad0c64afecbd (patch)
tree4a5bc96aec952c2ae37c2500f3aa79c297b19936 /configure
parent8f0676b0790b8ae015be20c3c2ca56ab4649d317 (diff)
downloadtxr-e2699f281ab50a2f2fe620fd5926ad0c64afecbd.tar.gz
txr-e2699f281ab50a2f2fe620fd5926ad0c64afecbd.tar.bz2
txr-e2699f281ab50a2f2fe620fd5926ad0c64afecbd.zip
New: build-id feature.
A build-id is a string optionally embedded into TXR at build time which can be displayed with a command line option. It can help developers who are juggling multiple builds in their workspace to identify what they are running. * Makefile (txr.o, txr-win.o): If a build_id has been defined, then define the TXR_BUILD_ID macro on the command line when compiling these object files. * configure (build_id): New variable. (help) Describe build_id. (gen_config_make): Generate build_id and build_id_exp make variables. * txr.1: Documented --build-id option. * tsr.c (build_id): Conditionally defined global variable. (help): Brief help string for --build-id. (txr_main): Process --build-id option.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure30
1 files changed, 30 insertions, 0 deletions
diff --git a/configure b/configure
index 3fa9b4eb..c5901d20 100755
--- a/configure
+++ b/configure
@@ -211,6 +211,7 @@ have_pkgconfig=
libffi_cflags=
darwin_target=
android_target=
+build_id=
#
# Parse configuration variables
@@ -545,6 +546,22 @@ small-mem [$small_mem]
and certain global book-keeping arrays in the generational garbage
collector are smaller, resulting in more frequent collections.
+build-id [$build_id]
+
+ This option specifies the value of the build_id make variable.
+ The argument is GNU make syntax which calculates a string
+ that is inserted into the TXR executable. The string is reproduced
+ by reproduced using the txr --build-id. The default is that there
+ no build-id, and the --build-id option produces empty output.
+
+ If the argument value "git" is given, then the value is replaced
+ by syntax which which takes value of the output of the command
+ "git describe --tags --dirty",
+ executed in the source directory. This is recalculated each time
+ the txr.c source file is compiled.
+
+ The build_id variable can be overridden from the make command line.
+
!
exit 1
fi
@@ -869,6 +886,19 @@ compiler_prefix := $compiler_prefix
# prefix for non-compiler toolchain commands
tool_prefix := $tool_prefix
+# build_id
+$(gitcmd='git describe --tags --dirty';
+ if [ "$build_id" = "git" ] ; then
+ if [ $build_in_srcdir ] ; then
+ printf 'build_id ?= $(shell %s)\n' "$gitcmd"
+ else
+ printf 'build_id ?= $(shell cd $(top_srcdir); %s)\n' "$gitcmd"
+ fi
+ else
+ printf 'build_id = %s\n' "$build_id"
+ fi)
+build_id_exp := \$(build_id)
+
# do we compile in syslog support?
have_syslog := $have_syslog