5 # This script attempts to build the codebase in every possible header configuration,
6 # to check that all files #include what they need, so that we can eventually move away
7 # from a unity build and into incremental compilation.
9 # If these files exist from previous compilation, `./all compile` will stop
10 # detecting changes after running this script so delete them to trigger
11 # a recompile next time.
12 if [ -f ../../csprogs.dat ]; then
16 if [ -f ../../menu.dat ]; then
20 if [ -f ../../progs.dat ]; then
27 : ${QCC:=$PWD/../../../../gmqcc/gmqcc}
32 -DWATERMARK="\"$(git describe --tags --dirty='~')\""
37 QCCDEFS="${QCCDEFS[@]}"
41 # Without -O3, GMQCC thinks some variables are used uninitialized if the initialization is done inside an `if (1)` block
42 # (which is created by e.g. BEGIN_MACRO) which would cause the compilation units test to fail.
43 # There doesn't appear to be any measurable increase in compile time
44 # and it allows us to get rid of some explicit initializations which are just useless noise.
55 -Wno-implicit-function-pointer
56 -Wno-missing-return-values
58 QCCFLAGS="${QCCFLAGS[@]} ${NOWARN[@]}"
64 declare -l prog="${1}"
65 declare -l file="${2}"
67 includes="-include lib/_all.inc"
68 [ -f ${prog}/_all.qh ] && includes="${includes} -include ${prog}/_all.qh"
69 qpp ${file} test.dat \
71 -I. ${QCCIDENT} ${QCCDEFS} > ${WORKDIR}/${prog}.qc
72 qcc ${QCCFLAGS} -o ../${WORKDIR}/test.dat ../${WORKDIR}/${prog}.qc >/dev/null
76 declare -l prog="${1}"
77 find ${prog} -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
78 check1 ${prog} ${file}
82 if [ ${#@} -eq 0 ]; then