]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/Makefile
Fix autobuilds
[xonotic/xonotic-data.pk3dir.git] / qcsrc / Makefile
1 QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty=*)
2 CPP := cc -xc -E
3 QCC ?= gmqcc
4 NDEBUG ?= 1
5 PROGS_OUT ?= $(CURDIR)/..
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 pk3
36
37 .PHONY: qc
38 qc: $(PROGS_OUT)/menu.dat $(PROGS_OUT)/progs.dat $(PROGS_OUT)/csprogs.dat
39
40 .PHONY: pk3
41 pk3: qc
42         $(eval PROG=csprogs)
43         $(eval VER=${QCCFLAGS_WATERMARK})
44         $(eval PK3=${PROG}-${VER}.pk3)
45         $(eval TXT=${PROG}-${VER}.txt)
46         $(eval DAT=${PROG}-${VER}.dat)
47         $(eval LNO=${PROG}-${VER}.lno)
48         @ echo "http://xonotic.org" > ${TXT}
49         @ ln -f $(PROGS_OUT)/${PROG}.dat ${DAT}
50         @ ln -f $(PROGS_OUT)/${PROG}.lno ${LNO}
51         @ rm -f *.pk3
52         zip -9 ${PK3} ${TXT} ${DAT} ${LNO}
53         @ rm ${TXT} ${DAT} ${LNO}
54
55 dirtree:
56         @mkdir -p ../.tmp
57
58 .PHONY: clean
59 clean: | dirtree
60         rm -f $(PROGS_OUT)/csprogs.dat
61         rm -f $(PROGS_OUT)/progs.dat
62         rm -f $(PROGS_OUT)/menu.dat
63         rm -f ../.tmp/*.qc
64         rm -f ../.tmp/*.d
65         rm -f ../.tmp/*.txt
66
67 $(QCCVERSIONFILE):
68         $(RM) qccversion.*
69         echo This file intentionally left blank. > $@
70
71 export QCC
72 export CPP
73 export QCCDEFS
74 export QCCFLAGS
75
76 $(PROGS_OUT)/csprogs.dat: client/progs.inc $(QCCVERSIONFILE) | dirtree
77         @echo make[1]: Entering directory \`$(PWD)/client\'
78         sh ./qcc.sh client $@ $<
79 -include ../.tmp/client.d
80
81 $(PROGS_OUT)/progs.dat: server/progs.inc $(QCCVERSIONFILE) | dirtree
82         @echo make[1]: Entering directory \`$(PWD)/server\'
83         sh ./qcc.sh server $@ $<
84 -include ../.tmp/server.d
85
86 $(PROGS_OUT)/menu.dat: menu/progs.inc $(QCCVERSIONFILE) | dirtree
87         @echo make[1]: Entering directory \`$(PWD)/menu\'
88         sh ./qcc.sh menu $@ $<
89 -include ../.tmp/menu.d
90
91 .PHONY: testcase
92 testcase:
93         cd testcase && $(QCC) $(QCCDEFS) $(QCCFLAGS) -DTESTCASE="$$TESTCASE"