Say I have a file that translate TARGET defines into FEATURE defines:
// File options.h
#ifdef TARGET_A
#define FEATURE_X
#endif
#ifdef TARGET_B
#define FEATURE_Y
#endif
struct foo {
int a;
int b;
};
And I have a bunch of files ifdef'ed with FEATURE defines:
// File foo.c
#include "options.h"
#ifdef FEATURE_X
int x;
#endif
#ifdef FEATURE_Y
int y;
#endif
Then, how can I pre-process foo.c such that it will process the include statement, but keep it in the file?
Something like:
$ some-pre-process-tool -DTARGET_A -I. -o foo.pp.c foo.c
$ cat foo.pp.c
// File foo.c
#include "options.h"
int x;
$