]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/tools/compilationunits.sh
Fix some references to the 'other' global
[xonotic/xonotic-data.pk3dir.git] / qcsrc / tools / compilationunits.sh
index 658fe8682581933e7629259049157738aac2559e..ebb232105f51a66d03770486c0afe3950c44f7fb 100755 (executable)
@@ -1,6 +1,6 @@
-#!/bin/bash
+#!/usr/bin/env bash
 set -eu
-cd "$(dirname "$0")"
+cd ${0%/*}
 
 WORKDIR=../.tmp
 
@@ -9,8 +9,8 @@ CPP="cc -xc -E"
 
 declare -a QCCDEFS=(
     -DNDEBUG=1
-    -DWATERMARK="\"$(git describe --tags --dirty='*')\""
-    -DDEBUGPATHING=0
+    -DXONOTIC=1
+    -DWATERMARK="\"$(git describe --tags --dirty='~')\""
 )
 QCCDEFS="${QCCDEFS[@]}"
 
@@ -33,17 +33,23 @@ QCCFLAGS="${QCCFLAGS[@]} ${NOWARN[@]}"
 . qcc.sh
 cd ..
 
+function check1() {
+    declare -l prog="${1}"
+    declare -l file="${2}"
+    MODE=${prog}
+    qpp ${file} test.dat \
+            -include lib/_all.inc -include ${prog}/_all.qh \
+            -I. ${QCCIDENT} ${QCCDEFS} > ${WORKDIR}/${prog}.qc
+    qcc ${QCCFLAGS} -o ../${WORKDIR}/test.dat ../${WORKDIR}/${prog}.qc >/dev/null
+}
+
 function check() {
-    declare -l base="${1}"
-    MODE=${2}
-    find ${base} -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
-        qpp ${file} test.dat \
-            -include lib/_all.inc -include ${base}/_all.qh \
-            -I. ${QCCIDENT} ${QCCDEFS} -D${MODE} > ${WORKDIR}/${MODE}.qc
-        qcc ${QCCFLAGS} -o ../${WORKDIR}/test.dat ../${WORKDIR}/${MODE}.qc >/dev/null
+    declare -l prog="${1}"
+    find ${prog} -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
+        check1 ${prog} ${file}
     done
 }
 
-check client CSQC
-check server SVQC
-check menu MENUQC
+check client
+check server
+check menu