4 # This script creates / updates the _mod.qc / _mod.qh / _mod.inc files based on
5 # the qc / qh files present in the qcsrc folder.
18 # use context to work around cmake issue #12619
20 if [ -f ${MOD}.inc ]; then
21 oldHashC=$(hash ${MOD}.inc)
22 oldTimeC=$(stat -c "%Y" ${MOD}.inc)
24 if [ -f ${MOD}.qh ]; then
25 oldHashH=$(hash ${MOD}.qh)
26 oldTimeH=$(stat -c "%Y" ${MOD}.qh)
28 echo '// generated file; do not modify' > ${MOD}.inc
29 echo '// generated file; do not modify' > ${MOD}.qh
30 for f in $(ls | sort -k 1,1 -t .); do
31 if [[ "$f" == cl_* ]]; then f="${f#cl_}"; if [[ -f "$f" ]]; then continue; fi
32 elif [[ "$f" == sv_* ]]; then f="${f#sv_}"; if [[ -f "$f" ]]; then continue; fi
33 elif [[ "$f" == ui_* ]]; then f="${f#ui_}"; if [[ -f "$f" ]]; then continue; fi
35 if [[ "$f" == *.qc ]]; then
36 if [[ -f "$f" ]]; then echo -e "#include <${CTX}$f>" >> ${MOD}.inc; fi
37 if [[ -f "${f%.qc}.qh" ]]; then echo -e "#include <${CTX}${f%.qc}.qh>" >> ${MOD}.qh; fi
38 if [[ -f "cl_$f" ]]; then echo -e "#ifdef CSQC\n #include <${CTX}cl_$f>\n#endif" >> ${MOD}.inc; fi
39 if [[ -f "cl_${f%.qc}.qh" ]]; then echo -e "#ifdef CSQC\n #include <${CTX}cl_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi
40 if [[ -f "sv_$f" ]]; then echo -e "#ifdef SVQC\n #include <${CTX}sv_$f>\n#endif" >> ${MOD}.inc; fi
41 if [[ -f "sv_${f%.qc}.qh" ]]; then echo -e "#ifdef SVQC\n #include <${CTX}sv_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi
42 if [[ -f "ui_$f" ]]; then echo -e "#ifdef MENUQC\n #include <${CTX}ui_$f>\n#endif" >> ${MOD}.inc; fi
43 if [[ -f "ui_${f%.qc}.qh" ]]; then echo -e "#ifdef MENUQC\n #include <${CTX}ui_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi
47 if [[ -f "_all.inc" ]]; then rec=0; fi
48 for f in *; do if [ -d "$f" ]; then
49 (cd -- "$f" && genmod)
50 if [[ $rec == 1 ]]; then
55 if [[ $rec != 0 ]]; then
57 if [[ -f "$f/_all.inc" ]]; then mod=_all; fi
58 echo "#include <${CTX}$f/${mod}.inc>" >> ${MOD}.inc
59 echo "#include <${CTX}$f/${mod}.qh>" >> ${MOD}.qh
62 newHashC=$(hash ${MOD}.inc)
63 if [[ $newHashC == $oldHashC ]]; then touch -d @$oldTimeC ${MOD}.inc; fi
64 newHashH=$(hash ${MOD}.qh)
65 if [[ $newHashH == $oldHashH ]]; then touch -d @$oldTimeH ${MOD}.qh; fi