1# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ 2# All rights reserved 3 4# @synopsis: 5# 6# The 'cc-shared' module provides support for shared libraries and shared objects. 7# It defines the following variables: 8# 9## SH_CFLAGS Flags to use compiling sources destined for a shared library 10## SH_LDFLAGS Flags to use linking a shared library 11## SHOBJ_CFLAGS Flags to use compiling sources destined for a shared object 12## SHOBJ_LDFLAGS Flags to use linking a shared object 13## SH_LINKFLAGS Flags to use linking an executable which will load shared objects 14## LD_LIBRARY_PATH Environment variable which specifies path to shared libraries 15 16module-options {} 17 18foreach i {SH_LINKFLAGS SH_CFLAGS SH_LDFLAGS SHOBJ_CFLAGS SHOBJ_LDFLAGS} { 19 define $i "" 20} 21 22define LD_LIBRARY_PATH LD_LIBRARY_PATH 23 24switch -glob -- [get-define host] { 25 *-*-darwin* { 26 define SH_CFLAGS -dynamic 27 define SH_LDFLAGS "-dynamiclib" 28 define SHOBJ_CFLAGS "-dynamic -fno-common" 29 define SHOBJ_LDFLAGS "-bundle -undefined dynamic_lookup" 30 define LD_LIBRARY_PATH DYLD_LIBRARY_PATH 31 } 32 *-*-ming* { 33 define SH_LDFLAGS -shared 34 define SHOBJ_LDFLAGS -shared 35 } 36 *-*-cygwin { 37 define SH_LDFLAGS -shared 38 define SHOBJ_LDFLAGS -shared 39 } 40 *-*-solaris* { 41 # XXX: These haven't been fully tested. 42 #define SH_LINKFLAGS -Wl,-export-dynamic 43 define SH_CFLAGS -Kpic 44 define SHOBJ_CFLAGS -Kpic 45 define SHOBJ_LDFLAGS "-G" 46 } 47 *-*-hpux { 48 # XXX: These haven't been tested 49 define SH_LINKFLAGS -Wl,+s 50 define SH_CFLAGS +z 51 define SHOBJ_CFLAGS "+O3 +z" 52 define SHOBJ_LDFLAGS -b 53 define LD_LIBRARY_PATH SHLIB_PATH 54 } 55 * { 56 # Generic Unix settings 57 define SH_LINKFLAGS -rdynamic 58 define SH_CFLAGS -fpic 59 define SH_LDFLAGS -shared 60 define SHOBJ_CFLAGS -fpic 61 define SHOBJ_LDFLAGS "-shared" 62 } 63} 64