hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
# Script to convert defines in compiler option in to C's defines
# Should be executed in make file and it take ccflags-y as the
# compiler options. The content will be redirected to the first arguement.
 
echo "#ifndef __SSV_MOD_CONF_H__" > $1
echo "#define __SSV_MOD_CONF_H__" >> $1
 
for flag in ${ccflags-y}; do
   if [[ "$flag" =~ ^-D.* ]]; then
       #def=${flag//-D/}
       def=${flag:2}
       echo "#ifndef $def" >> $1
       echo "#define $def" >> $1
       echo "#endif" >> $1
   fi
done
echo "#endif // __SSV_MOD_CONF_H__" >> $1