From b7cd92a68c5f75f41ce802081d1777675472ee57 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 21 Aug 2016 15:57:02 +1000 Subject: [PATCH] Update compiler scripts for GAMEQC --- qcsrc/tools/compilationunits.sh | 25 ++++++++++++------------- qcsrc/tools/qcc.sh | 24 +++++++++++------------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/qcsrc/tools/compilationunits.sh b/qcsrc/tools/compilationunits.sh index cccb93856..ebb232105 100755 --- a/qcsrc/tools/compilationunits.sh +++ b/qcsrc/tools/compilationunits.sh @@ -34,23 +34,22 @@ QCCFLAGS="${QCCFLAGS[@]} ${NOWARN[@]}" cd .. function check1() { - declare -l base="${1}" - MODE=${2} - declare -l file="${3}" + declare -l prog="${1}" + declare -l file="${2}" + MODE=${prog} 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 + -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 - check1 ${base} ${MODE} ${file} + 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 diff --git a/qcsrc/tools/qcc.sh b/qcsrc/tools/qcc.sh index 7df2fc4b3..603bb9128 100755 --- a/qcsrc/tools/qcc.sh +++ b/qcsrc/tools/qcc.sh @@ -12,7 +12,15 @@ QCCFLAGS=${QCCFLAGS} function qpp() { IN=$1 OUT=$2 - >&2 echo + ${CPP} ${@:3} ${IN} + case ${MODE} in + client) DEFS="-DGAMEQC -DCSQC" + ;; + menu) DEFS="-DMENUQC" + ;; + server) DEFS="-DGAMEQC -DSVQC" + ;; + esac + >&2 echo + ${CPP} ${@:3} ${DEFS} ${IN} set +e # additional information ${CPP} ${@:3} \ @@ -20,7 +28,7 @@ function qpp() { -H 2>${WORKDIR}/${MODE}_includes.txt \ ${IN} # main step - ${CPP} ${@:3} -MMD -MP -MT ${OUT} -Wall -Wundef -Werror ${IN} -o ${WORKDIR}/${MODE}.txt + ${CPP} ${@:3} ${DEFS} -MMD -MP -MT ${OUT} -Wall -Wundef -Werror ${IN} -o ${WORKDIR}/${MODE}.txt err=$? set -e if [ ${err} -ne 0 ]; then return ${err}; fi @@ -37,16 +45,6 @@ $(return >/dev/null 2>&1) || { MODE=$1 OUT=$2 IN=$3 - - case ${MODE} in - client) DEFS="-DGAMEQC -DCSQC" - ;; - menu) DEFS="-DMENUQC" - ;; - server) DEFS="-DGAMEQC -DSVQC" - ;; - esac - - qpp ${IN} ${OUT} -I. ${QCCIDENT} ${QCCDEFS} ${DEFS} > ${WORKDIR}/${MODE}.qc + qpp ${IN} ${OUT} -I. ${QCCIDENT} ${QCCDEFS} > ${WORKDIR}/${MODE}.qc qcc ${QCCFLAGS} -o ${OUT} ../${WORKDIR}/${MODE}.qc } -- 2.39.2