Print this page
lib: move compat links from targetdirs to proper makefiles
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/Makefile.lib
+++ new/usr/src/lib/Makefile.lib
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 18 #
19 19 # CDDL HEADER END
20 20 #
21 21 # Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
22 22 # Copyright 2015 Gary Mills
23 23 # Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
24 24 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25 25 # Copyright 2019, Joyent, Inc.
26 26 #
27 27 #
28 28 # Definitions common to libraries.
29 29 #
30 30 # include global definitions; SRC should be defined in the shell.
31 31 # SRC is needed until RFE 1026993 is implemented.
32 32
33 33 include $(SRC)/Makefile.master
34 34
35 35 LORDER= lorder
36 36 TSORT= tsort
37 37
38 38 #
39 39 # By default, we define the source directory for libraries to be
40 40 # one level up from the ISA-specific directory, where the code is
41 41 # actually built. Many libraries define a 'common' directory to
42 42 # contain the source. These libraries must redefine SRCDIR as:
43 43 # SRCDIR = ../common
44 44 # Other variations are possible (../port, ../src, etc).
45 45 #
46 46 SRCDIR = ..
47 47
48 48 #
49 49 # We define MAPFILES here for the benefit of most libraries, those that
50 50 # follow the convention of having source files and other common files
51 51 # in the $(SRCDIR) directory. Libraries that do not follow this
52 52 # convention must define MAPFILES, or MAPFILEDIR for themselves.
53 53 # Libraries that do follow this convention but that need supplemental
54 54 # ISA-specific mapfiles can augment MAPFILES like this:
55 55 # MAPFILES += mapfile-vers
56 56 #
57 57 MAPFILEDIR = $(SRCDIR)
58 58 MAPFILES = $(MAPFILEDIR)/mapfile-vers
59 59
60 60 #
61 61 # If HDRDIR is left unset, then it's possible for the $(ROOTHDRDIR)/%
62 62 # install rule in lib/Makefile.targ to generate false matches if there
63 63 # are any common directory names between / and /usr/include (`xfn' is
64 64 # one common example). To prevent this, we set HDRDIR to a directory
65 65 # name that will almost surely not exist on the build machine.
66 66 #
67 67 HDRDIR= /__nonexistent_directory__
68 68
69 69 #
70 70 # We don't build archive (*.a) libraries by default anymore.
71 71 # If a component of the build needs to build an archive library
72 72 # for its own internal purposes, it can define LIBS for itself
73 73 # after including Makefile.lib, like this:
74 74 # LIBS = $(LIBRARY)
75 75 # or:
76 76 # LIBS = $(LIBRARYCCC)
77 77 # Archive libraries must not be installed in the proto area.
78 78 #
79 79 LIBS=
80 80 MACHLIBS= $(LIBS:%=$(MACH)/%)
81 81 MACHLIBS64= $(LIBS:%=$(MACH64)/%)
82 82 DYNLIB= $(LIBRARY:.a=.so$(VERS))
83 83 DYNLIBPSR= $(LIBRARY:.a=_psr.so$(VERS))
84 84 DYNLIBCCC= $(LIBRARYCCC:.a=.so$(VERS))
85 85 LIBLINKS= $(LIBRARY:.a=.so)
86 86 LIBLINKSCCC= $(LIBRARYCCC:.a=.so)
87 87 LIBNAME= $(LIBRARY:lib%.a=%)
88 88 LIBLINKPATH=
89 89 LIBNULL= null.a
90 90 ROOTHDRDIR= $(ROOT)/usr/include
91 91 ROOTLIBDIR= $(ROOT)/usr/lib
92 92 ROOTLIBDIR64= $(ROOT)/usr/lib/$(MACH64)
93 93 ROOTFS_LIBDIR= $(ROOT)/lib
94 94 ROOTFS_LIBDIR64= $(ROOT)/lib/$(MACH64)
95 95 ROOTHDRS= $(HDRS:%=$(ROOTHDRDIR)/%)
96 96 HDRSRCS= $(HDRS:%=$(HDRDIR)/%)
97 97 CHECKHDRS= $(HDRSRCS:%.h=%.check)
98 98 ROOTLIBS= $(LIBS:%=$(ROOTLIBDIR)/%)
99 99 ROOTLIBS64= $(LIBS:%=$(ROOTLIBDIR64)/%)
100 100 ROOTFS_LIBS= $(DYNLIB:%=$(ROOTFS_LIBDIR)/%)
101 101 ROOTFS_LIBS64= $(DYNLIB:%=$(ROOTFS_LIBDIR64)/%)
102 102 ROOTLINKS= $(ROOTLIBDIR)/$(LIBLINKS)
103 103 ROOTLINKS64= $(ROOTLIBDIR64)/$(LIBLINKS)
104 104 ROOTFS_LINKS= $(ROOTFS_LIBDIR)/$(LIBLINKS)
105 105 ROOTFS_LINKS64= $(ROOTFS_LIBDIR64)/$(LIBLINKS)
106 106 ROOTLINKSCCC= $(ROOTLIBDIR)/$(LIBLINKSCCC)
107 107 ROOTLINKSCCC64= $(ROOTLIBDIR64)/$(LIBLINKSCCC)
108 108 ROOTFS_LINKSCCC= $(ROOTFS_LIBDIR)/$(LIBLINKSCCC)
109 109 ROOTFS_LINKSCCC64= $(ROOTFS_LIBDIR64)/$(LIBLINKSCCC)
110 110
111 111 # Demo rules
112 112 DEMOFILES=
113 113 DEMOFILESRCDIR= common
114 114 ROOTDEMODIRBASE= __nonexistent_directory__
115 115 ROOTDEMODIRS=
116 116 ROOTDEMOFILES= $(DEMOFILES:%=$(ROOTDEMODIRBASE)/%)
117 117 $(ROOTDEMODIRS) := DIRMODE = 755
118 118
119 119 ARFLAGS= r
120 120 SONAME= $(DYNLIB)
121 121 # For most libraries, we should be able to resolve all symbols at link time,
122 122 # either within the library or as dependencies, all text should be pure, and
123 123 # combining relocations into one relocation table reduces startup costs.
124 124 # All options are tunable to allow overload/omission from lower makefiles.
125 125
126 126
127 127 HSONAME= -h$(SONAME)
128 128 DYNFLAGS= $(HSONAME) $(ZTEXT) $(ZDEFS) $(BDIRECT) \
129 129 $(MAPFILES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%)
130 130
131 131 LDLIBS= $(LDLIBS.lib)
132 132
133 133 OBJS= $(OBJECTS:%=objs/%)
134 134 PICS= $(OBJECTS:%=pics/%)
135 135
136 136 # Declare that all library .o's can all be made in parallel.
137 137 # The DUMMY target is for those instances where OBJS and PICS
138 138 # are empty (to avoid an unconditional .PARALLEL declaration).
139 139 .PARALLEL: $(OBJS) $(PICS) DUMMY
140 140
141 141 # default value for "portable" source
142 142 SRCS= $(OBJECTS:%.o=$(SRCDIR)/%.c)
143 143
144 144 # default build of an archive and a shared object,
145 145 # overridden locally when extra processing is needed
146 146 BUILD.AR= $(AR) $(ARFLAGS) $@ $(AROBJS)
147 147 BUILD.SO= $(CC) $(CFLAGS) -o $@ $(GSHARED) $(DYNFLAGS) \
148 148 $(PICS) $(EXTPICS) $(LDLIBS)
149 149 BUILDCCC.SO= $(CCC) $(CCFLAGS) -o $@ $(GSHARED) $(DYNFLAGS) \
150 150 $(PICS) $(EXTPICS) $(LDLIBS)
151 151
152 152 # default dynamic library symlink
153 153 INS.liblink= -$(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKS)$(VERS) $@
154 154 INS.liblinkccc= -$(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKSCCC)$(VERS) $@
155 155
156 156 # default 64-bit dynamic library symlink
157 157 INS.liblink64= -$(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKS)$(VERS) $@
158 158 INS.liblinkccc64= -$(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKSCCC)$(VERS) $@
159 159
160 160 #
161 161 # If appropriate, augment POST_PROCESS_O and POST_PROCESS_SO to do CTF
162 162 # processing. We'd like to just conditionally append to POST_PROCESS_O and
163 163 # POST_PROCESS_SO, but ParallelMake has a bug which causes the same value to
164 164 # sometimes get appended more than once, which will cause ctfconvert to fail.
165 165 # So, instead we introduce CTFCONVERT_POST and CTFMERGE_POST, which are always
166 166 # appended to POST_PROCESS_O and POST_PROCESS_SO but are no-ops unless CTF
167 167 # processing should be done.
168 168 #
169 169 CTFCONVERT_POST = :
170 170 CTFMERGE_POST = :
171 171 POST_PROCESS_O += ; $(CTFCONVERT_POST)
172 172 POST_PROCESS_SO += ; $(CTFMERGE_POST)
173 173
174 174 CTFMERGE_LIB = $(CTFMERGE) $(CTFMRGFLAGS) -t -f -L VERSION -o $@ $(PICS)
175 175
176 176 # conditional assignments
177 177
178 178 $(OBJS) := sparc_CFLAGS += -xregs=no%appl
179 179
180 180 $(PICS) := sparc_CFLAGS += -xregs=no%appl $(sparc_C_PICFLAGS)
181 181 $(PICS) := sparcv9_CFLAGS += -xregs=no%appl $(sparcv9_C_PICFLAGS)
182 182 $(PICS) := i386_CFLAGS += $(i386_C_PICFLAGS)
183 183 $(PICS) := amd64_CFLAGS += $(amd64_C_PICFLAGS)
184 184 $(PICS) := CCFLAGS += $(CC_PICFLAGS)
185 185 $(PICS) := CPPFLAGS += -DPIC -D_REENTRANT
186 186 $(PICS) := sparcv9_CCFLAGS += -xregs=no%appl $(sparcv9_CC_PICFLAGS)
187 187 $(PICS) := amd64_CCFLAGS += $(amd64_CC_PICFLAGS)
188 188 $(PICS) := CFLAGS += $(CTF_FLAGS)
189 189 $(PICS) := CFLAGS64 += $(CTF_FLAGS)
190 190 $(PICS) := CTFCONVERT_POST = $(CTFCONVERT_O)
191 191 $(DYNLIB) := CTFMERGE_POST = $(CTFMERGE_LIB)
192 192
193 193 $(LIBRARY):= AROBJS = $(OBJS)
194 194 $(LIBRARY):= DIR = objs
195 195 $(DYNLIB):= DIR = pics
196 196 $(DYNLIBCCC):= DIR = pics
197 197
198 198 SONAMECCC= $(DYNLIBCCC)
199 199 HSONAMECCC= -h $(SONAMECCC)
200 200 #
201 201 # Keep in sync with the standard DYNFLAGS
202 202 #
203 203 $(DYNLIBCCC):= DYNFLAGS = $(HSONAMECCC) $(ZTEXT) $(ZDEFS) \
204 204 $(MAPFILES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%) \
205 205 $(BDIRECT) $(NORUNPATH)
206 206
207 207
208 208 # build rule for "portable" source
209 209 objs/%.o pics/%.o: %.c
210 210 $(COMPILE.c) -o $@ $<
211 211 $(POST_PROCESS_O)
212 212
213 213 objs/%.o pics/%.o: %.cc
214 214 $(COMPILE.cc) -o $@ $<
215 215 $(POST_PROCESS_CC_O)
216 216
217 217 .PRECIOUS: $(LIBS)
218 218
219 219 # Define the majority text domain in this directory.
220 220 TEXT_DOMAIN= SUNW_OST_OSLIB
221 221
222 222 #
223 223 # Target Architecture
224 224 #
225 225 TARGETMACH= $(MACH)
226 226
227 227 #
228 228 # Allow people to define their own clobber rules. Normal makefiles
229 229 # shouldn't override this - they should override $(CLOBBERFILES) instead.
230 230 #
231 231 CLOBBERTARGFILES= $(LIBS) $(DYNLIB) $(CLOBBERFILES)
↓ open down ↓ |
231 lines elided |
↑ open up ↑ |
232 232
233 233 #
234 234 # Define the default ctfdiff invocation used to check a list of types
235 235 # supplied by a user of a library. The goal is to validate that a given
236 236 # series of types is the same in both a 32-bit and 64-bit artifact. This
237 237 # is only defined if we have a 64-bit build to do.
238 238 #
239 239 TYPECHECK_LIB32 = $(TYPECHECK_LIB:%=$(MACH)/%)
240 240 TYPECHECK_LIB64 = $(TYPECHECK_LIB:%=$(MACH64)/%)
241 241 TYPECHECK_LIST= $(TYPELIST:%=-T %)
242 -$(BUILD64)TYPECHECK.lib = $(CTFDIFF) -t -I $(TYPECHECK_LIST) $(TYPECHECK_LIB32) $(TYPECHECK_LIB64)
242 +$(BUILD64)TYPECHECK.lib = $(CTFDIFF) -t -I $(TYPECHECK_LIST) \
243 + $(TYPECHECK_LIB32) $(TYPECHECK_LIB64)
243 244 TYPECHECK = $(TYPECHECK_LIB:%=%.typecheck)
245 +
246 +# Links we need to create for compatibility
247 +COMPATLINKS=
248 +COMPATLINKS64=
249 +ROOTCOMPATLINKS=$(COMPATLINKS:%=$(ROOT)/%)
250 +ROOTCOMPATLINKS64=$(COMPATLINKS64:%=$(ROOT)/%)
251 +
252 +# So if someone doesn't set the target-specific variable they get a clue
253 +COMPATLINKTARGET= /__you_didnt_use_COMPATLINKS_properly__
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX