14 # use context to work around cmake issue #12619
16 if [ -f ${MOD}.inc ]; then
17 oldHashC=$(hash ${MOD}.inc)
18 oldTimeC=$(stat -c "%Y" ${MOD}.inc)
20 if [ -f ${MOD}.qh ]; then
21 oldHashH=$(hash ${MOD}.qh)
22 oldTimeH=$(stat -c "%Y" ${MOD}.qh)
24 echo '// generated file; do not modify' > ${MOD}.inc
25 echo '// generated file; do not modify' > ${MOD}.qh
26 for f in $(ls | sort -k 1,1 -t .); do
27 if [[ "$f" == cl_* ]]; then f="${f#cl_}"; if [[ -f "$f" ]]; then continue; fi
28 elif [[ "$f" == sv_* ]]; then f="${f#sv_}"; if [[ -f "$f" ]]; then continue; fi
29 elif [[ "$f" == ui_* ]]; then f="${f#ui_}"; if [[ -f "$f" ]]; then continue; fi
31 if [[ "$f" == *.qc ]]; then
32 if [[ -f "$f" ]]; then echo -e "#include <${CTX}$f>" >> ${MOD}.inc; fi
33 if [[ -f "${f%.qc}.qh" ]]; then echo -e "#include <${CTX}${f%.qc}.qh>" >> ${MOD}.qh; fi
34 if [[ -f "cl_$f" ]]; then echo -e "#ifdef CSQC\n #include <${CTX}cl_$f>\n#endif" >> ${MOD}.inc; fi
35 if [[ -f "cl_${f%.qc}.qh" ]]; then echo -e "#ifdef CSQC\n #include <${CTX}cl_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi
36 if [[ -f "sv_$f" ]]; then echo -e "#ifdef SVQC\n #include <${CTX}sv_$f>\n#endif" >> ${MOD}.inc; fi
37 if [[ -f "sv_${f%.qc}.qh" ]]; then echo -e "#ifdef SVQC\n #include <${CTX}sv_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi
38 if [[ -f "ui_$f" ]]; then echo -e "#ifdef MENUQC\n #include <${CTX}ui_$f>\n#endif" >> ${MOD}.inc; fi
39 if [[ -f "ui_${f%.qc}.qh" ]]; then echo -e "#ifdef MENUQC\n #include <${CTX}ui_${f%.qc}.qh>\n#endif" >> ${MOD}.qh; fi
43 if [[ -f "_all.inc" ]]; then rec=0; fi
44 for f in *; do if [ -d "$f" ]; then
45 (cd -- "$f" && genmod)
46 if [[ $rec == 1 ]]; then
51 if [[ $rec != 0 ]]; then
53 if [[ -f "$f/_all.inc" ]]; then mod=_all; fi
54 echo "#include <${CTX}$f/${mod}.inc>" >> ${MOD}.inc
55 echo "#include <${CTX}$f/${mod}.qh>" >> ${MOD}.qh
58 newHashC=$(hash ${MOD}.inc)
59 if [[ $newHashC == $oldHashC ]]; then touch -d @$oldTimeC ${MOD}.inc; fi
60 newHashH=$(hash ${MOD}.qh)
61 if [[ $newHashH == $oldHashH ]]; then touch -d @$oldTimeH ${MOD}.qh; fi