this script is run on the build system, not on the host.
[asterisk/asterisk.git] / build_tools / make_buildopts_h
1 #!/bin/sh
2
3 cat << END
4 /*
5  * buildopts.h 
6  * Automatically generated
7  */
8
9 END
10 TMP=`${GREP} MENUSELECT_CFLAGS menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
11 for x in ${TMP}; do
12         echo "#define ${x} 1"
13 done
14 TMP=`${GREP} MENUSELECT_BUILD_DEPS menuselect.makeopts | sed 's/MENUSELECT_BUILD_DEPS\=//g'`
15 for x in ${TMP}; do
16         x2=`echo ${x} | tr a-z A-Z`
17         echo "#define AST_MODULE_${x2} 1"
18 done
19 if ${GREP} AST_DEVMODE makeopts | ${GREP} -q yes
20 then
21         echo "#define AST_DEVMODE 1"
22         TMP="${TMP} AST_DEVMODE"
23 fi
24
25 case ${OSARCH} in       # actually we should check build_os
26 *BSD|mingw*)
27         BUILDSUM=`echo ${TMP} | md5`
28         echo "#define AST_BUILDOPT_SUM {0x0, 0x0, 0x0, 0x0} /* dummy */"
29         ;;
30 *)
31         BUILDSUM=`echo ${TMP} | md5sum`
32         echo "#define AST_BUILDOPT_SUM {0x${BUILDSUM:0:8}, 0x${BUILDSUM:8:8}, 0x${BUILDSUM:16:8}, 0x${BUILDSUM:24:8}}"
33         ;;
34 esac