Print this page
10077 usr/src/uts/ Makefile changes for smatch
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/i86xpv/unix/Makefile
+++ new/usr/src/uts/i86xpv/unix/Makefile
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
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
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 2008 Sun Microsystems, Inc. All rights reserved.
24 24 # Use is subject to license terms.
25 25 #
26 +# Copyright (c) 2018, Joyent, Inc.
27 +#
26 28 # This makefile drives the production of unix (and unix.o).
27 29 #
28 30 # i86xpv implementation architecture dependent
29 31 #
30 32
31 33 #
32 34 # Path to the base of the uts directory tree (usually /usr/src/uts).
33 35 #
34 36 UTSBASE = ../..
35 37
36 38 #
37 39 # Define the module and object file sets.
38 40 #
39 41 UNIX = unix
40 42 DBOOT = dboot
41 43
42 44 OBJECTS = $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
43 45 $(CORE_OBJS:%=$(OBJS_DIR)/%) \
44 46 $(KRTLD_OBJS:%=$(OBJS_DIR)/%) \
45 47 $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%)
46 48
47 49 LINTS = $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \
48 50 $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \
49 51 $(KRTLD_OBJS:%.o=$(LINTS_DIR)/%.ln) \
50 52 $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
51 53 $(LINTS_DIR)/vers.ln \
52 54 $(LINTS_DIR)/modstubs.ln
53 55
54 56 ROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX)
55 57
56 58 UNIX_BIN = $(OBJS_DIR)/$(UNIX)
57 59
58 60 LIBS = $(GENLIB)
59 61
60 62 GENUNIX = genunix
61 63 GENUNIX_DIR = ../../intel/$(GENUNIX)
62 64
63 65 LIBOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
64 66
65 67 CTFEXTRAOBJS = $(OBJS_DIR)/vers.o
66 68
67 69 DBOOT_OBJS_DIR = dboot/$(OBJS_DIR)
68 70 DBOOT_OBJECTS = $(DBOOT_OBJS:%=$(DBOOT_OBJS_DIR)/%)
69 71 DBOOT_BIN = $(DBOOT_OBJS_DIR)/$(DBOOT)
70 72 DBOOT_O = $(OBJS_DIR)/$(DBOOT).o
71 73 DBOOT_S = $(DBOOT_O:%.o=%.s)
72 74 DBOOT_LINTS = $(DBOOT_OBJS:%.o=$(DBOOT_OBJS_DIR)/%.ln)
73 75 DBOOT_LINT = $(LINT_$(MACH)_$(CLASS))
74 76
75 77 #
76 78 # Include common rules.
77 79 #
78 80 include $(UTSBASE)/i86xpv/Makefile.i86xpv
79 81
80 82 #
81 83 # Define targets
82 84 #
83 85 ALL_TARGET = $(UNIX_BIN)
84 86 LINT_TARGET = $(LINT_LIB) $(DBOOT_LINT_LIB)
85 87 INSTALL_TARGET = $(UNIX_BIN) $(ROOTMODULE)
86 88
87 89 #
88 90 # This is UNIX_DIR. Use a short path.
89 91 #
90 92 UNIX_DIR = .
91 93
92 94 #
93 95 # Overrides
94 96 #
95 97 CLEANFILES += \
96 98 $(UNIX_O) $(MODSTUBS_O) \
97 99 $(OBJS_DIR)/vers.c $(OBJS_DIR)/vers.o \
98 100 $(OBJS_DIR)/dtracestubs.s \
99 101 $(DTRACESTUBS_O) $(DTRACESTUBS)
100 102
101 103 CLEANFILES += \
102 104 $(DBOOT_O) $(DBOOT_S) \
103 105 $(DBOOT_OBJECTS) \
104 106 $(DBOOT_BIN)
105 107
106 108 CLEANFILES += \
107 109 $(DBOOT_OBJS_DIR)/$(VGATEXT_FONT).c \
108 110 $(OBJS_DIR)/$(VGATEXT_FONT).c
109 111
110 112 CLEANFILES += \
111 113 $(OBJS_DIR)/fb_swtch_src.o \
112 114 $(OBJS_DIR)/fb_swtch_src \
113 115 $(OBJS_DIR)/fb_swtch.s
114 116
115 117 CLEANFILES += \
116 118 $(ZLIB_OBJS:%.o=$(OBJS_DIR)/%.o) \
117 119 $(ZLIB_OBJS:%.o=$(OBJS_DIR)/%.ln)
118 120
119 121 CLOBBERFILES = $(CLEANFILES) $(UNIX_BIN)
120 122 CLEANLINTFILES += $(LINT_LIB) $(DBOOT_LINT_LIB) $(DBOOT_LINTS)
121 123
122 124 # instr_size needs a special header
123 125 $(OBJS_DIR)/instr_size.o := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386
124 126 $(OBJS_DIR)/instr_size.ln := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386
125 127
126 128 CFLAGS += -DDIS_MEM
127 129
128 130 #
129 131 # For now, disable these lint checks; maintainers should endeavor
130 132 # to investigate and remove these for maximum lint coverage.
131 133 # Please do not carry these forward to new Makefiles.
132 134 #
133 135 LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN
134 136 LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON
135 137 LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
136 138 LINTTAGS += -erroff=E_STATIC_UNUSED
137 139 LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW
138 140 LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV
139 141
140 142 CERRWARN += -_gcc=-Wno-parentheses
↓ open down ↓ |
105 lines elided |
↑ open up ↑ |
141 143 CERRWARN += -_gcc=-Wno-uninitialized
142 144 CERRWARN += -_gcc=-Wno-char-subscripts
143 145 CERRWARN += -_gcc=-Wno-unused-variable
144 146 CERRWARN += -_gcc=-Wno-unused-function
145 147 CERRWARN += -_gcc=-Wno-unused-label
146 148 CERRWARN += -_gcc=-Wno-type-limits
147 149 CERRWARN += -_gcc=-Wno-clobbered
148 150 CERRWARN += -_gcc=-Wno-unused-value
149 151 CERRWARN += -_gcc=-Wno-empty-body
150 152
153 +# needs work
154 +SMATCH=off
155 +
151 156 # Ensure that lint sees 'struct cpu' containing a fully declared
152 157 # embedded 'struct machcpu'
153 158 #
154 159 LINTFLAGS += -D_MACHDEP -I../../i86pc
155 160
156 161 #
157 162 # Default build targets.
158 163 #
159 164 .KEEP_STATE:
160 165
161 166 def: $(DEF_DEPS)
162 167
163 168 all: $(ALL_DEPS)
164 169
165 170 clean: $(CLEAN_DEPS)
166 171
167 172 clobber: $(CLOBBER_DEPS)
168 173
169 174 lint: $(LINT_DEPS)
170 175
171 176 clean.lint: $(CLEAN_LINT_DEPS)
172 177
173 178 install: $(INSTALL_DEPS)
174 179
175 180 MAPFILE_32 = $(MAPFILE)
176 181 MAPFILE_64 = $(MAPFILE).amd64
177 182
178 183 MAPFILE_NAME = $(MAPFILE_$(CLASS))
179 184
180 185 $(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \
181 186 $(GENLIB) $(DTRACESTUBS) $(DBOOT_O)
182 187 $(LD) -dy -b -o $@ -e dboot_image -znointerp -M $(MAPFILE_NAME) \
183 188 $(UNIX_O) $(DBOOT_O) $(MODSTUBS_O) $(LIBOPTS) \
184 189 $(DTRACESTUBS)
185 190 $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
186 191 $(POST_PROCESS)
187 192
188 193 $(UNIX_O): $(OBJECTS) $(OBJS_DIR)/vers.o
189 194 $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
190 195
191 196 $(DBOOT_BIN): $(DBOOT_OBJS_DIR) $(DBOOT_OBJECTS) dboot/Mapfile.dboot
192 197 $(LD) -dn -e _start -M dboot/Mapfile.dboot \
193 198 -o $(DBOOT_BIN) $(DBOOT_OBJECTS)
194 199
195 200 $(DBOOT_O): $(DBOOT_BIN)
196 201 @echo " .data" > $(DBOOT_S)
197 202 @echo " .globl dboot_image" >> $(DBOOT_S)
198 203 @echo "dboot_image:" >> $(DBOOT_S)
199 204 $(ELFEXTRACT) $(DBOOT_BIN) >> $(DBOOT_S)
200 205 $(COMPILE.s) -o $(DBOOT_O) $(DBOOT_S)
201 206
202 207 $(DBOOT_OBJS_DIR):
203 208 -@mkdir -p $@ 2> /dev/null
204 209
205 210 #
206 211 # Special rules for generating assym.h for inclusion in assembly files.
207 212 #
208 213 $(DSF_DIR)/$(OBJS_DIR)/assym.h $(DSF_DIR)/$(OBJS_DIR)/kdi_assym.h: FRC
209 214 @cd $(DSF_DIR); $(MAKE) all.targ
210 215
211 216 #
212 217 # The global lint target builds the kernel lint library (llib-lunix.ln)
213 218 # which is equivalent to a lint of /unix.o. Then all kernel modules for
214 219 # this architecture are linted against the kernel lint library.
215 220 #
216 221 # Note: lint errors in the kernel lint library will be repeated for
217 222 # each module. It is important that the kernel lint library
218 223 # be clean to keep the textual output to a reasonable level.
219 224 #
220 225
221 226 $(LINT_LIB): $(LINT_LIB_DIR) $(LINTS)
222 227 @pwd
223 228 @-$(ECHO) "\n$(UNIX): (library construction):"
224 229 @$(LINT) -o$(UNIX) $(LINTFLAGS) $(LINTS)
225 230 @$(MV) $(@F) $@
226 231
227 232 $(DBOOT_LINT_LIB): $(LINT_LIB_DIR) $(DBOOT_LINTS)
228 233 @pwd
229 234 @-$(ECHO) "\n$(DBOOT): (library construction):"
230 235 @$(LINT) -o$(DBOOT) $(DBOOT_LINTFLAGS) $(DBOOT_LINTS)
231 236 @$(MV) $(@F) $@
232 237
233 238 lintlib: $(LINT_DEPS)
234 239
235 240 #
236 241 # Include common targets.
237 242 #
238 243 include $(UTSBASE)/i86xpv/Makefile.targ
↓ open down ↓ |
78 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX