[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to prefix definitions in config.h
From: |
Clinton Roy |
Subject: |
Re: how to prefix definitions in config.h |
Date: |
18 Mar 2002 18:51:32 +1000 |
User-agent: |
Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.4 (Academic Rigor) |
> > my_config.h: config.h
> > sed 's/#define /#define MY_/; s/#undef /#undef MY_/' <config.h >$@
It would appear I can air my dirty code :)
We define some of our own defines, that are already prefixed, so we
have to take care of the case of double prefixing. We also wrap the
header in an `#ifndef PREFIX_CONFIG_H; #define PREFIX_CONFIG_H ;
#endif' so we don't have to worry about multiple inclusion.
Finally:
config.h: _config.h
echo "#ifndef PREFIX_CONFIG_H" > $(output)
echo "#define PREFIX_CONFIG_H" >> $(output)
sed -e 's/#define /#define PREFIX_/' \
-e 's/#undef /#undef PREFIX_/' \
-e 's/PREFIX_PREFIX_/PREFIX_/' < $(input) >> $(output)
echo "#endif /* PREFIX_CONFIG_H */" >> $(output)
Pretty icky, but it does get the job done.
--
Clinton Roy
Meetings - ``Try, or no try; there is no do.''
Re: how to prefix definitions in config.h, Akim Demaille, 2002/03/18