]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/tools/compilationunits.sh
Merge branch 'master' into Mario/user_movetypes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / tools / compilationunits.sh
index 658fe8682581933e7629259049157738aac2559e..2fa17825ec1394d8b5efddc7db85513a7c00ca8c 100755 (executable)
@@ -1,6 +1,6 @@
-#!/bin/bash
+#!/usr/bin/env bash
 set -eu
-cd "$(dirname "$0")"
+cd ${0%/*}
 
 WORKDIR=../.tmp
 
@@ -9,7 +9,8 @@ CPP="cc -xc -E"
 
 declare -a QCCDEFS=(
     -DNDEBUG=1
-    -DWATERMARK="\"$(git describe --tags --dirty='*')\""
+    -DXONOTIC=1
+    -DWATERMARK="\"$(git describe --tags --dirty='~')\""
     -DDEBUGPATHING=0
 )
 QCCDEFS="${QCCDEFS[@]}"
@@ -33,14 +34,21 @@ QCCFLAGS="${QCCFLAGS[@]} ${NOWARN[@]}"
 . qcc.sh
 cd ..
 
-function check() {
+function check1() {
     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 \
+    declare -l file="${3}"
+    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
+    qcc ${QCCFLAGS} -o ../${WORKDIR}/test.dat ../${WORKDIR}/${MODE}.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
+        check1 ${base} ${MODE} ${file}
     done
 }