summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-07-23 07:59:58 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-07-23 07:59:58 -0700
commit956785645ee52c5c7226d6eddd47dc01c7f33567 (patch)
tree83ac6aad9b5c9ce728eb8e20acfcec77827ad7d8
parent292d6a1f11174da58fad1106b4aa5f8baea585f2 (diff)
downloadtxr-956785645ee52c5c7226d6eddd47dc01c7f33567.tar.gz
txr-956785645ee52c5c7226d6eddd47dc01c7f33567.tar.bz2
txr-956785645ee52c5c7226d6eddd47dc01c7f33567.zip
Fixes for building in separate dir.
* Makefile (CFLAGS): Search for mpi header in $(top_srcdir). (ABBREV): Remove top_srcdir prefix from source names. (dbg/%.o, opt/%.o): Extra set of pattern rules for searching for prerequisites in $(top_srcdir) where primary C sources are found and in the local dir where some generated C is found. This way we don't rely on VPATH. (opt/%.res): Bogus target removed. (VPATH): Removed in favor of explicitly referencing $(top_srcdir). Was causing problems for tests. (lex.yy.c, y.tab.c): Prerequisites referenced in $(top_srcdir).
-rw-r--r--ChangeLog15
-rw-r--r--Makefile24
2 files changed, 28 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 5ae1f8b0..d57de311 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2015-07-23 Kaz Kylheku <kaz@kylheku.com>
+ Fixes for building in separate dir.
+
+ * Makefile (CFLAGS): Search for mpi header in $(top_srcdir).
+ (ABBREV): Remove top_srcdir prefix from source names.
+ (dbg/%.o, opt/%.o): Extra set of pattern rules for searching
+ for prerequisites in $(top_srcdir) where primary C sources
+ are found and in the local dir where some generated C is found.
+ This way we don't rely on VPATH.
+ (opt/%.res): Bogus target removed.
+ (VPATH): Removed in favor of explicitly referencing $(top_srcdir).
+ Was causing problems for tests.
+ (lex.yy.c, y.tab.c): Prerequisites referenced in $(top_srcdir).
+
+2015-07-23 Kaz Kylheku <kaz@kylheku.com>
+
* parser.l (grammar): Do not allow unescaped newline in
word list literals and word list quasiliterals, except
in <= 109 compatibility mode. An escaped newline in
diff --git a/Makefile b/Makefile
index 09e3c242..cbb1219d 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,7 @@ VERBOSE :=
CFLAGS := -iquote $(conf_dir) -iquote $(top_srcdir) \
$(LANG_FLAGS) $(DIAG_FLAGS) \
$(DBG_FLAGS) $(PLATFORM_FLAGS) $(EXTRA_FLAGS)
-CFLAGS += -iquote mpi
+CFLAGS += -iquote $(top_srcdir)/mpi
CFLAGS := $(filter-out $(REMOVE_FLAGS),$(CFLAGS))
ifneq ($(subst g++,@,$(notdir $(CC))),$(notdir $(CC)))
@@ -83,7 +83,8 @@ V = $(if $(VERBOSE),,@)
# prerequisites without the long laundry list of additional dependencies.
ABBREV = $(if $(VERBOSE),\
@:,\
- @printf "%s %s -> %s\n" $(1) "$(filter-out $(DEP_$@),$^)" $@)
+ @printf "%s %s -> %s\n" $(1) \
+ "$(patsubst $(top_srcdir)/%,%,$(filter-out $(DEP_$@),$^))" $@)
ABBREV3 = $(if $(VERBOSE),@:,@printf "%s %s -> %s\n" $(1) "$(3)" $(2))
define DEPGEN
@@ -113,21 +114,24 @@ $(V)mkdir -p $(dir $@)
$(V)windres -O coff -DTXR_VER=$(txr_ver) $< $@
endef
+dbg/%.o: $(top_srcdir)/%.c
+ $(call COMPILE_C_WITH_DEPS,)
+
+opt/%.o: $(top_srcdir)/%.c
+ $(call COMPILE_C_WITH_DEPS,$(OPT_FLAGS))
+
dbg/%.o: %.c
$(call COMPILE_C_WITH_DEPS,)
opt/%.o: %.c
$(call COMPILE_C_WITH_DEPS,$(OPT_FLAGS))
-dbg/%-win.o: %.c
+dbg/%-win.o: $(top_srcdir)/%.c
$(call COMPILE_C_WITH_DEPS,-DCONFIG_WIN_MAIN=1)
-opt/%-win.o: %.c
+opt/%-win.o: $(top_srcdir)/%.c
$(call COMPILE_C_WITH_DEPS,-DCONFIG_WIN_MAIN=1 $(OPT_FLAGS))
-opt/%.res: win/%.rc
- $(call WINDRES)
-
%.res: %.rc
$(call WINDRES)
@@ -157,8 +161,6 @@ $(PROG)-win: $(patsubst %/txr.o,%/txr-win.o,$(OPT_OBJS)) $(EXTRA_OBJS-y)
$(PROG)-win-dbg: $(patsubst %/txr.o,%/txr-win.o,$(DBG_OBJS)) $(EXTRA_OBJS-y)
$(call LINK_PROG,-mwindows)
-VPATH := $(top_srcdir)
-
# Newline constant
define NL
@@ -180,7 +182,7 @@ $(call DEP,$(OBJS) $(EXTRA_OBJS-y),\
$(call DEP,opt/lex.yy.o dbg/lex.yy.o,y.tab.h)
-lex.yy.c: parser.l
+lex.yy.c: $(top_srcdir)/parser.l
$(call ABBREV,LEX)
$(V)rm -f $@
$(V)$(LEX) $(LEX_DBG_FLAGS) $<
@@ -193,7 +195,7 @@ y.tab.h: y.tab.c
exit 1; \
fi
-y.tab.c: parser.y
+y.tab.c: $(top_srcdir)/parser.y
$(call ABBREV,YACC)
$(V)rm -f y.tab.c
$(V)if $(YACC) -v -d $< ; then chmod a-w y.tab.c ; true ; else rm y.tab.c ; false ; fi