summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-06-10 07:08:27 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-06-10 07:08:27 -0700
commit06e308526e9c612eaf6e36c36f2213bb915038e4 (patch)
treed9075680fcc21d9d1dc236eb51ad9c5e9133b885 /Makefile
parenta0ac30ccbf3acb38be1aa65ab2aa780239c4a123 (diff)
downloadtxr-06e308526e9c612eaf6e36c36f2213bb915038e4.tar.gz
txr-06e308526e9c612eaf6e36c36f2213bb915038e4.tar.bz2
txr-06e308526e9c612eaf6e36c36f2213bb915038e4.zip
2014-06-10 Kaz Kylheku <kaz@kylheku.com>
* Makefile (PROG): Removing ./ prefix from variable name; adding it to invocations of $(PROG) in some rules. (txr.o): Pass several strings as macros on the command line: TXR_REL_PATH, EXE_SUFF and PROG_NAME. * configure (bindir, datadir, mandir): These variables become just relative paths from the prefix. * txr.c (sysroot): Use the TXR_REL_PATH, EXE_SUFF and PROG_NAME preprocessor symbols defined on the command line to avoid hard-coding strings like "bin/txr" and "bin/txr.exe" which actually should reflect the value of the bindir variable.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 11 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 780f1659..9c47ddcc 100644
--- a/Makefile
+++ b/Makefile
@@ -51,7 +51,7 @@ MPI_OBJS := $(addprefix mpi-$(mpi_version)/,$(MPI_OBJ_BASE))
OBJS += $(MPI_OBJS)
-PROG := ./txr
+PROG := txr
$(PROG): $(OBJS) $(OBJS-y)
$(CC) $(CFLAGS) -o $@ $^ -lm $(LEXLIB)
@@ -73,6 +73,12 @@ y.tab.c y.tab.h: parser.y
# Bison-generated parser also tests for this lint define.
y.tab.o: CFLAGS += -Dlint
+# txr.c needs to know the relative datadir path to do some sysroot
+# calculations.
+
+txr.o: CFLAGS += -DTXR_REL_PATH=\"$(bindir_rel)/$(PROG)$(EXE)\"
+txr.o: CFLAGS += -DEXE_SUFF=\"$(EXE)\" -DPROG_NAME=\"$(PROG)\"
+
$(MPI_OBJS): CFLAGS += -DXMALLOC=chk_malloc -DXREALLOC=chk_realloc
$(MPI_OBJS): CFLAGS += -DXCALLOC=chk_calloc -DXFREE=free
@@ -132,13 +138,13 @@ tests/011/%: TXR_DBG_OPTS :=
%.ok: %.txr
mkdir -p $(dir $@)
$(if $(TXR_SCRIPT_ON_CMDLINE),\
- $(PROG) $(TXR_DBG_OPTS) $(TXR_OPTS) -c "$$(cat $^)" \
+ ./$(PROG) $(TXR_DBG_OPTS) $(TXR_OPTS) -c "$$(cat $^)" \
$(TXR_ARGS) > $(@:.ok=.out),\
- $(PROG) $(TXR_DBG_OPTS) $(TXR_OPTS) $^ $(TXR_ARGS) > $(@:.ok=.out))
+ ./$(PROG) $(TXR_DBG_OPTS) $(TXR_OPTS) $^ $(TXR_ARGS) > $(@:.ok=.out))
diff -u $(^:.txr=.expected) $(@:.ok=.out)
%.expected: %.txr
- $(PROG) $(TXR_OPTS) $^ $(TXR_ARGS) > $@
+ ./$(PROG) $(TXR_OPTS) $^ $(TXR_ARGS) > $@
#
# Installation macro.
@@ -178,7 +184,7 @@ install-tests:
# Generate web page from man page
#
txr-manpage.html: txr.1 genman.txr
- man2html $< | $(PROG) genman.txr - > $@
+ man2html $< | ./$(PROG) genman.txr - > $@
config.make config.h:
@echo "$@ missing: you didn't run ./configure"