2007-07-18 17:21:52 +04:00
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
# Part of Equinox Desktop Environment (EDE).
|
|
|
|
# Copyright (c) 2000-2007 EDE Authors.
|
|
|
|
#
|
|
|
|
# This program is licensed under terms of the
|
|
|
|
# GNU General Public License version 2 or newer.
|
|
|
|
# See COPYING for details.
|
|
|
|
|
|
|
|
SUFSHAREDLIB = ".so" ;
|
|
|
|
|
2007-07-20 19:48:49 +04:00
|
|
|
# StaticLibrary [lib-name] : [source-files] ;
|
2007-07-18 17:21:52 +04:00
|
|
|
rule StaticLibrary
|
|
|
|
{
|
|
|
|
Library $(<) : $(>) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule SharedLibraryFromObjects
|
|
|
|
{
|
|
|
|
if ! $(UNIX) {
|
|
|
|
Echo "Dynamic libraries can't be built on this OS now" ;
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local s t t_only ;
|
|
|
|
|
|
|
|
t = $(1) ;
|
|
|
|
s = [ FGristFiles $(2) ] ;
|
|
|
|
|
2007-07-20 19:48:49 +04:00
|
|
|
# Rip directory and grist parts from target because this will
|
2007-07-18 17:21:52 +04:00
|
|
|
# be passed to compiler as soname
|
2007-07-20 19:48:49 +04:00
|
|
|
t_only = $(t:D=:G=) ;
|
2007-07-18 17:21:52 +04:00
|
|
|
|
|
|
|
# if given suffix, skip it; otherwise add SUFSHAREDLIB
|
|
|
|
if ! $(t:S) {
|
|
|
|
t = $(t:S=$(SUFSHAREDLIB)) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
Depends lib : $(t) ;
|
|
|
|
|
|
|
|
# This is used if library already does not have a path
|
|
|
|
if ! $(t:D) {
|
|
|
|
MakeLocate $(t) $(t)($(s:BS)) : $(LOCATE_TARGET) ;
|
|
|
|
}
|
|
|
|
|
2007-07-20 19:48:49 +04:00
|
|
|
LINKLIBS on $(t) = -shared -Wl,-soname,\"$(t_only)\" [ on $(t) return $(LINKLIBS) ] ;
|
2007-07-18 17:21:52 +04:00
|
|
|
|
|
|
|
# Let target is dependant on source
|
|
|
|
Depends $(t) : $(s) ;
|
|
|
|
|
|
|
|
Link $(t) : $(s) ;
|
|
|
|
Clean clean : $(t) ;
|
|
|
|
}
|
|
|
|
|
2007-07-20 19:48:49 +04:00
|
|
|
# SharedLibrary [libname] : [sources] ;
|
|
|
|
# Creates shared library [libname] from [sources].
|
2007-07-18 17:21:52 +04:00
|
|
|
#
|
|
|
|
# Note: ftjam in later versions provide rule with the same name, althought it calls
|
|
|
|
# libtool in the background. The way jam works, selecting latest redefined rules, ftjam's
|
|
|
|
# will be overriden with this.
|
|
|
|
rule SharedLibrary
|
|
|
|
{
|
|
|
|
local shlib = $(1) ;
|
|
|
|
local src = $(2) ;
|
2007-07-20 19:48:49 +04:00
|
|
|
local objects = [ FGristFiles $(src:S=$(SUFOBJ)) ] ;
|
|
|
|
|
|
|
|
CCFLAGS on $(objects) += -fPIC ;
|
|
|
|
C++FLAGS on $(objects) += -fPIC ;
|
2007-07-18 17:21:52 +04:00
|
|
|
|
2007-07-20 19:48:49 +04:00
|
|
|
SharedLibraryFromObjects $(shlib) : $(objects) ;
|
2007-07-18 17:21:52 +04:00
|
|
|
Objects $(src) ;
|
|
|
|
}
|
|
|
|
|
2007-07-20 19:48:49 +04:00
|
|
|
# SharedLibraryVersioned [libname] : [sources] : [opt-version] : ["nolink"] ;
|
2007-07-18 17:21:52 +04:00
|
|
|
# Creates versioned shared library (foo.so.[version]) which is often library naming
|
|
|
|
# on unix platforms. If [opt-version] is not given, it is like calling SharedLibrary only.
|
|
|
|
# By default it will create, besides [libname], ".so" symlink to it too. If "nolink" is given
|
2007-07-20 19:48:49 +04:00
|
|
|
# as 4 parameter, it will skip symlink creation.
|
2007-07-18 17:21:52 +04:00
|
|
|
rule SharedLibraryVersioned
|
|
|
|
{
|
2007-07-20 19:48:49 +04:00
|
|
|
if $(3) {
|
2007-07-18 17:21:52 +04:00
|
|
|
local target target_dir symlink versioned ;
|
|
|
|
|
|
|
|
# Set .so.version extension
|
2007-07-20 19:48:49 +04:00
|
|
|
versioned = "$(SUFSHAREDLIB).$(3)" ;
|
2007-07-18 17:21:52 +04:00
|
|
|
|
|
|
|
# Jam is not smart about ripping suffixes so cases 'foo.so.2.0'
|
|
|
|
# will produce 'foo.so.2'. We must hope that provided [libname] does _not_
|
|
|
|
# have full name or everything will be screwed up (no facility in jam to check this).
|
|
|
|
# With good hopes, we set first full target name and it's link abbreviation.
|
|
|
|
target = $(1:S=$(versioned)) ;
|
|
|
|
symlink = $(1:S=$(SUFSHAREDLIB)) ;
|
2007-07-20 19:48:49 +04:00
|
|
|
SharedLibrary $(target) : $(2) ;
|
2007-07-18 17:21:52 +04:00
|
|
|
|
|
|
|
# Create symlink
|
2007-07-20 19:48:49 +04:00
|
|
|
if $(4) != "nolink" {
|
2007-07-18 17:21:52 +04:00
|
|
|
# copy target directory or symlink will be created
|
|
|
|
# from place where jam is called
|
|
|
|
LOCATE on $(symlink) = [ on $(target) return $(LOCATE) ] ;
|
|
|
|
|
|
|
|
Depends lib : $(symlink) ;
|
|
|
|
|
|
|
|
SymLink $(symlink) : $(target) ;
|
|
|
|
Clean clean : $(symlink) ;
|
|
|
|
}
|
|
|
|
} else {
|
2007-07-20 19:48:49 +04:00
|
|
|
SharedLibrary $(1) : $(2) ;
|
2007-07-18 17:21:52 +04:00
|
|
|
}
|
|
|
|
}
|