Clean up Makefile "warning" clutter when makeopts doesn't exist.
[asterisk/asterisk.git] / build_tools / make_buildopts_h
1 #!/bin/sh
2
3 GREP=${GREP:-grep}
4 MD5=${MD5:-md5sum}
5
6 cat << END
7 /*
8  * buildopts.h 
9  * Automatically generated
10  */
11
12 END
13 TMP=`${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
14 for x in ${TMP}; do
15         echo "#define ${x} 1"
16         if test "x${BUILDOPTS}" != "x" ; then
17                 BUILDOPTS="${BUILDOPTS}, ${x}"
18         else
19                 BUILDOPTS="${x}"
20         fi
21 done
22 TMP=`${GREP} -e "^MENUSELECT_BUILD_DEPS" menuselect.makeopts | sed 's/MENUSELECT_BUILD_DEPS\=//g'`
23 for x in ${TMP}; do
24         x2=`echo ${x} | tr a-z A-Z`
25         echo "#define AST_MODULE_${x2} 1"
26 done
27 if ${GREP} "AST_DEVMODE" makeopts | ${GREP} -q "yes"
28 then
29         echo "#define AST_DEVMODE 1"
30         TMP="${TMP} AST_DEVMODE"
31 fi
32
33 BUILDSUM=`echo ${TMP} | ${MD5} | cut -c1-32`
34
35 echo "#define AST_BUILDOPT_SUM \"${BUILDSUM}\""
36 echo "#define AST_BUILDOPTS \"${BUILDOPTS}\""