From e2699f281ab50a2f2fe620fd5926ad0c64afecbd Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 11 Jul 2021 22:42:59 -0700 Subject: 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. --- configure | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'configure') 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 -- cgit v1.2.3