From 4a2431d8da60b3c0d47f342bfffe3313b96b8a44 Mon Sep 17 00:00:00 2001 From: TimePath Date: Fri, 8 Jan 2016 10:16:12 +1100 Subject: [PATCH] Makefile: allow custom output directory --- qcsrc/Makefile | 11 ++++++----- qcsrc/qcc.sh | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/qcsrc/Makefile b/qcsrc/Makefile index 5198283b2..04df61fa7 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -4,6 +4,7 @@ QCCFLAGS_WATERMARK ?= $(shell git describe) CPP := cc -xc -E QCC ?= gmqcc NDEBUG ?= 1 +PROGS_OUT ?= $(CURDIR)/.. BUILD_MOD ?= 0 QCCVERSIONFILE := qccversion.$(shell (cd server && $(QCC) --version) > qccversion.txt && git hash-object qccversion.txt) @@ -36,11 +37,11 @@ XON_BUILDSYSTEM = all: qc .PHONY: qc -qc: ../menu.dat ../progs.dat ../csprogs.dat +qc: $(PROGS_OUT)/menu.dat $(PROGS_OUT)/progs.dat $(PROGS_OUT)/csprogs.dat .PHONY: clean clean: - rm -f ../progs.dat ../menu.dat ../csprogs.dat + rm -f $(PROGS_OUT)/progs.dat $(PROGS_OUT)/menu.dat $(PROGS_OUT)/csprogs.dat rm -f tmp/*.qc tmp/*.d tmp/*.txt $(QCCVERSIONFILE): @@ -52,17 +53,17 @@ export CPP export QCCDEFS export QCCFLAGS -../csprogs.dat: client/progs.inc $(QCCVERSIONFILE) +$(PROGS_OUT)/csprogs.dat: client/progs.inc $(QCCVERSIONFILE) @echo make[1]: Entering directory \`$(PWD)/client\' sh ./qcc.sh client $@ $< -include tmp/client.d -../progs.dat: server/progs.inc $(QCCVERSIONFILE) +$(PROGS_OUT)/progs.dat: server/progs.inc $(QCCVERSIONFILE) @echo make[1]: Entering directory \`$(PWD)/server\' sh ./qcc.sh server $@ $< -include tmp/server.d -../menu.dat: menu/progs.inc $(QCCVERSIONFILE) +$(PROGS_OUT)/menu.dat: menu/progs.inc $(QCCVERSIONFILE) @echo make[1]: Entering directory \`$(PWD)/menu\' sh ./qcc.sh menu $@ $< -include tmp/menu.d diff --git a/qcsrc/qcc.sh b/qcsrc/qcc.sh index 87fdc1593..0ee3c3a42 100755 --- a/qcsrc/qcc.sh +++ b/qcsrc/qcc.sh @@ -23,4 +23,4 @@ ${CPP} -MMD -MP -MT ${OUT} -Wall -Wundef -Werror -o ./tmp/${MODE}.txt ${IN} ${CPP} -dM 1>./tmp/${MODE}_macros.txt -H 2>./tmp/${MODE}_includes.txt ${IN} sed 's/^#\(line\)\? \([[:digit:]]\+\) "\(.*\)".*/\n#pragma file(\3)\n#pragma line(\2)/g' ./tmp/${MODE}.txt > ./tmp/${MODE}.qc cd ${MODE} -${QCC} ${QCCFLAGS} -o ../${OUT} ../tmp/${MODE}.qc +${QCC} ${QCCFLAGS} -o ${OUT} ../tmp/${MODE}.qc -- 2.39.2