1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
|
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2014 Garrett D'Amore <garrett@damore.org>
# Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
# Copyright (c) 2017 by Delphix. All rights reserved.
# Copyright 2019 Joyent, Inc.
# Copyright 2021 Oxide Computer Company
#
# This Makefiles contains the common targets and definitions for
# all kernels. It is to be included in the Makefiles for specific
# implementation architectures and processor architecture dependent
# modules: i.e.: all driving kernel Makefiles.
#
#
# Partially link .o files to generate the kmod. The fake dependency
# on modstubs simplifies things...
#
# Hammerhead: Use illumos linker's -ztype=kmod for kernel modules
# This allows -N dependencies to specify module load order
$(BINARY): $(OBJECTS) $(DTRACE_MAPFILE) $(MAPFILE)
$(LD) -ztype=kmod $(LDFLAGS) -o $@ $(OBJECTS)
$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
$(POST_PROCESS)
#
# Since assym.h is a derived file, the dependency must be explicit for all
# files including this file. The actual lists are defined in
# */Makefile.files.
#
$(ASSYM_DEPS:%=$(OBJS_DIR)/%): $(DSF_DIR)/$(OBJS_DIR)/assym.h
#
# Build the source file which contains the kernel's utsname,
# with release, version and machine set as follows:
#
# release: contents of $(RELEASE) (Spaces replaced by '_')
# version: contents of $(VERSION) (Spaces replaced by '_')
# machine: contents of $(UNAME_M)
#
# Build environment information is only contained in the comment section.
#
$(OBJS_DIR)/vers.o: $(OBJECTS)
$(COMPILE.c) -DUTS_RELEASE=\"`$(ECHO) $(RELEASE) | sed -e 's/ /_/g'`\" \
-DUTS_VERSION=\"`$(ECHO) $(VERSION) | sed -e 's/ /_/g'`\" \
-DUTS_PLATFORM=\"$(UNAME_M)\" -o $@ $(SRC)/uts/common/os/vers.c
$(CTFCONVERT_O)
$(POST_PROCESS_O)
#
# Installation targets and rules:
#
$(ROOT_MOD_DIR) $(USR_MOD_DIR):
-$(INS.dir)
$(ROOT_MOD_DIRS_32): $(ROOT_MOD_DIR)
-$(INS.dir)
$(USR_MOD_DIRS_32): $(USR_MOD_DIR)
-$(INS.dir)
$(ROOT_MOD_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) FRC
$(INS.file)
$(ROOT_CPU_DIR)/%: $(OBJS_DIR)/% $(ROOT_CPU_DIR) FRC
$(INS.file)
$(ROOT_DRV_DIR)/%: $(OBJS_DIR)/% $(ROOT_DRV_DIR) FRC
$(INS.file)
$(ROOT_DTRACE_DIR)/%: $(OBJS_DIR)/% $(ROOT_DTRACE_DIR) FRC
$(INS.file)
$(ROOT_EXEC_DIR)/%: $(OBJS_DIR)/% $(ROOT_EXEC_DIR) FRC
$(INS.file)
$(ROOT_FS_DIR)/%: $(OBJS_DIR)/% $(ROOT_FS_DIR) FRC
$(INS.file)
$(ROOT_SCHED_DIR)/%: $(OBJS_DIR)/% $(ROOT_SCHED_DIR) FRC
$(INS.file)
$(ROOT_SOCK_DIR)/%: $(OBJS_DIR)/% $(ROOT_SOCK_DIR) FRC
$(INS.file)
$(ROOT_STRMOD_DIR)/%: $(OBJS_DIR)/% $(ROOT_STRMOD_DIR) FRC
$(INS.file)
$(ROOT_IPP_DIR)/%: $(OBJS_DIR)/% $(ROOT_IPP_DIR) FRC
$(INS.file)
$(ROOT_SYS_DIR)/%: $(OBJS_DIR)/% $(ROOT_SYS_DIR) FRC
$(INS.file)
$(ROOT_MISC_DIR)/%: $(OBJS_DIR)/% $(ROOT_MISC_DIR) FRC
$(INS.file)
$(ROOT_DACF_DIR)/%: $(OBJS_DIR)/% $(ROOT_DACF_DIR) FRC
$(INS.file)
$(ROOT_BRAND_DIR)/%: $(OBJS_DIR)/% $(ROOT_BRAND_DIR) FRC
$(INS.file)
$(ROOT_CC_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_CC_DIR) FRC
$(INS.file)
$(ROOT_CRYPTO_DIR)/%: $(OBJS_DIR)/% $(ROOT_CRYPTO_DIR) FRC
$(INS.file)
$(ROOT_KGSS_DIR)/%: $(OBJS_DIR)/% $(ROOT_KGSS_DIR) FRC
$(INS.file)
$(ROOT_SCSI_VHCI_DIR)/%: $(OBJS_DIR)/% $(ROOT_SCSI_VHCI_DIR) FRC
$(INS.file)
$(ROOT_PMCS_FW_DIR)/%: $(OBJS_DIR)/% $(ROOT_PMCS_FW_DIR) FRC
$(INS.file)
$(ROOT_QLC_FW_DIR)/%: $(OBJS_DIR)/% $(ROOT_QLC_FW_DIR) FRC
$(INS.file)
$(ROOT_EMLXS_FW_DIR)/%: $(OBJS_DIR)/% $(ROOT_EMLXS_FW_DIR) FRC
$(INS.file)
$(ROOT_MACH_DIR)/%: $(OBJS_DIR)/% $(ROOT_MACH_DIR) FRC
$(INS.file)
$(ROOT_FONT_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_FONT_DIR) FRC
$(INS.file)
$(ROOT_MAC_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_MAC_DIR) FRC
$(INS.file)
$(ROOT_OVERLAY_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_OVERLAY_DIR) FRC
$(INS.file)
$(USR_DRV_DIR)/%: $(OBJS_DIR)/% $(USR_DRV_DIR) FRC
$(INS.file)
$(USR_EXEC_DIR)/%: $(OBJS_DIR)/% $(USR_EXEC_DIR) FRC
$(INS.file)
$(USR_FS_DIR)/%: $(OBJS_DIR)/% $(USR_FS_DIR) FRC
$(INS.file)
$(USR_SCHED_DIR)/%: $(OBJS_DIR)/% $(USR_SCHED_DIR) FRC
$(INS.file)
$(USR_SOCK_DIR)/%: $(OBJS_DIR)/% $(USR_SOCK_DIR) FRC
$(INS.file)
$(USR_STRMOD_DIR)/%: $(OBJS_DIR)/% $(USR_STRMOD_DIR) FRC
$(INS.file)
$(USR_SYS_DIR)/%: $(OBJS_DIR)/% $(USR_SYS_DIR) FRC
$(INS.file)
$(USR_MISC_DIR)/%: $(OBJS_DIR)/% $(USR_MISC_DIR) FRC
$(INS.file)
$(USR_KTEST_DIR)/%: $(OBJS_DIR)/% $(USR_KTEST_DIR) FRC
$(INS.file)
$(USR_DACF_DIR)/%: $(OBJS_DIR)/% $(USR_DACF_DIR) FRC
$(INS.file)
$(USR_PCBE_DIR)/%: $(OBJS_DIR)/% $(USR_PCBE_DIR) FRC
$(INS.file)
$(USR_DTRACE_DIR)/%: $(OBJS_DIR)/% $(USR_DTRACE_DIR) FRC
$(INS.file)
$(USR_BRAND_DIR)/%: $(OBJS_DIR)/% $(USR_BRAND_DIR) FRC
$(INS.file)
$(ROOT_KICONV_DIR)/%: $(OBJS_DIR)/% $(ROOT_KICONV_DIR) FRC
$(INS.file)
$(ROOT_FIRMWARE_DIR)/$(MODULE):
$(INS.dir)
$(ROOT_FIRMWARE_DIR)/$(MODULE)/%: FILEMODE = $(CFILEMODE)
$(ROOT_FIRMWARE_DIR)/$(MODULE)/%: $(ROOT_FIRMWARE_DIR)/$(MODULE) $(FWDIR)/%
$(INS.file)
include $(SRC)/Makefile.psm.targ
#
# Target for 64b modules
#
$(ROOT_KERN_DIR_64):
-$(INS.dir)
$(ROOT_KERN_DIR_64)/%: $(OBJS_DIR)/% $(ROOT_KERN_DIR_64) FRC
$(INS.file)
%/$(SUBDIR64): %
-$(INS.dir)
#
# Targets for '.conf' file installation.
#
$(ROOT_CONFFILE): $(SRC_CONFFILE) $(ROOT_CONFFILE:%/$(CONFFILE)=%)
$(INS.conffile)
#
# Targets for creating links between common platforms. ROOT_PLAT_LINKS
# are are the /platform level while ROOT_PLAT_LINKS_2 are one level
# down (/platform/`uname -i`/{lib|sbin|kernel}.
#
$(ROOT_PLAT_LINKS):
$(INS.slink1)
$(ROOT_PLAT_LINKS_2):
$(INS.slink2)
$(USR_PLAT_LINKS):
$(INS.slink1)
$(USR_PLAT_LINKS_2):
$(INS.slink2)
#
# multiple builds support
# Hammerhead: GNU Make target-specific syntax with guards for empty variables
#
def: TARGET = def
ifneq ($(DEF_DEPS),)
$(DEF_DEPS): TARGET = def
endif
all: TARGET = all
ifneq ($(ALL_DEPS),)
$(ALL_DEPS): TARGET = all
endif
clean: TARGET = clean
ifneq ($(CLEAN_DEPS),)
$(CLEAN_DEPS): TARGET = clean
endif
clobber: TARGET = clobber
ifneq ($(CLOBBER_DEPS),)
$(CLOBBER_DEPS): TARGET = clobber
endif
install: TARGET = install
ifneq ($(INSTALL_DEPS),)
$(INSTALL_DEPS): TARGET = install
endif
symcheck: TARGET = symcheck
ifneq ($(SYM_DEPS),)
$(SYM_DEPS): TARGET = symcheck
endif
ALL_TARGS = def all clean clobber install symcheck
ALL_OBJ32 = $(ALL_TARGS:%=%.obj32)
$(ALL_OBJ32): FRC
@BUILD_TYPE=OBJ32 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
ALL_DEBUG32 = $(ALL_TARGS:%=%.debug32)
$(ALL_DEBUG32): FRC
@BUILD_TYPE=DBG32 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
ALL_OBJ64 = $(ALL_TARGS:%=%.obj64)
$(ALL_OBJ64): FRC
@BUILD_TYPE=OBJ64 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
ALL_DEBUG64 = $(ALL_TARGS:%=%.debug64)
$(ALL_DEBUG64): FRC
@BUILD_TYPE=DBG64 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
#
# Currently only the IP module needs symbol checking on obj64.
# Other modules have the same global-objs nm output for debug64 and obj64.
#
# Hammerhead: sischeck warns but does not fail the build. Baselines were
# created for the original illumos 32+64-bit build and are stale after our
# 64-bit-only architecture simplification.
$(SISCHECK_DEPS): $(DEF_DEPS)
@TARG=`$(ECHO) $@ | $(CUT) -d'.' -f2`; \
MODSYMS=$(MODULE).symbols.$$TARG; \
if [ -f "$(MODULE).global-objs.$$TARG" ]; then \
$(GREP) -v '#' $(MODULE).global-objs.$$TARG |$(GREP) . | \
$(SORT) -u > $$MODSYMS.tmp; \
$(NM) $$TARG/$(MODULE) |$(GREP) OBJT |$(GREP) -v UNDEF | \
$(CUT) -d'|' -f8 |$(GREP) -v '^___const_' | \
$(GREP) -v '\.[0-9]*$$' |$(SORT) -u \
> $$MODSYMS.tmp.new; \
$(DIFF) $$MODSYMS.tmp $$MODSYMS.tmp.new > $$MODSYMS.diff || \
($(ECHO) "warning: $(MODULE) symbol checking:" \
"global variable(s) introduced and/or removed."; \
$(CAT) $$MODSYMS.diff) \
fi
$(SISCLEAN_DEPS):
-TARG=`$(ECHO) $@ | $(CUT) -d'.' -f2`; \
MODSYMS=$(MODULE).symbols.$$TARG; \
$(RM) $$MODSYMS.tmp $$MODSYMS.tmp.new $$MODSYMS.diff Nothing_to_remove
$(OBJS_DIR):
-@mkdir -p $@ 2> /dev/null
def.targ: $(OBJS_DIR) $(ALL_TARGET)
all.targ: $(OBJS_DIR) $(ALL_TARGET)
install.targ: $(OBJS_DIR) $(INSTALL_TARGET)
#
# Cleanliness is next to ...
#
clean.targ:
-$(RM) $(CLEANFILES) Nothing_to_remove
clobber.targ:
-$(RM) $(CLOBBERFILES) Nothing_to_remove
FRC:
|