1# 2# CDDL HEADER START 3# 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. 7# 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. 12# 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] 18# 19# CDDL HEADER END 20# 21 22# 23# Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved. 24# Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com> 25# Copyright 2019 OmniOS Community Edition (OmniOSce) Association. 26# 27 28# This Makefile defines the build rules for the directory uts/i86pc 29# and its children. These are the source files which are i86pc 30# "implementation architecture" dependent. 31# 32# The following two-level ordering must be maintained in this file. 33# Lines are sorted first in order of decreasing specificity based on 34# the first directory component. That is, i86pc rules come before 35# intel rules come before common rules. 36# 37# Lines whose initial directory components are equal are sorted 38# alphabetically by the remaining components. 39 40# 41# Section 1a: C object build rules 42# 43$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/conf/%.c 44 $(COMPILE.c) -o $@ $< 45 $(CTFCONVERT_O) 46 47$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/amd_opteron/%.c 48 $(COMPILE.c) -o $@ $< 49 $(CTFCONVERT_O) 50 51$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/authenticamd/%.c 52 $(COMPILE.c) -o $@ $< 53 $(CTFCONVERT_O) 54 55$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/generic_cpu/%.c 56 $(COMPILE.c) -o $@ $< 57 $(CTFCONVERT_O) 58 59$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/genuineintel/%.c 60 $(COMPILE.c) -o $@ $< 61 $(CTFCONVERT_O) 62 63$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/%.c 64 $(COMPILE.c) -o $@ $< 65 $(CTFCONVERT_O) 66 67$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi_drv/%.c 68 $(COMPILE.c) -o $@ $< 69 $(CTFCONVERT_O) 70 71$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/fipe/%.c 72 $(COMPILE.c) -o $@ $< 73 $(CTFCONVERT_O) 74 75$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi/acpidev/%.c 76 $(COMPILE.c) -o $@ $< 77 $(CTFCONVERT_O) 78 79$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi/acpinex/%.c 80 $(COMPILE.c) -o $@ $< 81 $(CTFCONVERT_O) 82 83SBD_IOCTL = $(UTSBASE)/i86pc/sys/sbd_ioctl.h 84DRMACH_IO = $(UTSBASE)/i86pc/io/acpi/drmach_acpi 85DRMACH_GENERR = $(DRMACH_IO)/sbdgenerr 86DR_IO = $(UTSBASE)/i86pc/io/dr 87DR_GENERR = $(DR_IO)/sbdgenerr 88 89$(DRMACH_GENERR): $(DR_IO)/sbdgenerr.pl 90 $(RM) $@ 91 $(CAT) $(DR_IO)/sbdgenerr.pl > $@ 92 $(CHMOD) +x $@ 93 94$(DRMACH_IO)/drmach_err.c: $(DRMACH_GENERR) $(SBD_IOCTL) 95 $(RM) $@ 96 $(DRMACH_GENERR) EX86 < $(SBD_IOCTL) > $(DRMACH_IO)/drmach_err.c 97 98$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi/drmach_acpi/%.c 99 $(COMPILE.c) -o $@ $< 100 $(CTFCONVERT_O) 101 102$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/amd_iommu/%.c 103 $(COMPILE.c) -o $@ $< 104 $(CTFCONVERT_O) 105 106$(DR_GENERR): $(DR_IO)/sbdgenerr.pl 107 $(RM) $@ 108 $(CAT) $(DR_IO)/sbdgenerr.pl > $@ 109 $(CHMOD) +x $@ 110 111$(DR_IO)/dr_err.c: $(DR_GENERR) $(SBD_IOCTL) 112 $(RM) $@ 113 $(DR_GENERR) ESBD < $(SBD_IOCTL) > $(DR_IO)/dr_err.c 114 115$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/dr/%.c 116 $(COMPILE.c) -o $@ $< 117 $(CTFCONVERT_O) 118 119$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ioat/%.c 120 $(COMPILE.c) -o $@ $< 121 $(CTFCONVERT_O) 122 123$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pci/%.c 124 $(COMPILE.c) -o $@ $< 125 $(CTFCONVERT_O) 126 127$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pciex/%.c 128 $(COMPILE.c) -o $@ $< 129 $(CTFCONVERT_O) 130 131$(OBJS_DIR)/%.o: $(UTSBASE)/intel/io/pciex/hotplug/%.c 132 $(COMPILE.c) -o $@ $< 133 $(CTFCONVERT_O) 134 135$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pcplusmp/%.c 136 $(COMPILE.c) -o $@ $< 137 $(CTFCONVERT_O) 138 139$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pcplusmp/%.s 140 $(COMPILE.s) -o $@ $< 141 142$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/apix/%.c 143 $(COMPILE.c) -o $@ $< 144 $(CTFCONVERT_O) 145 146$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ppm/%.c 147 $(COMPILE.c) -o $@ $< 148 $(CTFCONVERT_O) 149 150$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ppm/%.s 151 $(COMPILE.s) -o $@ $< 152 153$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/psm/%.c 154 $(COMPILE.c) -o $@ $< 155 $(CTFCONVERT_O) 156 157$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/psm/%.s 158 $(COMPILE.s) -o $@ $< 159 160$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/tzmon/%.c 161 $(COMPILE.c) -o $@ $< 162 $(CTFCONVERT_O) 163 164$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/ml/%.s 165 $(COMPILE.s) -o $@ $< 166 167$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/os/%.c 168 $(COMPILE.c) -_gcc=-fno-stack-protector -o $@ $< 169 $(CTFCONVERT_O) 170 171$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/os/cpupm/%.c 172 $(COMPILE.c) -o $@ $< 173 $(CTFCONVERT_O) 174 175$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/boot/%.c 176 $(COMPILE.c) -o $@ $< 177 $(CTFCONVERT_O) 178 179$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/vm/%.c 180 $(COMPILE.c) -o $@ $< 181 $(CTFCONVERT_O) 182 183$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/%.c 184 $(COMPILE.c) -o $@ $< 185 $(CTFCONVERT_O) 186 187$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/ppm/%.c 188 $(COMPILE.c) -o $@ $< 189 $(CTFCONVERT_O) 190 191$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/pciex/%.c 192 $(COMPILE.c) -o $@ $< 193 $(CTFCONVERT_O) 194 195$(OBJS_DIR)/%.o: $(UTSBASE)/common/os/%.c 196 $(COMPILE.c) -o $@ $< 197 $(CTFCONVERT_O) 198 199$(OBJS_DIR)/%.o: $(SRC)/common/dis/i386/%.c 200 $(COMPILE.c) -o $@ $< 201 $(CTFCONVERT_O) 202 203$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/gfx_private/%.c 204 $(COMPILE.c) -o $@ $< 205 $(CTFCONVERT_O) 206 207$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/xsvc/%.c 208 $(COMPILE.c) -o $@ $< 209 $(CTFCONVERT_O) 210 211$(OBJS_DIR)/%.o: $(UTSBASE)/common/xen/os/%.c 212 $(COMPILE.c) -o $@ $< 213 $(CTFCONVERT_O) 214 215$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/dboot/%.c 216 $(COMPILE.c) -o $@ $< 217 $(CTFCONVERT_O) 218 219# 220# dboot stuff is always 32 bit, linked to run with phys_addr == virt_addr 221# 222DBOOT_OBJS_DIR = dboot/$(OBJS_DIR) 223DBOOT_MACH_32 = -D_BOOT_TARGET_i386 224DBOOT_MACH_64 = -D_BOOT_TARGET_amd64 225DBOOT_DEFS = -D_BOOT $(DBOOT_MACH_$(CLASS)) 226DBOOT_DEFS += -D_MACHDEP -U_KERNEL -D_I32LPx 227DBOOT_FLAGS = $(CCVERBOSE) $(CSTD) $(CERRWARN) $(CCNOAUTOINLINE) 228 229DBOOT_CC_INCL = -I$(SRC)/common -I$(SRC)/common/util $(INCLUDE_PATH) 230DBOOT_AS_INCL = $(AS_INC_PATH) 231 232DBOOT_AS = $(ONBLD_TOOLS)/bin/$(MACH)/aw 233 234$(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/boot/%.c 235 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 236 237$(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/dboot/%.c 238 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 239 240$(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/intel/ia32/%.s 241 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $< 242 243$(DBOOT_OBJS_DIR)/%.o: $(SRC)/common/font/%.c 244 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 245 246$(DBOOT_OBJS_DIR)/$(FONT).c: $(FONT_DIR)/$(FONT_SRC).bdf 247 $(VTFONTCVT) -f source -o $@ $(FONT_DIR)/$(FONT_SRC).bdf 248 249$(DBOOT_OBJS_DIR)/%.o: $(DBOOT_OBJS_DIR)/%.c 250 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 251 252$(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/crypto/sha1/%.c 253 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 254 255$(DBOOT_OBJS_DIR)/%.o: $(DBOOT_OBJS_DIR)/%.c 256 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 257 258$(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/util/%.c 259 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 260 261$(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/util/i386/%.s 262 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $< 263 264$(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/dboot/%.s 265 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $< 266 267# 268# Stuff to build bios_call.o for the kernel. 269# 270MAPFILE_BIOS = $(UTSBASE)/i86pc/conf/Mapfile.bios 271$(OBJS_DIR)/bios_call.o: $(UTSBASE)/i86pc/ml/bios_call_src.s 272 $(COMPILE.s) -o $(OBJS_DIR)/bios_call_src.o \ 273 $(UTSBASE)/i86pc/ml/bios_call_src.s 274 $(LD) -dn -M $(MAPFILE_BIOS) \ 275 -o $(OBJS_DIR)/bios_call_src $(OBJS_DIR)/bios_call_src.o 276 @echo " .data" > $(OBJS_DIR)/bios_call.s 277 @echo " .globl bios_image" >> $(OBJS_DIR)/bios_call.s 278 @echo "bios_image:" >> $(OBJS_DIR)/bios_call.s 279 $(ELFEXTRACT) $(OBJS_DIR)/bios_call_src >> $(OBJS_DIR)/bios_call.s 280 @echo " .align 4" >> $(OBJS_DIR)/bios_call.s 281 @echo " .globl bios_size" >> $(OBJS_DIR)/bios_call.s 282 @echo "bios_size:" >> $(OBJS_DIR)/bios_call.s 283 @echo " .long . - bios_image" >> $(OBJS_DIR)/bios_call.s 284 $(COMPILE.s) -o $@ $(OBJS_DIR)/bios_call.s 285 286# 287# Stuff to build fb_swtch.o for the kernel. 288# 289MAPFILE_FBSWTCH = $(UTSBASE)/i86pc/conf/Mapfile.fb_swtch 290$(OBJS_DIR)/fb_swtch.o: $(UTSBASE)/i86pc/ml/fb_swtch_src.s 291 $(COMPILE.s) -o $(OBJS_DIR)/fb_swtch_src.o \ 292 $(UTSBASE)/i86pc/ml/fb_swtch_src.s 293 $(LD) -dn -M $(MAPFILE_FBSWTCH) \ 294 -o $(OBJS_DIR)/fb_swtch_src $(OBJS_DIR)/fb_swtch_src.o 295 @echo " .data" > $(OBJS_DIR)/fb_swtch.s 296 @echo " .globl fb_swtch_image" >> $(OBJS_DIR)/fb_swtch.s 297 @echo "fb_swtch_image:" >> $(OBJS_DIR)/fb_swtch.s 298 $(ELFEXTRACT) $(OBJS_DIR)/fb_swtch_src >> $(OBJS_DIR)/fb_swtch.s 299 @echo " .align 4" >> $(OBJS_DIR)/fb_swtch.s 300 @echo " .globl fb_swtch_size" >> $(OBJS_DIR)/fb_swtch.s 301 @echo "fb_swtch_size:" >> $(OBJS_DIR)/fb_swtch.s 302 @echo " .long . - fb_swtch_image" >> $(OBJS_DIR)/fb_swtch.s 303 $(COMPILE.s) -o $@ $(OBJS_DIR)/fb_swtch.s 304 305# ridiculous contortions --- 306ATOMIC_SUBDIR_32 = i386 307ATOMIC_SUBDIR_64 = amd64 308ATOMIC_SUBDIR = $(ATOMIC_SUBDIR_$(CLASS)) 309 310$(OBJS_DIR)/%.o: $(SRC)/common/atomic/$(ATOMIC_SUBDIR)/%.s 311 $(COMPILE.s) -o $@ $< 312 313# 314# dtrace stubs 315# 316 317$(OBJS_DIR)/dtracestubs.s: $(UNIX_O) $(LIBS) 318 $(NM) -u $(UNIX_O) $(LIBS) | $(GREP) __dtrace_probe_ | $(SORT) | \ 319 $(UNIQ) | $(AWK) '{ \ 320 printf("\t.globl %s\n\t.type %s,@function\n%s:\n", \ 321 $$1, $$1, $$1); }' > $(OBJS_DIR)/dtracestubs.s 322 323$(DTRACESTUBS): $(DTRACESTUBS_O) 324 $(BUILD.SO) $(DTRACESTUBS_O) 325