[cs631apue] Makefile in different platforms

lbustama lbustama at stevens.edu
Sun Dec 15 21:26:06 EST 2013


for OmniOS you have to tell the compiler/linker where to find the 
libmagic files:

this is what we used on our makefile:

-L /opt/local/lib/ -Wl,-rpath,/opt/local/lib/,-lmagic,-lsocket,-lnsl

-L tells the linker where to find the libraries, the -rpath is needed to 
load the files when running the executable.

regarding the bsd libraries, I don't think they're needed, just enclose 
the #include<bsd/...> statement like this

#ifndef sun

#include<bsd/...>

#endif

see here for OS specific pre-defined compiler macros 
http://sourceforge.net/p/predef/wiki/OperatingSystems/

Luis

On 12/15/2013 8:46 PM, Hongyi Shen wrote:
> And OmniOS lack of -lbsd and -lmagic is another problem
> 
> On Sun, Dec 15, 2013 at 4:45 PM, Hongyi Shen <hshen4 at stevens.edu>
> wrote:
> 
>> According to some material, my Makefile has something like this:
>> 
>> ROOT=.
>> PLATFORM=$(shell uname -s)
>> include $(ROOT)/Make.on.$(PLATFORM)
>> 
>> With extra files like Make.on.NetBSD, Make.on.SunOS, Make.on.Linux
>> ... containing different rules.
>> 
>> NetBSD and OmniOS seems doesn't recognize them and print out "Could
>> not find ./Make.on."
>> 
>> Any suggestions?
> 
> 
> _______________________________________________
> cs631apue mailing list
> cs631apue at lists.stevens.edu
> https://lists.stevens.edu/mailman/listinfo/cs631apue


More information about the cs631apue mailing list