I have a simple program.
// test.c
#include <stdio.h>
int main()
{
#ifdef HELLO
printf("Hello ");
#endif
printf("World\n");
return 0;
}
I'd like to set up a makefile and either define HELLO or not in that Makefile and then either the program displays "World" or "Hello World" based on whether HELLO is defined. But I don't know where to define HELLO in the Makefile, whether to export it, and how to compile it using gcc. Makefile below.
all: run
test: test.c
gcc test.c -o test
run: test
./test
clean:
rm *~ *.o test