> > 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.''

Reply via email to