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.
24 # Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
27 # This Makefile defines the build rules for the directory uts/i86pc
28 # and its children. These are the source files which are i86pc
29 # "implementation architecture" dependent.
31 # The following two-level ordering must be maintained in this file.
32 # Lines are sorted first in order of decreasing specificity based on
33 # the first directory component. That is, i86pc rules come before
34 # intel rules come before common rules.
36 # Lines whose initial directory components are equal are sorted
37 # alphabetically by the remaining components.
40 # Section 1: C object build rules
42 $(OBJS_DIR)/%.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/conf/%.c
46 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/amd_opteron/%.c
50 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/authenticamd/%.c
54 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/generic_cpu/%.c
58 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/genuineintel/%.c
62 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/%.c
66 $(OBJS_DIR)/%.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/io/%.c
70 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi_drv/%.c
74 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/fipe/%.c
78 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi/acpidev/%.c
82 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi/acpinex/%.c
86 SBD_IOCTL = $(SRCTOP)/arch/x86/kernel/platform/i86pc/include/sys/sbd_ioctl.h
87 DRMACH_IO = $(UTSBASE)/i86pc/io/acpi/drmach_acpi
88 DRMACH_GENERR = $(DRMACH_IO)/sbdgenerr
89 DR_IO = $(UTSBASE)/i86pc/io/dr
90 DR_GENERR = $(DR_IO)/sbdgenerr
92 $(DRMACH_GENERR): $(DR_IO)/sbdgenerr.pl
94 $(CAT) $(DR_IO)/sbdgenerr.pl > $@
97 $(DRMACH_IO)/drmach_err.c: $(DRMACH_GENERR) $(SBD_IOCTL)
99 $(DRMACH_GENERR) EX86 < $(SBD_IOCTL) > $(DRMACH_IO)/drmach_err.c
101 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi/drmach_acpi/%.c
102 $(COMPILE.c) -o $@ $<
105 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/amd_iommu/%.c
106 $(COMPILE.c) -o $@ $<
109 $(DR_GENERR): $(DR_IO)/sbdgenerr.pl
111 $(CAT) $(DR_IO)/sbdgenerr.pl > $@
114 $(DR_IO)/dr_err.c: $(DR_GENERR) $(SBD_IOCTL)
116 $(DR_GENERR) ESBD < $(SBD_IOCTL) > $(DR_IO)/dr_err.c
118 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/dr/%.c
119 $(COMPILE.c) -o $@ $<
122 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ioat/%.c
123 $(COMPILE.c) -o $@ $<
126 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pci/%.c
127 $(COMPILE.c) -o $@ $<
130 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pciex/%.c
131 $(COMPILE.c) -o $@ $<
134 $(OBJS_DIR)/%.o: $(UTSBASE)/intel/io/pciex/hotplug/%.c
135 $(COMPILE.c) -o $@ $<
138 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pcplusmp/%.c
139 $(COMPILE.c) -o $@ $<
142 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pcplusmp/%.s
143 $(COMPILE.s) -o $@ $<
145 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/apix/%.c
146 $(COMPILE.c) -o $@ $<
149 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ppm/%.c
150 $(COMPILE.c) -o $@ $<
153 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ppm/%.s
154 $(COMPILE.s) -o $@ $<
156 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/psm/%.c
157 $(COMPILE.c) -o $@ $<
160 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/psm/%.s
161 $(COMPILE.s) -o $@ $<
163 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/tzmon/%.c
164 $(COMPILE.c) -o $@ $<
167 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/ml/%.s
168 $(COMPILE.s) -o $@ $<
170 $(OBJS_DIR)/%.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/ml/%.s
171 $(COMPILE.s) -o $@ $<
173 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/os/%.c
174 $(COMPILE.c) -fno-stack-protector -o $@ $<
177 $(OBJS_DIR)/%.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/os/%.c
178 $(COMPILE.c) -fno-stack-protector -o $@ $<
181 $(OBJS_DIR)/%.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/os/cpupm/%.c
182 $(COMPILE.c) -o $@ $<
185 $(OBJS_DIR)/%.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/boot/%.c
186 $(COMPILE.c) -o $@ $<
189 $(OBJS_DIR)/%.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/vm/%.c
190 $(COMPILE.c) -o $@ $<
193 $(OBJS_DIR)/%.o: $(UTSBASE)/common/io/%.c
194 $(COMPILE.c) -o $@ $<
197 $(OBJS_DIR)/%.o: $(UTSBASE)/common/io/ppm/%.c
198 $(COMPILE.c) -o $@ $<
201 $(OBJS_DIR)/%.o: $(UTSBASE)/common/io/pciex/%.c
202 $(COMPILE.c) -o $@ $<
205 $(OBJS_DIR)/%.o: $(SRCTOP)/kernel/os/%.c
206 $(COMPILE.c) -o $@ $<
209 $(OBJS_DIR)/%.o: $(SRC)/common/dis/i386/%.c
210 $(COMPILE.c) -o $@ $<
213 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/gfx_private/%.c
214 $(COMPILE.c) -o $@ $<
217 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/xsvc/%.c
218 $(COMPILE.c) -o $@ $<
221 $(OBJS_DIR)/%.o: $(SRCTOP)/arch/x86/kernel/xen/os/%.c
222 $(COMPILE.c) -o $@ $<
225 $(OBJS_DIR)/%.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/dboot/%.c
226 $(COMPILE.c) -o $@ $<
230 # dboot stuff is always 32 bit, linked to run with phys_addr == virt_addr
232 DBOOT_OBJS_DIR = dboot/$(OBJS_DIR)
233 DBOOT_MACH_32 = -D_BOOT_TARGET_i386
234 DBOOT_MACH_64 = -D_BOOT_TARGET_amd64
235 DBOOT_DEFS = -D_BOOT $(DBOOT_MACH_$(CLASS))
236 DBOOT_DEFS += -D_MACHDEP -D_KMEMUSER -U_KERNEL -D_I32LPx
237 DBOOT_FLAGS = $(C99MODE) $(CERRWARN) $(CCNOAUTOINLINE)
239 DBOOT_CC_INCL = -I$(SRC)/common -I$(SRC)/common/util $(INCLUDE_PATH) \
240 -I$(SRCTOP)/arch/x86/kernel/platform/i86pc/dboot
241 DBOOT_AS_INCL = $(AS_INC_PATH)
243 DBOOT_AS = $($(MACH)_AS)
245 $(DBOOT_OBJS_DIR)/%.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/boot/%.c
246 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
248 $(DBOOT_OBJS_DIR)/%.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/dboot/%.c
249 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
251 $(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/intel/ia32/%.s
252 $(DBOOT_AS) -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
254 $(DBOOT_OBJS_DIR)/%.o: $(SRCTOP)/kernel/font/%.c
255 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
257 $(DBOOT_OBJS_DIR)/$(VGATEXT_FONT).c: \
258 $(VGATEXT_FONT_DIR)/$(VGATEXT_FONT_SRC).bdf \
259 $(SRCTOP)/tools/bdf_to_c.awk
260 $(AWK) -f $(SRCTOP)/tools/bdf_to_c.awk \
261 $(VGATEXT_FONT_DIR)/$(VGATEXT_FONT_SRC).bdf > $@
263 $(DBOOT_OBJS_DIR)/%.o: $(DBOOT_OBJS_DIR)/%.c
264 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
266 $(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/crypto/sha1/%.c
267 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
269 $(DBOOT_OBJS_DIR)/%.o: $(DBOOT_OBJS_DIR)/%.c
270 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
272 $(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/util/%.c
273 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
275 $(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/util/i386/%.s
276 $(DBOOT_AS) -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
278 $(DBOOT_OBJS_DIR)/%.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/dboot/%.s
279 $(DBOOT_AS) -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
282 # Stuff to build bios_call.o for the kernel.
284 MAPFILE_BIOS = $(SRCTOP)/arch/x86/kernel/platform/i86pc/boot/mapfile-bios
285 $(OBJS_DIR)/bios_call.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/boot/bios_call_src.s
286 $(COMPILE.s) -o $(OBJS_DIR)/bios_call_src.o \
287 $(SRCTOP)/arch/x86/kernel/platform/i86pc/boot/bios_call_src.s
288 $(LD) -dn -M $(MAPFILE_BIOS) \
289 -o $(OBJS_DIR)/bios_call_src $(OBJS_DIR)/bios_call_src.o
290 @echo " .data" > $(OBJS_DIR)/bios_call.s
291 @echo " .globl bios_image" >> $(OBJS_DIR)/bios_call.s
292 @echo "bios_image:" >> $(OBJS_DIR)/bios_call.s
293 $(ELFEXTRACT) $(OBJS_DIR)/bios_call_src >> $(OBJS_DIR)/bios_call.s
294 @echo " .align 4" >> $(OBJS_DIR)/bios_call.s
295 @echo " .globl bios_size" >> $(OBJS_DIR)/bios_call.s
296 @echo "bios_size:" >> $(OBJS_DIR)/bios_call.s
297 @echo " .long . - bios_image" >> $(OBJS_DIR)/bios_call.s
298 $(COMPILE.s) -o $@ $(OBJS_DIR)/bios_call.s
301 # Stuff to build fb_swtch.o for the kernel.
303 MAPFILE_FBSWTCH = $(SRCTOP)/arch/x86/kernel/platform/i86pc/boot/mapfile-fb_swtch
304 $(OBJS_DIR)/fb_swtch.o: $(SRCTOP)/arch/x86/kernel/platform/i86pc/boot/fb_swtch_src.s
305 $(COMPILE.s) -o $(OBJS_DIR)/fb_swtch_src.o \
306 $(SRCTOP)/arch/x86/kernel/platform/i86pc/boot/fb_swtch_src.s
307 $(LD) -dn -M $(MAPFILE_FBSWTCH) \
308 -o $(OBJS_DIR)/fb_swtch_src $(OBJS_DIR)/fb_swtch_src.o
309 @echo " .data" > $(OBJS_DIR)/fb_swtch.s
310 @echo " .globl fb_swtch_image" >> $(OBJS_DIR)/fb_swtch.s
311 @echo "fb_swtch_image:" >> $(OBJS_DIR)/fb_swtch.s
312 $(ELFEXTRACT) $(OBJS_DIR)/fb_swtch_src >> $(OBJS_DIR)/fb_swtch.s
313 @echo " .align 4" >> $(OBJS_DIR)/fb_swtch.s
314 @echo " .globl fb_swtch_size" >> $(OBJS_DIR)/fb_swtch.s
315 @echo "fb_swtch_size:" >> $(OBJS_DIR)/fb_swtch.s
316 @echo " .long . - fb_swtch_image" >> $(OBJS_DIR)/fb_swtch.s
317 $(COMPILE.s) -o $@ $(OBJS_DIR)/fb_swtch.s
319 # ridiculous contortions ---
320 ATOMIC_SUBDIR_32 = i386
321 ATOMIC_SUBDIR_64 = amd64
322 ATOMIC_SUBDIR = $(ATOMIC_SUBDIR_$(CLASS))
324 $(OBJS_DIR)/%.o: $(SRC)/common/atomic/$(ATOMIC_SUBDIR)/%.s
325 $(COMPILE.s) -o $@ $<
331 $(OBJS_DIR)/dtracestubs.s: $(UNIX_O) $(LIBS)
332 $(NM) -Pu $(UNIX_O) $(LIBS) | $(GREP) __dtrace_probe_ | $(SORT) | \
333 $(UNIQ) | $(AWK) '{ \
334 printf("\t.globl %s\n\t.type %s,@function\n%s:\n", \
335 $$1, $$1, $$1); }' > $(OBJS_DIR)/dtracestubs.s
337 $(DTRACESTUBS): $(DTRACESTUBS_O)
338 $(BUILD.SO) $(DTRACESTUBS_O)