Print this page
3735 should include an empty make variable in the default CFLAGS/CCFLAGS
3844 the build should make source-level debugging easier
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
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 (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
22 22 #
23 23 #
24 24 # Definitions common to libraries.
25 25 #
26 26 # include global definitions; SRC should be defined in the shell.
27 27 # SRC is needed until RFE 1026993 is implemented.
28 28
29 29 include $(SRC)/Makefile.master
30 30
31 31 LORDER= lorder
32 32 TSORT= tsort
33 33 AWK= awk
34 34
35 35 #
36 36 # By default, we define the source directory for libraries to be
37 37 # one level up from the ISA-specific directory, where the code is
38 38 # actually built. Many libraries define a 'common' directory to
39 39 # contain the source. These libraries must redefine SRCDIR as:
40 40 # SRCDIR = ../common
41 41 # Other variations are possible (../port, ../src, etc).
42 42 #
43 43 SRCDIR = ..
44 44
45 45 #
46 46 # We define MAPFILES here for the benefit of most libraries, those that
47 47 # follow the convention of having source files and other common files
48 48 # in the $(SRCDIR) directory. Libraries that do not follow this
49 49 # convention must define MAPFILES, or MAPFILEDIR for themselves.
50 50 # Libraries that do follow this convention but that need supplemental
51 51 # ISA-specific mapfiles can augment MAPFILES like this:
52 52 # MAPFILES += mapfile-vers
53 53 #
54 54 MAPFILEDIR = $(SRCDIR)
55 55 MAPFILES = $(MAPFILEDIR)/mapfile-vers
56 56
57 57 #
58 58 # If HDRDIR is left unset, then it's possible for the $(ROOTHDRDIR)/%
59 59 # install rule in lib/Makefile.targ to generate false matches if there
60 60 # are any common directory names between / and /usr/include (`xfn' is
61 61 # one common example). To prevent this, we set HDRDIR to a directory
62 62 # name that will almost surely not exist on the build machine.
63 63 #
64 64 HDRDIR= /__nonexistent_directory__
65 65
66 66 #
67 67 # We don't build archive (*.a) libraries by default anymore.
68 68 # If a component of the build needs to build an archive library
69 69 # for its own internal purposes, it can define LIBS for itself
70 70 # after including Makefile.lib, like this:
71 71 # LIBS = $(LIBRARY)
72 72 # or:
73 73 # LIBS = $(LIBRARYCCC)
74 74 # Archive libraries must not be installed in the proto area.
75 75 #
76 76 LIBS=
77 77 MACHLIBS= $(LIBS:%=$(MACH)/%)
78 78 MACHLIBS64= $(LIBS:%=$(MACH64)/%)
79 79 DYNLIB= $(LIBRARY:.a=.so$(VERS))
80 80 DYNLIBPSR= $(LIBRARY:.a=_psr.so$(VERS))
81 81 DYNLIBCCC= $(LIBRARYCCC:.a=.so$(VERS))
82 82 LIBLINKS= $(LIBRARY:.a=.so)
83 83 LIBLINKSCCC= $(LIBRARYCCC:.a=.so)
84 84 LIBNAME= $(LIBRARY:lib%.a=%)
85 85 LIBLINKPATH=
86 86 LIBNULL= null.a
87 87 ROOTHDRDIR= $(ROOT)/usr/include
88 88 ROOTLIBDIR= $(ROOT)/usr/lib
89 89 ROOTLIBDIR64= $(ROOT)/usr/lib/$(MACH64)
90 90 ROOTFS_LIBDIR= $(ROOT)/lib
91 91 ROOTFS_LIBDIR64= $(ROOT)/lib/$(MACH64)
92 92 ROOTLINTDIR= $(ROOTLIBDIR)
93 93 ROOTFS_LINTDIR= $(ROOTFS_LIBDIR)
94 94 ROOTFS_LINTDIR64= $(ROOTFS_LIBDIR64)
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 ROOTLINT= $(LINTSRC:%=$(ROOTLINTDIR)/%)
111 111 ROOTFS_LINT= $(LINTSRC:%=$(ROOTFS_LINTDIR)/%)
112 112 ROOTFS_LINT64= $(LINTSRC:%=$(ROOTFS_LINTDIR64)/%)
113 113 ROOTMAN3= $(ROOT)/usr/share/man/man3
114 114 ROOTMAN3FILES= $(MAN3FILES:%=$(ROOTMAN3)/%)
115 115 $(ROOTMAN3FILES) := FILEMODE= 444
116 116
117 117 # Demo rules
118 118 DEMOFILES=
119 119 DEMOFILESRCDIR= common
120 120 ROOTDEMODIRBASE= __nonexistent_directory__
121 121 ROOTDEMODIRS=
122 122 ROOTDEMOFILES= $(DEMOFILES:%=$(ROOTDEMODIRBASE)/%)
123 123 $(ROOTDEMODIRS) := DIRMODE = 755
124 124
125 125 LINTLIB= llib-l$(LIBNAME).ln
126 126 LINTFLAGS= -uaxm
127 127 LINTFLAGS64= -uaxm -m64
128 128 LINTSRC= $(LINTLIB:%.ln=%)
129 129 LINTOUT= lint.out
130 130 ARFLAGS= r
131 131 SONAME= $(DYNLIB)
132 132 # For most libraries, we should be able to resolve all symbols at link time,
133 133 # either within the library or as dependencies, all text should be pure, and
134 134 # combining relocations into one relocation table reduces startup costs.
135 135 # All options are tunable to allow overload/omission from lower makefiles.
136 136
137 137
138 138 HSONAME= -h$(SONAME)
139 139 DYNFLAGS= $(HSONAME) $(ZTEXT) $(ZDEFS) $(BDIRECT) \
140 140 $(MAPFILES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%)
141 141
142 142 LDLIBS= $(LDLIBS.lib)
143 143
144 144 OBJS= $(OBJECTS:%=objs/%)
145 145 PICS= $(OBJECTS:%=pics/%)
146 146
147 147 # Declare that all library .o's can all be made in parallel.
148 148 # The DUMMY target is for those instances where OBJS and PICS
149 149 # are empty (to avoid an unconditional .PARALLEL declaration).
150 150 .PARALLEL: $(OBJS) $(PICS) DUMMY
151 151
152 152 # default value for "portable" source
153 153 SRCS= $(OBJECTS:%.o=$(SRCDIR)/%.c)
154 154
155 155 # default build of an archive and a shared object,
156 156 # overridden locally when extra processing is needed
157 157 BUILD.AR= $(AR) $(ARFLAGS) $@ $(AROBJS)
158 158 BUILD.SO= $(CC) -o $@ $(GSHARED) $(DYNFLAGS) $(PICS) $(EXTPICS) $(LDLIBS)
159 159 BUILDCCC.SO= $(CCC) -o $@ $(GSHARED) $(DYNFLAGS) $(PICS) $(EXTPICS) $(LDLIBS)
160 160
161 161 # default dynamic library symlink
162 162 # IMPORTANT:: If you change INS.liblink OR INS.liblink64 here, then you
163 163 # MUST also change the corresponding override definitions in
164 164 # $CLOSED/Makefile.tonic.
165 165 #
166 166 # If you do not do this, then the closedbins build for the OpenSolaris
167 167 # community will break. PS, the gatekeepers will be upset too.
168 168 #
169 169 INS.liblink= -$(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKS)$(VERS) $@
170 170 INS.liblinkccc= -$(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKSCCC)$(VERS) $@
171 171
172 172 # default 64-bit dynamic library symlink
173 173 INS.liblink64= -$(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKS)$(VERS) $@
174 174 INS.liblinkccc64= -$(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKSCCC)$(VERS) $@
175 175
176 176 #
177 177 # If appropriate, augment POST_PROCESS_O and POST_PROCESS_SO to do CTF
178 178 # processing. We'd like to just conditionally append to POST_PROCESS_O and
179 179 # POST_PROCESS_SO, but ParallelMake has a bug which causes the same value to
↓ open down ↓ |
179 lines elided |
↑ open up ↑ |
180 180 # sometimes get appended more than once, which will cause ctfconvert to fail.
181 181 # So, instead we introduce CTFCONVERT_POST and CTFMERGE_POST, which are always
182 182 # appended to POST_PROCESS_O and POST_PROCESS_SO but are no-ops unless CTF
183 183 # processing should be done.
184 184 #
185 185 CTFCONVERT_POST = :
186 186 CTFMERGE_POST = :
187 187 POST_PROCESS_O += ; $(CTFCONVERT_POST)
188 188 POST_PROCESS_SO += ; $(CTFMERGE_POST)
189 189
190 -CTFMERGE_LIB = $(CTFMERGE) -t -f -L VERSION -o $@ $(PICS)
190 +CTFMERGE_LIB = $(CTFMERGE) $(CTFMRGFLAGS) -t -f -L VERSION -o $@ $(PICS)
191 191
192 192 # conditional assignments
193 193
194 194 $(OBJS) := sparc_CFLAGS += -xregs=no%appl
195 195
196 196 $(PICS) := sparc_CFLAGS += -xregs=no%appl $(sparc_C_PICFLAGS)
197 197 $(PICS) := sparcv9_CFLAGS += -xregs=no%appl $(sparcv9_C_PICFLAGS)
198 198 $(PICS) := i386_CFLAGS += $(i386_C_PICFLAGS)
199 199 $(PICS) := amd64_CFLAGS += $(amd64_C_PICFLAGS)
200 200 $(PICS) := CCFLAGS += $(CC_PICFLAGS)
201 201 $(PICS) := CPPFLAGS += -DPIC -D_REENTRANT
202 202 $(PICS) := sparcv9_CCFLAGS += -xregs=no%appl $(sparcv9_CC_PICFLAGS)
203 203 $(PICS) := amd64_CCFLAGS += $(amd64_CC_PICFLAGS)
204 204 $(PICS) := CFLAGS += $(CTF_FLAGS)
205 205 $(PICS) := CFLAGS64 += $(CTF_FLAGS)
206 206 $(PICS) := CTFCONVERT_POST = $(CTFCONVERT_O)
207 207 $(DYNLIB) := CTFMERGE_POST = $(CTFMERGE_LIB)
208 208
209 209 $(LINTLIB):= LOG = -DLOGGING
210 210 $(LIBRARY):= AROBJS = $(OBJS)
211 211 $(LIBRARY):= DIR = objs
212 212 $(DYNLIB):= DIR = pics
213 213 $(DYNLIBCCC):= DIR = pics
214 214
215 215 SONAMECCC= $(DYNLIBCCC)
216 216 HSONAMECCC= -h $(SONAMECCC)
217 217 #
218 218 # Keep in sync with the standard DYNFLAGS
219 219 #
220 220 $(DYNLIBCCC):= DYNFLAGS = $(HSONAMECCC) $(ZTEXT) $(ZDEFS) \
221 221 $(MAPFILES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%) \
222 222 $(BDIRECT) $(NORUNPATH)
223 223
224 224
225 225 # build rule for "portable" source
226 226 objs/%.o pics/%.o: %.c
227 227 $(COMPILE.c) -o $@ $<
228 228 $(POST_PROCESS_O)
229 229
230 230 objs/%.o pics/%.o: %.cc
231 231 $(COMPILE.cc) -o $@ $<
232 232 $(POST_PROCESS_O)
233 233
234 234 .PRECIOUS: $(LIBS)
235 235
236 236 # Define the majority text domain in this directory.
237 237 TEXT_DOMAIN= SUNW_OST_OSLIB
238 238
239 239 $(ROOTMAN3)/%: %.sunman
240 240 $(INS.rename)
241 241
242 242 #
243 243 # For library source code, we expect that some symbols may not be used or
244 244 # may *appear* to be able to rescoped to static; shut lint up. Never add
245 245 # a flag here unless you're *sure* that all libraries need to be linted
246 246 # with it.
247 247 #
248 248 LINTCHECKFLAGS = -m -erroff=E_NAME_DEF_NOT_USED2
249 249 LINTCHECKFLAGS += -erroff=E_NAME_DECL_NOT_USED_DEF2
250 250
251 251 #
252 252 # Target Architecture
253 253 #
254 254 TARGETMACH= $(MACH)
255 255
256 256 #
257 257 # Allow people to define their own clobber rules. Normal makefiles
258 258 # shouldn't override this - they should override $(CLOBBERFILES) instead.
259 259 #
260 260 CLOBBERTARGFILES= $(LIBS) $(DYNLIB) $(CLOBBERFILES)
↓ open down ↓ |
60 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX