SCM := $(shell if [ -d .svn ]; then echo svn; elif [ -d ../.git ]; then echo git; fi)
PERL ?= perl
-QCCFLAGS_WATERMARK ?= -DWATERMARK='"$(shell git describe)"'
+QCCFLAGS_WATERMARK ?= $(shell git describe)
+CPP := cc -xc -E
QCC ?= gmqcc
NDEBUG ?= 1
+BUILD_MOD ?= 0
QCCVERSIONFILE := qccversion.$(shell (cd server && $(QCC) --version) > qccversion.txt && git hash-object qccversion.txt)
QCCFLAGS_WTFS ?= \
-Wno-field-redeclared
-QCCFLAGS_FEATURES ?= \
- -DBUILD_MOD=$(BUILD_MOD)
+QCCDEFS ?= \
+ -DWATERMARK="$(QCCFLAGS_WATERMARK)" \
+ -DNDEBUG=$(NDEBUG) \
+ -DBUILD_MOD=$(BUILD_MOD) \
+ $(QCCDEFS_EXTRA)
# -Ooverlap-locals is required
QCCFLAGS ?= \
-std=gmqcc \
-Ooverlap-locals \
-O3 \
- -Werror -Wall -Wcpp \
+ -Werror -Wall \
$(QCCFLAGS_WTFS) \
- -fftepp -flno -futf8 -fno-bail-on-werror -fftepp-predefs \
+ -flno -futf8 -fno-bail-on-werror \
-frelaxed-switch -freturn-assignments \
- $(QCCFLAGS_WATERMARK) \
- -DNDEBUG=$(NDEBUG) \
- $(QCCFLAGS_FEATURES) \
$(QCCFLAGS_EXTRA)
# xonotic build system overrides this by command line argument to turn off the update-cvarcount step
.PHONY: clean
clean:
rm -f ../progs.dat ../menu.dat ../csprogs.dat
- rm -f progs.d menu.d csprogs.d
+ rm -f tmp/*.qc tmp/*.d tmp/*.txt
$(QCCVERSIONFILE):
$(RM) qccversion.*
echo This file intentionally left blank. > $@
+export QCC
+export CPP
+export QCCDEFS
+export QCCFLAGS
+
../csprogs.dat: client/progs.inc $(QCCVERSIONFILE)
- @$(CC) -MM -MP -MF csprogs.d -MT $@ -x c -DCSQC -o $@ $<
@echo make[1]: Entering directory \`$(PWD)/client\'
- cd client && $(QCC) $(QCCFLAGS) -DCSQC -o ../$@ ../$<
--include csprogs.d
+ sh ./qcc.sh client $@ $<
+-include tmp/client.d
../progs.dat: server/progs.inc $(QCCVERSIONFILE)
- @$(CC) -MM -MP -MF progs.d -MT $@ -x c -DSVQC -o $@ $<
@echo make[1]: Entering directory \`$(PWD)/server\'
- cd server && $(QCC) $(QCCFLAGS) -DSVQC -o ../$@ ../$<
--include progs.d
+ sh ./qcc.sh server $@ $<
+-include tmp/server.d
../menu.dat: menu/progs.inc $(QCCVERSIONFILE)
- @$(CC) -MM -MP -MF menu.d -MT $@ -x c -DMENUQC -o $@ $<
@echo make[1]: Entering directory \`$(PWD)/menu\'
- cd menu && $(QCC) $(QCCFLAGS) -DMENUQC -o ../$@ ../$<
--include menu.d
+ sh ./qcc.sh menu $@ $<
+-include tmp/menu.d
.PHONY: testcase
testcase:
- cd testcase && $(QCC) $(QCCFLAGS) -DTESTCASE="$$TESTCASE"
+ cd testcase && $(QCC) $(QCCDEFS) $(QCCFLAGS) -DTESTCASE="$$TESTCASE"