[BusyBox] config.h/bb_config.h translation broken
Paul Fox
pgf at brightstareng.com
Mon Aug 1 15:34:16 UTC 2005
my busybox build is broken by commit r10944, for
ENABLE_FEATURE_XXX support.
the problem is the sed, running in this Makefile target:
include/bb_config.h: include/config.h
echo "#ifndef AUTOCONF_INCLUDED" > $@
sed -e 's/#undef CONFIG_\(.*\)/#define ENABLE_\1 0/' \
-e 's/#define CONFIG_\(.*\)/#define CONFIG_\1\n#define ENABLE_\1/' \
< $< >> $@
echo "#endif" >> $@
sed on my development machine (GNU sed version 3.02 -- old, okay)
expands the "\n" in the replacement half of the second line to
the character 'n', rather than to a newline, and i get this kind
of thing:
#define CONFIG_FEATURE_ROTATE_LOGFILE 1n#define ENABLE_FEATURE_ROTATE_LOGFILE 1
rather than
#define CONFIG_FEATURE_ROTATE_LOGFILE 1
#define ENABLE_FEATURE_ROTATE_LOGFILE 1
i think inserting newlines with sed can be hard to do
portably, this two-pass approach works:
include/bb_config.h: include/config.h
echo "#ifndef AUTOCONF_INCLUDED" > $@
sed -e 's/#undef CONFIG_\(.*\)/#define ENABLE_\1 0/' < $< >> $@
sed -n -e 's/#define CONFIG_/#define ENABLE_/p' < $< >> $@
echo "#endif" >> $@
but all of the "ENABLE_XXX 1" lines end up at the bottom of the file.
i won't commit this -- someone probably has a better idea.
paul
=---------------------
paul fox, pgf at brightstareng.com
More information about the busybox
mailing list