]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/tools/compilationunits.sh
Merge branch 'master' into Mario/showspecs
[xonotic/xonotic-data.pk3dir.git] / qcsrc / tools / compilationunits.sh
1 #!/bin/bash
2 set -eu
3 cd "$(dirname "$0")"
4
5 WORKDIR=../.tmp
6
7 CPP="cc -xc -E"
8 : ${QCC:=$PWD/../../../../gmqcc/gmqcc}
9
10 declare -a QCCDEFS=(
11     -DNDEBUG=1
12     -DWATERMARK="\"$(git describe --tags --dirty='~')\""
13     -DDEBUGPATHING=0
14 )
15 QCCDEFS="${QCCDEFS[@]}"
16
17 declare -a QCCFLAGS=(
18     -std=gmqcc
19     -Wall -Werror
20     -futf8
21     -freturn-assignments
22     -frelaxed-switch
23     -Ooverlap-locals
24 )
25 declare -a NOWARN=(
26     -Wno-field-redeclared
27     -Wno-unused-variable
28     -Wno-implicit-function-pointer
29     -Wno-missing-return-values
30 )
31 QCCFLAGS="${QCCFLAGS[@]} ${NOWARN[@]}"
32
33 . qcc.sh
34 cd ..
35
36 function check1() {
37     declare -l base="${1}"
38     MODE=${2}
39     declare -l file="${3}"
40     qpp ${file} test.dat \
41             -include lib/_all.inc -include ${base}/_all.qh \
42             -I. ${QCCIDENT} ${QCCDEFS} -D${MODE} > ${WORKDIR}/${MODE}.qc
43     qcc ${QCCFLAGS} -o ../${WORKDIR}/test.dat ../${WORKDIR}/${MODE}.qc >/dev/null
44 }
45
46 function check() {
47     declare -l base="${1}"
48     MODE=${2}
49     find ${base} -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
50         check1 ${base} ${MODE} ${file}
51     done
52 }
53
54 check client CSQC
55 check server SVQC
56 check menu MENUQC