6 # This script creates / updates the _mod.qc / _mod.qh / _mod.inc files based on
7 # the qc / qh files present in the qcsrc folder.
20 # use context to work around cmake issue #12619
22 if [ -f ${MOD}.inc ]; then
23 oldHashC=$(hash ${MOD}.inc)
24 oldTimeC=$(stat -c "%Y" ${MOD}.inc)
26 if [ -f ${MOD}.qh ]; then
27 oldHashH=$(hash ${MOD}.qh)
28 oldTimeH=$(stat -c "%Y" ${MOD}.qh)
30 echo '// generated file; do not modify' > ${MOD}.inc
31 echo '// generated file; do not modify' > ${MOD}.qh
32 for f in $(ls | sed -e "s/^cl_//" -e "s/^sv_//" -e "s/^ui_//" | sort -u); do
33 if [[ "$f" != *.qc ]]; then continue; fi
34 if [[ -f "$f" ]]; then echo -e "#include <${CTX}$f>" >> ${MOD}.inc; fi
35 if [[ -f "${f%.qc}.qh" ]]; then echo -e "#include <${CTX}${f%.qc}.qh>" >> ${MOD}.qh; fi
36 if [[ -f "cl_$f" ]]; then echo -e "#ifdef CSQC\n #include <${CTX}cl_$f>\n#endif" >> ${MOD}.inc; fi
37 if [[ -f "cl_${f%.qc}.qh" ]]; then echo -e "#ifdef CSQC\n #include <${CTX}cl_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi
38 if [[ -f "sv_$f" ]]; then echo -e "#ifdef SVQC\n #include <${CTX}sv_$f>\n#endif" >> ${MOD}.inc; fi
39 if [[ -f "sv_${f%.qc}.qh" ]]; then echo -e "#ifdef SVQC\n #include <${CTX}sv_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi
40 if [[ -f "ui_$f" ]]; then echo -e "#ifdef MENUQC\n #include <${CTX}ui_$f>\n#endif" >> ${MOD}.inc; fi
41 if [[ -f "ui_${f%.qc}.qh" ]]; then echo -e "#ifdef MENUQC\n #include <${CTX}ui_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi
44 if [[ -f "_all.inc" ]]; then rec=0; fi
45 for f in *; do if [ -d "$f" ]; then
46 (cd -- "$f" && genmod)
47 if [[ $rec == 1 ]]; then
52 if [[ $rec != 0 ]]; then
54 if [[ -f "$f/_all.inc" ]]; then mod=_all; fi
55 echo "#include <${CTX}$f/${mod}.inc>" >> ${MOD}.inc
56 echo "#include <${CTX}$f/${mod}.qh>" >> ${MOD}.qh
59 newHashC=$(hash ${MOD}.inc)
60 if [[ $newHashC == $oldHashC ]]; then touch -d @$oldTimeC ${MOD}.inc; fi
61 newHashH=$(hash ${MOD}.qh)
62 if [[ $newHashH == $oldHashH ]]; then touch -d @$oldTimeH ${MOD}.qh; fi