make/common/Mapfile-vers.gmk

changeset 1
55540e827aef
child 158
91006f157c46
equal deleted inserted replaced
-1:000000000000 1:55540e827aef
1 #
2 # Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Sun designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Sun in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 # CA 95054 USA or visit www.sun.com if you need additional information or
23 # have any questions.
24 #
25
26 #
27 # Makefile for linking with mapfiles.
28 #
29 # NOTE: Not using a mapfile will expose all your extern functions and
30 # extern data symbols as part of your interface, so unless your
31 # extern names are safe from being mistaken as names from other
32 # libraries, you better use a mapfile, or use a unique naming
33 # convention on all your extern symbols.
34 #
35 # The mapfile will establish versioning by defining the exported interface.
36 #
37 # The mapfile can also force certain .o files or elf sections into the
38 # the different segments of the resulting library/program image.
39 #
40 # The macro FILES_m can contain any number of mapfiles.
41 #
42
43 # Always make sure 'all' is the default rule
44 mapfile_default_rule: all
45
46 ifeq ($(PLATFORM), solaris)
47
48 ifeq ($(VARIANT), OPT)
49 # OPT build MUST have a mapfile?
50 ifndef FILES_m
51 FILES_m = mapfile-vers
52 endif
53
54 # If we are re-ordering functions in this solaris library, we need to make
55 # sure that -xF is added to the compile lines. This option is critical and
56 # enables the functions to be reordered.
57 ifdef FILES_reorder
58 CFLAGS_OPT += -xF
59 CXXFLAGS_OPT += -xF
60 endif
61
62 INIT += $(TEMPDIR)/mapfile-vers
63
64 $(TEMPDIR)/mapfile-vers : $(FILES_m) $(FILES_reorder)
65 $(prep-target)
66 $(CAT) $(FILES_m) > $@
67 ifdef FILES_reorder
68 $(SED) -e 's=OUTPUTDIR=$(OUTPUTDIR)=' $(FILES_reorder) >> $@
69 endif
70 endif # VARIANT
71
72 ifndef LDNOMAP
73 LDMAPFLAGS_OPT = -M$(TEMPDIR)/mapfile-vers
74 LDMAPFLAGS_DBG = $(FILES_m:%=-M%)
75 endif
76
77 endif # PLATFORM
78
79
80 ifeq ($(PLATFORM), linux)
81
82 ifeq ($(VARIANT), OPT)
83 # OPT build MUST have a mapfile?
84 ifndef FILES_m
85 FILES_m = mapfile-vers
86 endif
87 endif # VARIANT
88
89 ifndef LDNOMAP
90 LDMAPFLAGS_OPT = $(FILES_m:%=-Xlinker -version-script=%)
91 LDMAPFLAGS_DBG = $(FILES_m:%=-Xlinker -version-script=%)
92 endif
93
94 endif # PLATFORM
95
96 LDFLAGS_OPT += $(LDMAPFLAGS_OPT)
97 LDFLAGS_DBG += $(LDMAPFLAGS_DBG)
98

mercurial