Print this page
7627 Build should be smarter about how SGSPROTO is created
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Kim Shrier <kshrier@racktopsystems.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/sgs/Makefile.targ
+++ new/usr/src/cmd/sgs/Makefile.targ
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
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
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
22 22 #
23 23 # Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
24 +# Copyright 2016 RackTop Systems.
24 25 #
25 26
26 27 # Standard install rules
27 28 # The VAR_SGSBIN and VAR_SGSBIN64 install rules included here are applicable
28 29 # to Solaris 10 and earlier releases. For post Solaris 10 releases, the
29 30 # standard ROOTBIN and ROOTBIN64 rules defined in ../Makefile.cmd are used.
30 31 # The new rules here are included to allow for easier backporting. Making
31 32 # the appropriate updates in ./Makefile.var, will allow the SGS components
32 33 # to be installed in /usr/ccs/bin rather than the current /usr/bin.
33 34 #
34 35 $(VAR_SGSBIN)/%: %
35 36 $(INS.file)
36 37
37 38 $(VAR_SGSBIN64)/%: %
38 39 $(INS.file)
39 40
40 41 ################################################################################
41 42 #
42 43 # Linting the Linker Libraries
43 44 #
44 45 # Several of the linker's libraries are, in whole or in part, built in two
45 46 # passes, once as Elf32 and once as Elf64 (i.e. with -D_ELF64 defined). Lint
46 47 # needs to be able to do both passes, but combining the two is problematic for
47 48 # the 2nd pass of lint, as it sees many interfaces as being defined both ways
48 49 # and considers them to be incompatible. The targets defined here allow for
49 50 # both passes to live independently. This means that both the lint.out, and
50 51 # the lint library itself get generated separately, to different output files.
51 52 # The lint.out's get combined into a single lint.out report, and the lint
52 53 # libraries get generated with a 32/64 suffix. The dependents on these lint
53 54 # libraries, then, choose which version they need to use. Substitutions can
54 55 # be made automatically if the macro's defined in ./Makefile.com are used to
55 56 # specify the dependency, for those libs that need them.
56 57 #
57 58 # Don't
58 59 #
59 60 # Don't use the /*LINTLIBRARY*/ directive in linker libraries, this disables
60 61 # some important checks, including the ability to test format strings from the
61 62 # msg.h files.
62 63 #
63 64 # Don't use the `-x' option to lint when linting linker libraries. This masks
64 65 # all the dead wood in our own header files. Instead, there has been added to
65 66 # the relevant common directories a file called `lintsup.c' which is used to
66 67 # mask out the headers that we aren't interested in. This method is used for
67 68 # libraries, like libld, which have their own header files, but is irrelevant
68 69 # to libraries like libldstab which exports no interface of it's own.
69 70 #
70 71 # The `lintsup.c' file can also be used, in some cases, to mask out other
71 72 # issues that lint won't otherwise shut up about.
72 73 #
73 74 # Other Lint Options
74 75 #
75 76 # `-m' has been added to the LINTFLAGS. Warnings about globals that could be
76 77 # static are irrelevant as we use mapfiles to scope down unnecessary globals.
77 78 #
78 79 # `-u' is used in the LINTFLAGS for libraries, otherwise lint tends to be very
79 80 # noisy.
80 81 #
81 82 # `-x' is avoided for libraries, but is used for executables because all we
82 83 # care about is that what we use is defined, not about declarations in public
83 84 # headers that we don't use.
84 85 #
85 86 # Relevant variables:
86 87 #
87 88 # */Makefile.com
88 89 # SRCS= ../common/llib-l<libname>
89 90 # LINTSRCS= <source files>
90 91 # LDLIBS= ... [$(LDDBG_LIB) $(LD_LIB)]
91 92 # LINTFLAGS= ...
92 93 # LINTFLAGS64= ...
93 94 # CLEANFILES += ... $(LINTOUTS)
94 95 # CLOBBERFILES += ... $(LINTLIBS)
95 96 #
96 97 # Relevant targets:
97 98 #
98 99 # */Makefile.targ
99 100 # # this file for SGS lint targets.
100 101 # include $(SRC)/cmd/sgs/Makefile.targ
101 102 #
102 103 # lint: <choose the desired functionality> $(SGSLINTOUT)
103 104 #
104 105 # $(LINTLIB32),
105 106 # $(LINTLIB64) Create an Elf32 or Elf64 lint library from
106 107 # a proto file indicated by the $(SRCS) variable.
107 108 #
108 109 # $(LINTOUT32),
109 110 # $(LINTOUT64) Run lint on the sources indicated by the
110 111 # $(LINTSRCS) variable with respect to Elf32
111 112 # or Elf64. Dependencies are gathered from
112 113 # the $(LDLIBS) variable.
113 114 #
114 115 # $(SGSLINTOUT) Create a `lint.out' file as the concatination
115 116 # of the lint output from the previous targets.
116 117 # This should be specified *last* in the list.
117 118 #
118 119 ################################################################################
119 120
120 121 #
121 122 # Override the OS's $(LINTOUT) target to avoid confusion.
122 123 #
123 124 LINTOUT = $(LINTOUT1)
124 125
125 126 #
126 127 # If LD_LIB, LDDBG_LIB, or CONV_LIB is added to LDLIBS, then the right lint
127 128 # library should be picked up automatically.
128 129 #
129 130 $(LINTOUT32) := LD_LIB=$(LD_LIB32)
130 131 $(LINTOUT32) := LDDBG_LIB=$(LDDBG_LIB32)
131 132 $(LINTOUT32) := CONV_LIB=$(CONV_LIB32)
132 133
133 134 $(LINTOUT64) := LD_LIB=$(LD_LIB64)
134 135 $(LINTOUT64) := LDDBG_LIB=$(LDDBG_LIB64)
135 136 $(LINTOUT64) := CONV_LIB=$(CONV_LIB64)
136 137
137 138 #
138 139 # Force $(LINTLIB) in order to help the $(SGSLINTOUT)
139 140 # target produce the same output on successive runs.
140 141 #
141 142 $(LINTLIB): FRC
142 143
143 144 $(LINTLIB32): $(SRCS)
144 145 $(LINT.c) -o $(LIBNAME32) $(SRCS)
145 146
146 147 $(LINTLIB64): $(SRCS)
147 148 $(LINT.c) -D_ELF64 -o $(LIBNAME64) $(SRCS)
148 149
149 150 $(LINTOUT32): $(LINTSRCS) $(LINTSRCS32)
150 151 $(LINT.c) $(LINTSRCS) $(LINTSRCS32) $(LDLIBS) > $(LINTOUT32) 2>&1
151 152
152 153 $(LINTOUT64): $(LINTSRCS) $(LINTSRCS64)
153 154 $(LINT.c) -D_ELF64 $(LINTSRCS) $(LINTSRCS64) \
154 155 $(LDLIBS) > $(LINTOUT64) 2>&1
155 156
156 157 #
157 158 # A couple of macros used in the SGSLINTOUT rule below
158 159 #
159 160 # LINT_HDR - Use sgs/tools/lint_hdr.pl to generate lint output headers
160 161 # LINT_TEE - Use tee to write output to stdout and also capture it
161 162 # in the SGSLINT output file.
162 163 #
163 164 # An additional complexity: We produce headers for all the lint
164 165 # output so that we can tell what came from where when we look
165 166 # at the resulting file. We also cat these headers to stdout so that
166 167 # the user of make will see them. However, we don't want the headers
167 168 # to go to stdout if there is only one of LINTOUT32 and LINTOUT64. To
168 169 # the interactive user, the headers are only interesting as a way to
169 170 # separate the two ELF classes. We only bother with this for the
170 171 # non-DYNLIB and non-RTLD case, because at the current time, both of these
171 172 # cases always have both 32 and 64-bit ELFCLASS support.
172 173 #
173 174 LINT_HDR= perl $(SGSTOOLS)/lint_hdr.pl
174 175 LINT_TEE= tee -a $(SGSLINTOUT)
175 176
176 177 $(SGSLINTOUT): FRC
177 178 @ rm -f $(SGSLINTOUT)
178 179 @ if [ -r $(LINTOUT1) ]; then \
179 180 $(LINT_HDR) $(LINTLIB) | $(LINT_TEE); \
180 181 cat $(LINTOUT1) | $(LINT_TEE); \
181 182 fi
182 183 @ if [ -r $(LINTOUT32) ]; then \
183 184 if [ -n "$(DYNLIB)" ] ; then \
184 185 $(LINT_HDR) $(DYNLIB) 32 | $(LINT_TEE); \
185 186 elif [ -n "$(RTLD)" ] ; then \
186 187 $(LINT_HDR) $(RTLD) 32 | $(LINT_TEE); \
187 188 else \
188 189 if [ -r $(LINTOUT64) ]; then \
189 190 $(LINT_HDR) $(PROG) 32 | $(LINT_TEE); \
190 191 else \
191 192 $(LINT_HDR) $(PROG) 32 >> $(SGSLINTOUT); \
192 193 fi; \
193 194 fi; \
194 195 cat $(LINTOUT32) | $(LINT_TEE); \
195 196 fi
196 197 @ if [ -r $(LINTOUT64) ]; then \
197 198 if [ -n "$(DYNLIB)" ] ; then \
198 199 if [ $(DYNLIB) = "libld.so.2" ] ; then \
199 200 $(LINT_HDR) libld.so.3 64 | $(LINT_TEE); \
200 201 else \
201 202 $(LINT_HDR) $(DYNLIB) 64 | $(LINT_TEE); \
202 203 fi; \
203 204 elif [ -n "$(RTLD)" ] ; then \
204 205 $(LINT_HDR) $(RTLD) 64 | $(LINT_TEE); \
205 206 else \
206 207 if [ -r $(LINTOUT32) ]; then \
207 208 $(LINT_HDR) $(PROG) 64 | $(LINT_TEE); \
208 209 else \
209 210 $(LINT_HDR) $(PROG) 64 >> $(SGSLINTOUT); \
210 211 fi; \
211 212 fi; \
212 213 cat $(LINTOUT64) | $(LINT_TEE); \
213 214 fi
214 215 @ rm -f $(LINTOUT1) $(LINTOUT32) $(LINTOUT64)
215 216
216 217 #
217 218 # For those that install the lint library source file.
218 219 #
219 220 $(ROOTLIBDIR)/$(LINTLIBSRC): ../common/$(LINTLIBSRC)
220 221 $(INS.file) ../common/$(LINTLIBSRC)
221 222
222 223 $(ROOTFS_LIBDIR)/$(LIBLINKS): $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS)
↓ open down ↓ |
189 lines elided |
↑ open up ↑ |
223 224 $(INS.liblink)
224 225
225 226 $(ROOTFS_LIBDIR64)/$(LIBLINKS): $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS)
226 227 $(INS.liblink64)
227 228
228 229 $(ROOTFS_LIBDIR)/$(LIBLINKSCCC): $(ROOTFS_LIBDIR)/$(LIBLINKSCCC)$(VERS)
229 230 $(INS.liblinkccc)
230 231
231 232 $(ROOTFS_LIBDIR64)/$(LIBLINKSCCC): $(ROOTFS_LIBDIR64)/$(LIBLINKSCCC)$(VERS)
232 233 $(INS.liblinkccc64)
234 +
235 +#
236 +# For those that install into the SGSPROTO directory.
237 +#
238 +$(SGSPROTO):
239 + $(INS.dir)
240 +
241 +$(SGSBINDIR): $(SGSPROTO)
242 + $(INS.dir)
243 +
244 +$(SGSPREFIX): $(SGSPROTO)
245 + $(INS.dir)
246 +
247 +$(SGSLIBDIR): $(SGSPREFIX)
248 + $(INS.dir)
233 249
234 250 FRC:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX