4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
26 # This Makefile defines the build rules for the directory uts/i86pc
27 # and its children. These are the source files which are i86pc
28 # "implementation architecture" dependent.
30 # The following two-level ordering must be maintained in this file.
31 # Lines are sorted first in order of decreasing specificity based on
32 # the first directory component. That is, i86pc rules come before
33 # intel rules come before common rules.
35 # Lines whose initial directory components are equal are sorted
36 # alphabetically by the remaining components.
39 # Section 1a: C object build rules
41 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/conf/%.c
45 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/amd_opteron/%.c
49 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/authenticamd/%.c
53 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/generic_cpu/%.c
57 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/genuineintel/%.c
61 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/%.c
65 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi_drv/%.c
69 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/fipe/%.c
73 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi/acpidev/%.c
77 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi/acpinex/%.c
81 SBD_IOCTL = $(UTSBASE)/i86pc/sys/sbd_ioctl.h
82 DRMACH_IO = $(UTSBASE)/i86pc/io/acpi/drmach_acpi
83 DRMACH_GENERR = $(DRMACH_IO)/sbdgenerr
84 DR_IO = $(UTSBASE)/i86pc/io/dr
85 DR_GENERR = $(DR_IO)/sbdgenerr
87 $(DRMACH_GENERR): $(DR_IO)/sbdgenerr.pl
89 $(CAT) $(DR_IO)/sbdgenerr.pl > $@
92 $(DRMACH_IO)/drmach_err.c: $(DRMACH_GENERR) $(SBD_IOCTL)
94 $(DRMACH_GENERR) EX86 < $(SBD_IOCTL) > $(DRMACH_IO)/drmach_err.c
96 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi/drmach_acpi/%.c
100 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/amd_iommu/%.c
101 $(COMPILE.c) -o $@ $<
104 $(DR_GENERR): $(DR_IO)/sbdgenerr.pl
106 $(CAT) $(DR_IO)/sbdgenerr.pl > $@
109 $(DR_IO)/dr_err.c: $(DR_GENERR) $(SBD_IOCTL)
111 $(DR_GENERR) ESBD < $(SBD_IOCTL) > $(DR_IO)/dr_err.c
113 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/dr/%.c
114 $(COMPILE.c) -o $@ $<
117 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ioat/%.c
118 $(COMPILE.c) -o $@ $<
121 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pci/%.c
122 $(COMPILE.c) -o $@ $<
125 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pciex/%.c
126 $(COMPILE.c) -o $@ $<
129 $(OBJS_DIR)/%.o: $(UTSBASE)/intel/io/pciex/hotplug/%.c
130 $(COMPILE.c) -o $@ $<
133 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pcplusmp/%.c
134 $(COMPILE.c) -o $@ $<
137 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pcplusmp/%.s
138 $(COMPILE.s) -o $@ $<
140 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/apix/%.c
141 $(COMPILE.c) -o $@ $<
144 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ppm/%.c
145 $(COMPILE.c) -o $@ $<
148 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ppm/%.s
149 $(COMPILE.s) -o $@ $<
151 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/psm/%.c
152 $(COMPILE.c) -o $@ $<
155 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/psm/%.s
156 $(COMPILE.s) -o $@ $<
158 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/tzmon/%.c
159 $(COMPILE.c) -o $@ $<
162 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/ml/%.s
163 $(COMPILE.s) -o $@ $<
165 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/os/%.c
166 $(COMPILE.c) -_gcc=-fno-stack-protector -o $@ $<
169 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/os/cpupm/%.c
170 $(COMPILE.c) -o $@ $<
173 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/boot/%.c
174 $(COMPILE.c) -o $@ $<
177 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/vm/%.c
178 $(COMPILE.c) -o $@ $<
181 $(OBJS_DIR)/%.o: $(UTSBASE)/common/io/%.c
182 $(COMPILE.c) -o $@ $<
185 $(OBJS_DIR)/%.o: $(UTSBASE)/common/io/ppm/%.c
186 $(COMPILE.c) -o $@ $<
189 $(OBJS_DIR)/%.o: $(UTSBASE)/common/io/pciex/%.c
190 $(COMPILE.c) -o $@ $<
193 $(OBJS_DIR)/%.o: $(UTSBASE)/common/os/%.c
194 $(COMPILE.c) -o $@ $<
197 $(OBJS_DIR)/%.o: $(SRC)/common/dis/i386/%.c
198 $(COMPILE.c) -o $@ $<
201 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/gfx_private/%.c
202 $(COMPILE.c) -o $@ $<
205 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/xsvc/%.c
206 $(COMPILE.c) -o $@ $<
209 $(OBJS_DIR)/%.o: $(UTSBASE)/common/xen/os/%.c
210 $(COMPILE.c) -o $@ $<
214 # dboot stuff is always 32 bit, linked to run with phys_addr == virt_addr
216 DBOOT_OBJS_DIR = dboot/$(OBJS_DIR)
217 DBOOT_MACH_32 = -D_BOOT_TARGET_i386
218 DBOOT_MACH_64 = -D_BOOT_TARGET_amd64
219 DBOOT_DEFS = -D_BOOT $(DBOOT_MACH_$(CLASS))
220 DBOOT_DEFS += -D_MACHDEP -D_KMEMUSER -U_KERNEL -D_I32LPx
221 DBOOT_FLAGS = $(CCVERBOSE) $(CERRWARN) $(CCNOAUTOINLINE)
223 DBOOT_CC_INCL = -I$(SRC)/common $(INCLUDE_PATH)
224 DBOOT_AS_INCL = $(AS_INC_PATH)
226 DBOOT_AS = $(ONBLD_TOOLS)/bin/$(MACH)/aw
228 DBOOT_LINTS_DIR = $(DBOOT_OBJS_DIR)
229 DBOOT_LINTFLAGS_i86pc = $(LINTFLAGS_i386_32) $(LINTTAGS_i386_32)
231 DBOOT_LINTFLAGS = $(DBOOT_LINTFLAGS_$(PLATFORM)) $(LINTTAGS) $(C99LMODE) \
232 $(CPPFLAGS) $(DBOOT_DEFS)
233 DBOOT_LOCAL_LINTFLAGS = -c -dirout=$(DBOOT_LINTS_DIR) -I$(SRC)/common \
234 $(DBOOT_LINTFLAGS) $(DBOOT_LINTTAGS)
236 $(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/boot/%.c
237 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
239 $(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/dboot/%.c
240 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
242 $(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/intel/ia32/%.s
243 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
245 $(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/crypto/sha1/%.c
246 $(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
248 $(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/util/%.c
249 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
251 $(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/util/i386/%.s
252 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
254 $(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/dboot/%.s
255 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
258 # Stuff to build bios_call.o for the kernel.
260 MAPFILE_BIOS = $(UTSBASE)/i86pc/conf/Mapfile.bios
261 $(OBJS_DIR)/bios_call.o: $(UTSBASE)/i86pc/ml/bios_call_src.s
262 $(COMPILE.s) -o $(OBJS_DIR)/bios_call_src.o \
263 $(UTSBASE)/i86pc/ml/bios_call_src.s
264 $(LD) -dn -M $(MAPFILE_BIOS) \
265 -o $(OBJS_DIR)/bios_call_src $(OBJS_DIR)/bios_call_src.o
266 @echo " .data" > $(OBJS_DIR)/bios_call.s
267 @echo " .globl bios_image" >> $(OBJS_DIR)/bios_call.s
268 @echo "bios_image:" >> $(OBJS_DIR)/bios_call.s
269 $(ELFEXTRACT) $(OBJS_DIR)/bios_call_src >> $(OBJS_DIR)/bios_call.s
270 @echo " .align 4" >> $(OBJS_DIR)/bios_call.s
271 @echo " .globl bios_size" >> $(OBJS_DIR)/bios_call.s
272 @echo "bios_size:" >> $(OBJS_DIR)/bios_call.s
273 @echo " .long . - bios_image" >> $(OBJS_DIR)/bios_call.s
274 $(COMPILE.s) -o $@ $(OBJS_DIR)/bios_call.s
277 # Stuff to build fb_swtch.o for the kernel.
279 MAPFILE_FBSWTCH = $(UTSBASE)/i86pc/conf/Mapfile.fb_swtch
280 $(OBJS_DIR)/fb_swtch.o: $(UTSBASE)/i86pc/ml/fb_swtch_src.s
281 $(COMPILE.s) -o $(OBJS_DIR)/fb_swtch_src.o \
282 $(UTSBASE)/i86pc/ml/fb_swtch_src.s
283 $(LD) -dn -M $(MAPFILE_FBSWTCH) \
284 -o $(OBJS_DIR)/fb_swtch_src $(OBJS_DIR)/fb_swtch_src.o
285 @echo " .data" > $(OBJS_DIR)/fb_swtch.s
286 @echo " .globl fb_swtch_image" >> $(OBJS_DIR)/fb_swtch.s
287 @echo "fb_swtch_image:" >> $(OBJS_DIR)/fb_swtch.s
288 $(ELFEXTRACT) $(OBJS_DIR)/fb_swtch_src >> $(OBJS_DIR)/fb_swtch.s
289 @echo " .align 4" >> $(OBJS_DIR)/fb_swtch.s
290 @echo " .globl fb_swtch_size" >> $(OBJS_DIR)/fb_swtch.s
291 @echo "fb_swtch_size:" >> $(OBJS_DIR)/fb_swtch.s
292 @echo " .long . - fb_swtch_image" >> $(OBJS_DIR)/fb_swtch.s
293 $(COMPILE.s) -o $@ $(OBJS_DIR)/fb_swtch.s
295 # ridiculous contortions ---
296 ATOMIC_SUBDIR_32 = i386
297 ATOMIC_SUBDIR_64 = amd64
298 ATOMIC_SUBDIR = $(ATOMIC_SUBDIR_$(CLASS))
300 $(OBJS_DIR)/%.o: $(SRC)/common/atomic/$(ATOMIC_SUBDIR)/%.s
301 $(COMPILE.s) -o $@ $<
307 $(OBJS_DIR)/dtracestubs.s: $(UNIX_O) $(LIBS)
308 $(NM) -u $(UNIX_O) $(LIBS) | $(GREP) __dtrace_probe_ | $(SORT) | \
309 $(UNIQ) | $(NAWK) '{ \
310 printf("\t.globl %s\n\t.type %s,@function\n%s:\n", \
311 $$1, $$1, $$1); }' > $(OBJS_DIR)/dtracestubs.s
313 $(DTRACESTUBS): $(DTRACESTUBS_O)
314 $(BUILD.SO) $(DTRACESTUBS_O)
317 # Section 1b: Lint `object' build rules
319 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/conf/%.c
320 @($(LHEAD) $(LINT.c) $< $(LTAIL))
322 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/cpu/amd_opteron/%.c
323 @($(LHEAD) $(LINT.c) $< $(LTAIL))
325 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/cpu/authenticamd/%.c
326 @($(LHEAD) $(LINT.c) $< $(LTAIL))
328 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/cpu/generic_cpu/%.c
329 @($(LHEAD) $(LINT.c) $< $(LTAIL))
331 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/cpu/genuineintel/%.c
332 @($(LHEAD) $(LINT.c) $< $(LTAIL))
334 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/%.c
335 @($(LHEAD) $(LINT.c) $< $(LTAIL))
337 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/acpi_drv/%.c
338 @($(LHEAD) $(LINT.c) $< $(LTAIL))
340 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/fipe/%.c
341 @($(LHEAD) $(LINT.c) $< $(LTAIL))
343 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/acpi/acpidev/%.c
344 @($(LHEAD) $(LINT.c) $< $(LTAIL))
346 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/acpi/acpinex/%.c
347 @($(LHEAD) $(LINT.c) $< $(LTAIL))
349 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/acpi/drmach_acpi/%.c
350 @($(LHEAD) $(LINT.c) $< $(LTAIL))
352 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/amd_iommu/%.c
353 @($(LHEAD) $(LINT.c) $< $(LTAIL))
355 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/dr/%.c
356 @($(LHEAD) $(LINT.c) $< $(LTAIL))
358 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/ioat/%.c
359 @($(LHEAD) $(LINT.c) $< $(LTAIL))
361 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/pci/%.c
362 @($(LHEAD) $(LINT.c) $< $(LTAIL))
364 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/pciex/%.c
365 @($(LHEAD) $(LINT.c) $< $(LTAIL))
367 $(LINTS_DIR)/%.ln: $(UTSBASE)/intel/io/pciex/hotplug/%.c
368 @($(LHEAD) $(LINT.c) $< $(LTAIL))
370 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/pcplusmp/%.c
371 @($(LHEAD) $(LINT.c) $< $(LTAIL))
373 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/pcplusmp/%.s
374 @($(LHEAD) $(LINT.s) $< $(LTAIL))
376 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/apix/%.c
377 @($(LHEAD) $(LINT.c) $< $(LTAIL))
379 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/apix/%.s
380 @($(LHEAD) $(LINT.s) $< $(LTAIL))
382 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/ppm/%.c
383 @($(LHEAD) $(LINT.c) $< $(LTAIL))
385 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/ppm/%.s
386 @($(LHEAD) $(LINT.s) $< $(LTAIL))
388 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/psm/%.c
389 @($(LHEAD) $(LINT.c) $< $(LTAIL))
391 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/psm/%.s
392 @($(LHEAD) $(LINT.s) $< $(LTAIL))
394 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/tzmon/%.c
395 @($(LHEAD) $(LINT.c) $< $(LTAIL))
397 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/ml/%.s
398 @($(LHEAD) $(LINT.s) $< $(LTAIL))
400 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/os/%.c
401 @($(LHEAD) $(LINT.c) $< $(LTAIL))
403 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/os/cpupm/%.c
404 @($(LHEAD) $(LINT.c) $< $(LTAIL))
406 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/boot/%.c
407 @($(LHEAD) $(LINT.c) $< $(LTAIL))
409 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/vm/%.c
410 @($(LHEAD) $(LINT.c) $< $(LTAIL))
412 $(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/%.c
413 @($(LHEAD) $(LINT.c) $< $(LTAIL))
415 $(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/ppm/%.c
416 @($(LHEAD) $(LINT.c) $< $(LTAIL))
418 $(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/pciex/%.c
419 @($(LHEAD) $(LINT.c) $< $(LTAIL))
421 $(LINTS_DIR)/%.ln: $(UTSBASE)/common/os/%.c
422 @($(LHEAD) $(LINT.c) $< $(LTAIL))
424 $(LINTS_DIR)/%.ln: $(SRC)/common/dis/i386/%.c
425 @($(LHEAD) $(LINT.c) $< $(LTAIL))
427 $(LINTS_DIR)/%.ln: $(SRC)/common/atomic/%.c
428 @($(LHEAD) $(LINT.c) $< $(LTAIL))
430 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/gfx_private/%.c
431 @($(LHEAD) $(LINT.c) $< $(LTAIL))
433 $(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/xsvc/%.c
434 @($(LHEAD) $(LINT.c) $< $(LTAIL))
436 $(LINTS_DIR)/%.ln: $(UTSBASE)/common/xen/os/%.c
437 @($(LHEAD) $(LINT.c) $< $(LTAIL))
440 # bios call has a funky name change while building
442 $(LINTS_DIR)/bios_call.ln: $(UTSBASE)/i86pc/ml/bios_call_src.s
443 @($(LHEAD) $(LINT.s) $(UTSBASE)/i86pc/ml/bios_call_src.s $(LTAIL))
444 @mv $(LINTS_DIR)/bios_call_src.ln $(LINTS_DIR)/bios_call.ln
449 $(LINTS_DIR)/fb_swtch.ln: $(UTSBASE)/i86pc/ml/fb_swtch_src.s
450 @($(LHEAD) $(LINT.s) $(UTSBASE)/i86pc/ml/fb_swtch_src.s $(LTAIL))
451 @mv $(LINTS_DIR)/fb_swtch_src.ln $(LINTS_DIR)/fb_swtch.ln
454 # dboot always compiles in 32-bit mode, so force lint to be 32-bit mode too.
456 $(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/dboot/%.c
457 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
459 $(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/dboot/%.s
460 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
462 $(DBOOT_LINTS_DIR)/%.ln: $(COMMONBASE)/crypto/sha1/%.c
463 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
465 $(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/boot/%.c
466 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
468 $(DBOOT_LINTS_DIR)/%.ln: $(COMMONBASE)/util/%.c
469 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))
471 $(DBOOT_LINTS_DIR)/%.ln: $(COMMONBASE)/util/i386/%.s
472 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL))