As the others say, you probably want to do it at run time,
not compile time.
But if you *do* want to do it at compile time, you could do
something like this:
/* File test.c */
#include <stdio.h>
/* Error value: */
#define HYSTERESIS -1
#ifdef EEPROM_0
#define HYSTERESIS 11
#endif
#ifdef EEPROM_1
#define HYSTERESIS 15
#endif
int main(void)
{
if (HYSTERESIS == -1)
puts("You need to #define either EEPROM_0 or
EEPROM_1");
else
printf("hysteresis=%i\n", HYSTERESIS);
return 0;
}
Then you'd compile using the -D option available on many
compilers:
cc -DEEPROM_0 test.c
or
cc DEEPROM_1 test.c
(This effectively inserts a #define line into the source.)
You could choose between these manually, or you could write
a script that reads the EEPROM and generates the appropriate
command then runs it. Or do this from within a makefile!
David