1 # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
6 # The 'cc-shared' module provides support for shared libraries and shared objects.
7 # It defines the following variables:
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
18 foreach i
{SH_LINKFLAGS SH_CFLAGS SH_LDFLAGS SHOBJ_CFLAGS SHOBJ_LDFLAGS
} {
22 define LD_LIBRARY_PATH LD_LIBRARY_PATH
24 switch -glob -- [get-define host
] {
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
33 define SH_LDFLAGS
-shared
34 define SHOBJ_LDFLAGS
-shared
37 define SH_LDFLAGS
-shared
38 define SHOBJ_LDFLAGS
-shared
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"
48 # XXX: These haven't been tested
49 define SH_LINKFLAGS
-Wl,+s
51 define SHOBJ_CFLAGS
"+O3 +z"
52 define SHOBJ_LDFLAGS
-b
53 define LD_LIBRARY_PATH SHLIB_PATH
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"