]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/Makefile
Merge branch 'terencehill/menu_optimization' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / Makefile
index 0294374a023cb207c27f2430aaaf01d3846e2a30..5198283b2e7e25b5abbc158a81a462c29d11ed44 100644 (file)
@@ -1,8 +1,10 @@
 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)
 
@@ -10,21 +12,21 @@ QCCVERSIONFILE := qccversion.$(shell (cd server && $(QCC) --version) > qccversio
 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
@@ -39,30 +41,32 @@ qc: ../menu.dat ../progs.dat ../csprogs.dat
 .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"