]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/tools/compilationunits.sh
Optimize vehicle impact code by only calling vlen() if damage would be taken
[xonotic/xonotic-data.pk3dir.git] / qcsrc / tools / compilationunits.sh
index ebb232105f51a66d03770486c0afe3950c44f7fb..e3d1eb01368df1c714c55d7264eda99e89ff8bbd 100755 (executable)
@@ -2,6 +2,25 @@
 set -eu
 cd ${0%/*}
 
+# This script attempts to build the codebase in every possible header configuration,
+# to check that all files #include what they need, so that we can eventually move away
+# from a unity build and into incremental compilation.
+
+# If these files exist from previous compilation, `./all compile` will stop
+# detecting changes after running this script so delete them to trigger
+# a recompile next time.
+if [ -f ../../csprogs.dat ]; then
+    rm ../../csprogs.dat
+fi
+
+if [ -f ../../menu.dat ]; then
+    rm ../../menu.dat
+fi
+
+if [ -f ../../progs.dat ]; then
+    rm ../../progs.dat
+fi
+
 WORKDIR=../.tmp
 
 CPP="cc -xc -E"
@@ -11,6 +30,9 @@ declare -a QCCDEFS=(
     -DNDEBUG=1
     -DXONOTIC=1
     -DWATERMARK="\"$(git describe --tags --dirty='~')\""
+    -DENABLE_EFFECTINFO=0
+    -DENABLE_DEBUGDRAW=0
+    -DENABLE_DEBUGTRACE=0
 )
 QCCDEFS="${QCCDEFS[@]}"
 
@@ -37,8 +59,10 @@ function check1() {
     declare -l prog="${1}"
     declare -l file="${2}"
     MODE=${prog}
+    includes="-include lib/_all.inc"
+    [ -f ${prog}/_all.qh ] && includes="${includes} -include ${prog}/_all.qh"
     qpp ${file} test.dat \
-            -include lib/_all.inc -include ${prog}/_all.qh \
+            ${includes} \
             -I. ${QCCIDENT} ${QCCDEFS} > ${WORKDIR}/${prog}.qc
     qcc ${QCCFLAGS} -o ../${WORKDIR}/test.dat ../${WORKDIR}/${prog}.qc >/dev/null
 }
@@ -50,6 +74,12 @@ function check() {
     done
 }
 
-check client
-check server
-check menu
+if [ ${#@} -eq 0 ]; then
+    check client
+    check server
+    check menu
+else
+    for var in ${@}; do
+        check ${var}
+    done
+fi