Home | History | Annotate | Line # | Download | only in libf7
      1 #!/usr/bin/env sh
      2 
      3 # The first command argument tells us which flavour to generate for
      4 # the rest of the command line arguments.
      5 
      6 what=$1
      7 shift
      8 
      9 # The second command argument is the prefix to prepend to all functions.
     10 # It is defined by F7_PREFIX in $2.
     11 
     12 PRE=$1
     13 shift
     14 
     15 case ${what} in
     16     head)
     17         cat << EOF
     18 /*
     19    Auto-generated file, do not change by hand.
     20 
     21    Generated by:    `basename $0`.
     22    Generated using: F7_PREFIX = ${PRE} from $1.
     23 		    F7F, F7F_cst, F7F_asm from libf7-common.mk.
     24    Included by:	    libf7.h.
     25    Used by: 	    libf7.c, libf7.h, libf7-asm.sx, f7-wraps.h.
     26 */
     27 
     28 #ifndef F7_RENAMES_H
     29 #define F7_RENAMES_H
     30 
     31 #define F7_(name)  ${PRE}##name
     32 #define F7P	   ${PRE}
     33 EOF
     34         ;;
     35 
     36     c)
     37         if [ x${PRE} != xf7_ ]; then
     38             echo " "
     39             echo "/* Renames for libf7.c, libf7.h.  */"
     40             echo " "
     41             for x in $*; do
     42                 echo "#define f7_$x ${PRE}$x"
     43             done
     44         fi
     45         ;;
     46 
     47     cst)
     48         if [ x${PRE} != xf7_ ]; then
     49             echo " "
     50             echo "/* Renames for libf7.c, libf7.h.  */"
     51             echo " "
     52             for x in $*; do
     53                 echo "#define f7_const_${x}   ${PRE}const_${x}"
     54                 echo "#define f7_const_${x}_P ${PRE}const_${x}_P"
     55             done
     56         fi
     57         ;;
     58 
     59     asm)
     60         if [ x${PRE} != xf7_ ]; then
     61             echo " "
     62             echo "/* Renames for libf7-asm.sx, f7-wraps.h.  */"
     63             echo " "
     64             for x in $*; do
     65                 echo "#define f7_${x}_asm ${PRE}${x}_asm"
     66             done
     67         fi
     68         ;;
     69 
     70     tail)
     71         cat << EOF
     72 
     73 #endif /* F7_RENAMES_H */
     74 EOF
     75         ;;
     76 
     77     *)
     78         exit 1
     79         ;;
     80 esac
     81