blob: 1c0f60be1aebae34913b3492d4d8f62609485066 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001#
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
44mapfile_default_rule: all
45
46ifeq ($(PLATFORM), solaris)
47
48ifeq ($(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
62INIT += $(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
70endif # VARIANT
71
72ifndef LDNOMAP
73 LDMAPFLAGS_OPT = -M$(TEMPDIR)/mapfile-vers
74 LDMAPFLAGS_DBG = $(FILES_m:%=-M%)
75endif
76
77endif # PLATFORM
78
79
80ifeq ($(PLATFORM), linux)
81
82ifeq ($(VARIANT), OPT)
83 # OPT build MUST have a mapfile?
84 ifndef FILES_m
85 FILES_m = mapfile-vers
86 endif
87endif # VARIANT
88
89ifndef LDNOMAP
90 LDMAPFLAGS_OPT = $(FILES_m:%=-Xlinker -version-script=%)
91 LDMAPFLAGS_DBG = $(FILES_m:%=-Xlinker -version-script=%)
92endif
93
94endif # PLATFORM
95
96LDFLAGS_OPT += $(LDMAPFLAGS_OPT)
97LDFLAGS_DBG += $(LDMAPFLAGS_DBG)
98