-D name=definition
The contents of definition are tokenized and processed as if they
appeared during translation phase three in a #define directive. In
particular, the definition will be truncated by embedded newline
characters.
If you are invoking the preprocessor from a shell or shell-like
program you may need to use the shell’s quoting syntax to protect
characters such as spaces that have a meaning in the shell syntax.
If you wish to define a function-like macro on the command line,
write its argument list with surrounding parentheses before the
equals sign (if any). Parentheses are meaningful to most shells,
so you will need to quote the option. With sh and csh,
-D’name(args...)=definition’ works.
-D and -U options are processed in the order they are given on the
command line. All -imacros file and -include file options are pro?
cessed after all -D and -U options.
#if (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
#error Your compiler is too buggy; it is known to miscompile kernels.
#error Known good compilers: 3.3
#endif
위에 말씀하신 것이 #ifdef 말고 #if로 사용 가능한지 여부라면 사용 가능한 거 같습니다.
다만, 변수로는 안되고 미리 define된 매크로이거나 makefile에서 위엣분이 말씀하신 대로 -D 옵션으로 넣어준 값이어야만 적용되는거 같네요 ^^
음..
man g++에서
형식으로 Makefile안에서 쓰시면 되지 않을까 싶네요 :)
음 다시보니
다시보니 변수나 이전에 define된 스트링값을 말씀하신거였네요..^^;
#define, #if 등은 preprocessor에서 처리되기 때문에.. 아마도 안될듯 합니다.
무심코 읽다가 마침 생각이 나서;; ^^
요즘 커널을 보고 있는데요 이런 부분이 있던데..
위에 말씀하신 것이 #ifdef 말고 #if로 사용 가능한지 여부라면 사용 가능한 거 같습니다.
다만, 변수로는 안되고 미리 define된 매크로이거나 makefile에서 위엣분이 말씀하신 대로 -D 옵션으로 넣어준 값이어야만 적용되는거 같네요 ^^
#if 는...
preprocessor이기 때문에, 즉 컴파일에 진행되기 이전에 처리되는 내용이므로
compile time에 존재하는 변수들에 대해서는 불가능하구요.
대신에 같은 preprocessor상에 존재하는 define된 애들에 대해서는 가능합니다.
댓글 달기