]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/Makefile
Merge branch 'terencehill/menu_optimization' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / Makefile
1 SCM := $(shell if [ -d .svn ]; then echo svn; elif [ -d ../.git ]; then echo git; fi)
2 PERL ?= perl
3 QCCFLAGS_WATERMARK ?= $(shell git describe)
4 CPP := cc -xc -E
5 QCC ?= gmqcc
6 NDEBUG ?= 1
7 BUILD_MOD ?= 0
8
9 QCCVERSIONFILE := qccversion.$(shell (cd server && $(QCC) --version) > qccversion.txt && git hash-object qccversion.txt)
10
11 # We eventually need to get rid of these
12 QCCFLAGS_WTFS ?= \
13         -Wno-field-redeclared
14
15 QCCDEFS ?= \
16         -DWATERMARK="$(QCCFLAGS_WATERMARK)" \
17         -DNDEBUG=$(NDEBUG) \
18         -DBUILD_MOD=$(BUILD_MOD) \
19         $(QCCDEFS_EXTRA)
20
21 # -Ooverlap-locals is required
22 QCCFLAGS ?= \
23         -std=gmqcc \
24         -Ooverlap-locals \
25         -O3 \
26         -Werror -Wall \
27         $(QCCFLAGS_WTFS) \
28         -flno -futf8 -fno-bail-on-werror \
29         -frelaxed-switch -freturn-assignments \
30         $(QCCFLAGS_EXTRA)
31
32 # xonotic build system overrides this by command line argument to turn off the update-cvarcount step
33 XON_BUILDSYSTEM =
34
35 .PHONY: all
36 all: qc
37
38 .PHONY: qc
39 qc: ../menu.dat ../progs.dat ../csprogs.dat
40
41 .PHONY: clean
42 clean:
43         rm -f ../progs.dat ../menu.dat ../csprogs.dat
44         rm -f tmp/*.qc tmp/*.d tmp/*.txt
45
46 $(QCCVERSIONFILE):
47         $(RM) qccversion.*
48         echo This file intentionally left blank. > $@
49
50 export QCC
51 export CPP
52 export QCCDEFS
53 export QCCFLAGS
54
55 ../csprogs.dat: client/progs.inc $(QCCVERSIONFILE)
56         @echo make[1]: Entering directory \`$(PWD)/client\'
57         sh ./qcc.sh client $@ $<
58 -include tmp/client.d
59
60 ../progs.dat: server/progs.inc $(QCCVERSIONFILE)
61         @echo make[1]: Entering directory \`$(PWD)/server\'
62         sh ./qcc.sh server $@ $<
63 -include tmp/server.d
64
65 ../menu.dat: menu/progs.inc $(QCCVERSIONFILE)
66         @echo make[1]: Entering directory \`$(PWD)/menu\'
67         sh ./qcc.sh menu $@ $<
68 -include tmp/menu.d
69
70 .PHONY: testcase
71 testcase:
72         cd testcase && $(QCC) $(QCCDEFS) $(QCCFLAGS) -DTESTCASE="$$TESTCASE"