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