From b2eebed31eff3243c75726818ca0c7f2868e3182 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 11 Jun 2014 06:45:30 -0700 Subject: * Makefile (txr.o): Pass TXR_VER preprocessor symbol on gcc command line. (PREINSTALL): New variable holding a step for the install recipe. (pax tar zip): New targets. * configure (txr_ver): Version now added to config.make, passed through to txr.c. (gen_config_make): bindir, datadir and mandir are established using gmake's regular macro assignment (=) rather than expanding assignment (:=). This allows us to override the prefix variable after configure time. * lib.h (wli_noex): New macro. (wli): Retarget to wli_noex, so that argument is subject to macro replacement. * txr.c (version): Use TXR_VER defined on compiler command line, rather than hard-coded string literal. --- ChangeLog | 21 +++++++++++++++++++++ Makefile | 20 ++++++++++++++++++++ configure | 8 +++++--- lib.h | 5 +++-- txr.c | 2 +- 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4388c617..67576f39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2014-06-11 Kaz Kylheku + + * Makefile (txr.o): Pass TXR_VER preprocessor symbol on gcc command + line. + (PREINSTALL): New variable holding a step for the install recipe. + (pax tar zip): New targets. + + * configure (txr_ver): Version now added to config.make, passed + through to txr.c. + (gen_config_make): bindir, datadir and mandir are established + using gmake's regular macro assignment (=) rather than + expanding assignment (:=). This allows us to override the + prefix variable after configure time. + + * lib.h (wli_noex): New macro. + (wli): Retarget to wli_noex, so that argument is subject + to macro replacement. + + * txr.c (version): Use TXR_VER defined on compiler command line, + rather than hard-coded string literal. + 2014-06-10 Kaz Kylheku * eval.c (eval_init): Change registration of string_cmp diff --git a/Makefile b/Makefile index 9c47ddcc..c5234a92 100644 --- a/Makefile +++ b/Makefile @@ -78,6 +78,7 @@ y.tab.o: CFLAGS += -Dlint txr.o: CFLAGS += -DTXR_REL_PATH=\"$(bindir_rel)/$(PROG)$(EXE)\" txr.o: CFLAGS += -DEXE_SUFF=\"$(EXE)\" -DPROG_NAME=\"$(PROG)\" +txr.o: CFLAGS += -DTXR_VER=\"$(txr_ver)\" $(MPI_OBJS): CFLAGS += -DXMALLOC=chk_malloc -DXREALLOC=chk_realloc $(MPI_OBJS): CFLAGS += -DXCALLOC=chk_calloc -DXFREE=free @@ -160,11 +161,30 @@ define INSTALL touch -r $(2) $(3)/$(notdir $(2)) endef +PREINSTALL := : + .PHONY: install install: $(PROG) + $(PREINSTALL) $(call INSTALL,0755,txr,$(DESTDIR)$(bindir)) $(call INSTALL,0444,$(top_srcdir)/txr.1,$(DESTDIR)$(mandir)/man1) +.PHONY: unixtar tar zip + +pax tar zip: DESTDIR=pkg +pax tar zip: prefix= +pax tar zip: PREINSTALL=rm -rf pkg + +pax: install + cd pkg; find . | pax -w -f ../txr-$(txr_ver)-bin.tar -x ustar . + compress txr-$(txr_ver)-bin.tar + +tar: install + tar -C pkg -cZf txr-$(txr_ver)-bin.tar.Z . + +zip: install + cd pkg; zip -r ../txr-$(txr_ver)-bin.zip . + # # Install the tests as well as the script to run them # diff --git a/configure b/configure index 86e17c26..111bf260 100755 --- a/configure +++ b/configure @@ -564,6 +564,8 @@ gen_config_make() # derived from the txr_shell variable. SHELL := $txr_shell +txr_ver := $txr_ver + # absolute path to source code directory top_srcdir := $top_srcdir @@ -581,13 +583,13 @@ DESTDIR := $install_prefix bindir_rel := $bindir # executable directory -bindir := \$(prefix)/\$(bindir_rel) +bindir = \$(prefix)/\$(bindir_rel) # read-only data directory -datadir := \$(prefix)/$datadir +datadir = \$(prefix)/$datadir # man page directory -mandir := \$(prefix)/$mandir +mandir = \$(prefix)/$mandir # cross compiler toolchain root directory cross := $cross diff --git a/lib.h b/lib.h index 157649af..2afe2f16 100644 --- a/lib.h +++ b/lib.h @@ -289,14 +289,15 @@ INLINE type_t type(val obj) typedef struct wli wchli_t; #if LIT_ALIGN < 4 -#define wli(lit) ((const wchli_t *) (L"\0" L ## lit L"\0" + 1)) +#define wli_noex(lit) ((const wchli_t *) (L"\0" L ## lit L"\0" + 1)) #define wini(ini) L"\0" L ## ini L"\0" #define wref(arr) ((arr) + 1) #else -#define wli(lit) ((const wchli_t *) L ## lit) +#define wli_noex(lit) ((const wchli_t *) L ## lit) #define wini(ini) L ## ini #define wref(arr) (arr) #endif +#define wli(lit) wli_noex(lit) INLINE val auto_str(const wchli_t *str) { diff --git a/txr.c b/txr.c index d46a2d67..80a902b7 100644 --- a/txr.c +++ b/txr.c @@ -54,7 +54,7 @@ #include "regex.h" #include "txr.h" -const wchli_t *version = wli("89"); +const wchli_t *version = wli(TXR_VER); const wchar_t *progname = L"txr"; static const char *progname_u8; static val progpath = nil; -- cgit v1.2.3