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