Skip to content

Instantly share code, notes, and snippets.

@uhziel
Created December 13, 2012 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uhziel/4277550 to your computer and use it in GitHub Desktop.
Save uhziel/4277550 to your computer and use it in GitHub Desktop.
test c macro
#include <stdio.h>
int main() {
#ifdef FOO
printf("hello\n");
#endif
#ifndef BAR
printf("world\n");
#endif
return 0;
}
all:
gcc -g -o DFOO_UBAR0 main.c -DFOO
gcc -g -o DFOO_UBAR1 main.c -DFOO=1
gcc -g -o DFOO_UBAR2 main.c -DFOO=0
gcc -g -o DFOO_DBAR main.c -DFOO -DBAR
gcc -g -o UFOO_DBAR main.c -DBAR
gcc -g -o UFOO_UBAR1 main.c
gcc -g -o UFOO_UBAR2 main.c -DFOO=1 -UFOO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment