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