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