#!/bin/sh # # mkconfigx # # Copyright (c) 2003 # Marc Singer # # Generate a configuration file to control building # (compiling/linking). The output may be included in Makefiles to # select which source files to compile and link. # # Here, we select configuration entries of the form: # # #define CONFIG_XXX 1 # # where XXX is an enabled configuration option. # # # About CPP # --------- # # The macro CPP may refer to 'gcc -E'. This definition is not # compatible with this use of the preprocessor because the input file # is a header and not a source file. Should there be a dependency on # a target-specific macro, another method must be found. # CONFIG=configx.mk CPP=cpp [ -z "$GREP" ] && GREP=grep [ -z "$SED" ] && SED=sed [ -z "$SORT" ] && SORT=sort echo > $CONFIG echo "# Automatically generated - do not edit" >> $CONFIG echo >> $CONFIG $CPP -Iinclude -dM include/config.h\ | $GREP -E "define[ \t]+CONFIG_[^ \t]*[ \t]+1$"\ | $SED -e "s/.*\(CONFIG_[^ \t]*\).*/\1=y/"\ | $SORT\ >> $CONFIG