]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/Makefile
Makefile: use `-I.`
[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 QCCDEFS_EXTRA ?= -DGMQCC
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         $(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 ../csprogs.dat: client/progs.inc $(QCCVERSIONFILE)
51         $(CC) -xc -I. $(QCCDEFS) -DCSQC -E -MMD -MP -MT $@ -Wall -Wundef -Werror -CC -o tmp/client.qc $<
52         @$(CC) -xc -I. $(QCCDEFS) -DCSQC -E -dM 1>tmp/client_macros.txt -H 2>tmp/client_includes.txt $<
53         @sed -i 's/^# \([[:digit:]]\+\) "\(.*\)".*/\n#pragma file(\2)\n#pragma line(\1)/g' tmp/client.qc
54         @echo make[1]: Entering directory \`$(PWD)/client\'
55         cd client && $(QCC) $(QCCFLAGS) -o ../$@ ../tmp/client.qc
56 -include tmp/client.d
57
58 ../progs.dat: server/progs.inc $(QCCVERSIONFILE)
59         $(CC) -xc -I. $(QCCDEFS) -DSVQC -E -MMD -MP -MT $@ -Wall -Wundef -Werror -CC -o tmp/server.qc $<
60         @$(CC) -xc -I. $(QCCDEFS) -DSVQC -E -dM 1>tmp/server_macros.txt -H 2>tmp/server_includes.txt $<
61         @sed -i 's/^# \([[:digit:]]\+\) "\(.*\)".*/\n#pragma file(\2)\n#pragma line(\1)/g' tmp/server.qc
62         @echo make[1]: Entering directory \`$(PWD)/server\'
63         cd server && $(QCC) $(QCCFLAGS) -o ../$@ ../tmp/server.qc
64 -include tmp/server.d
65
66 ../menu.dat: menu/progs.inc $(QCCVERSIONFILE)
67         $(CC) -xc -I. $(QCCDEFS) -DMENUQC -E -MMD -MP -MT $@ -Wall -Wundef -Werror -CC -o tmp/menu.qc $<
68         @$(CC) -xc -I. $(QCCDEFS) -DMENUQC -E -dM 1>tmp/menu_macros.txt -H 2>tmp/menu_includes.txt $<
69         @sed -i 's/^# \([[:digit:]]\+\) "\(.*\)".*/\n#pragma file(\2)\n#pragma line(\1)/g' tmp/menu.qc
70         @echo make[1]: Entering directory \`$(PWD)/menu\'
71         cd menu && $(QCC) $(QCCFLAGS) -o ../$@ ../tmp/menu.qc
72 -include tmp/menu.d
73
74 .PHONY: testcase
75 testcase:
76         cd testcase && $(QCC) $(QCCDEFS) $(QCCFLAGS) -DTESTCASE="$$TESTCASE"