I am compiling C programs using gcc on Solaris.  Solaris need some special 
compilation flags to ensure POSIX conformance.  For example, if one needs to 
call sigwait() with the POSIX syntax (and semantics too?), one needs to add a 
-D_POSIX_PTHREAD_SEMANTICS flag to the compilation command, according to 
sigwait()'s man page.  In other cases, one may need to add -D_POSIX_C_SOURCE 
for multithreaded programs.
Based on my experience, Solaris does not seem to be very robust and the 
definition of these flags may produce a compilation error when included in 
compiling files that do not need these flags.
So, how to write a Makefile that can accomodate the inclusion of certain flags 
when compiling certain files?
Of course, one can always set up separate rules for these special files, and a 
general rule (without those flags) for the rest.  But that looks clumsy:
SRCS    =       file1.c file2.c file3.c .....
OBJ     =       ${SRCS:.c=.o}
$(OBJ): %.o: %.c        $(CC) -c $< -o $@
special1.o: special1.c
        $(CC) -D_POSIX_PTHREAD_SEMANTICS -c $< -o [EMAIL PROTECTED]: special2.c
        $(CC) -D_POSIX_C_SOURCE -c $< -o $@
...
_________________________________________________________________
Making the world a better place one message at a time.
http://www.imtalkathon.com/?source=EML_WLH_Talkathon_BetterPlace
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to