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 2008 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26# ident "%Z%%M% %I% %E% SMI" 27# 28 29# This Makefile defines the build rules for the directory uts/i86pc 30# and its children. These are the source files which are i86pc 31# "implementation architecture" dependent. 32# 33# The following two-level ordering must be maintained in this file. 34# Lines are sorted first in order of decreasing specificity based on 35# the first directory component. That is, i86pc rules come before 36# intel rules come before common rules. 37# 38# Lines whose initial directory components are equal are sorted 39# alphabetically by the remaining components. 40 41# 42# Section 1a: C object build rules 43# 44$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/conf/%.c 45 $(COMPILE.c) -o $@ $< 46 $(CTFCONVERT_O) 47 48$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/amd_opteron/%.c 49 $(COMPILE.c) -o $@ $< 50 $(CTFCONVERT_O) 51 52$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/authenticamd/%.c 53 $(COMPILE.c) -o $@ $< 54 $(CTFCONVERT_O) 55 56$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/generic_cpu/%.c 57 $(COMPILE.c) -o $@ $< 58 $(CTFCONVERT_O) 59 60$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/genuineintel/%.c 61 $(COMPILE.c) -o $@ $< 62 $(CTFCONVERT_O) 63 64$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/intel_nb5000/%.c 65 $(COMPILE.c) -o $@ $< 66 $(CTFCONVERT_O) 67 68$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/%.c 69 $(COMPILE.c) -o $@ $< 70 $(CTFCONVERT_O) 71 72$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi_drv/%.c 73 $(COMPILE.c) -o $@ $< 74 $(CTFCONVERT_O) 75 76$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ioat/%.c 77 $(COMPILE.c) -o $@ $< 78 $(CTFCONVERT_O) 79 80$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/mc/%.c 81 $(COMPILE.c) -o $@ $< 82 $(CTFCONVERT_O) 83 84$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pci/%.c 85 $(COMPILE.c) -o $@ $< 86 $(CTFCONVERT_O) 87 88$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pciex/%.c 89 $(COMPILE.c) -o $@ $< 90 $(CTFCONVERT_O) 91 92$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pcplusmp/%.c 93 $(COMPILE.c) -o $@ $< 94 $(CTFCONVERT_O) 95 96$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pcplusmp/%.s 97 $(COMPILE.s) -o $@ $< 98 99$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ppm/%.c 100 $(COMPILE.c) -o $@ $< 101 $(CTFCONVERT_O) 102 103$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ppm/%.s 104 $(COMPILE.s) -o $@ $< 105 106$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/psm/%.c 107 $(COMPILE.c) -o $@ $< 108 $(CTFCONVERT_O) 109 110$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/psm/%.s 111 $(COMPILE.s) -o $@ $< 112 113$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/tzmon/%.c 114 $(COMPILE.c) -o $@ $< 115 $(CTFCONVERT_O) 116 117$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/ml/%.s 118 $(COMPILE.s) -o $@ $< 119 120$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/os/%.c 121 $(COMPILE.c) -o $@ $< 122 $(CTFCONVERT_O) 123 124$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/boot/%.c 125 $(COMPILE.c) -o $@ $< 126 $(CTFCONVERT_O) 127 128$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/vm/%.c 129 $(COMPILE.c) -o $@ $< 130 $(CTFCONVERT_O) 131 132$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/%.c 133 $(COMPILE.c) -o $@ $< 134 $(CTFCONVERT_O) 135 136$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/ppm/%.c 137 $(COMPILE.c) -o $@ $< 138 $(CTFCONVERT_O) 139 140$(OBJS_DIR)/%.o: $(UTSBASE)/common/os/%.c 141 $(COMPILE.c) -o $@ $< 142 $(CTFCONVERT_O) 143 144$(OBJS_DIR)/%.o: $(SRC)/common/dis/i386/%.c 145 $(COMPILE.c) -o $@ $< 146 $(CTFCONVERT_O) 147 148$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/gfx_private/%.c 149 $(COMPILE.c) -o $@ $< 150 $(CTFCONVERT_O) 151 152$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/xsvc/%.c 153 $(COMPILE.c) -o $@ $< 154 $(CTFCONVERT_O) 155 156# 157# dboot stuff is always 32 bit, linked to run with phys_addr == virt_addr 158# 159DBOOT_OBJS_DIR = dboot/$(OBJS_DIR) 160DBOOT_MACH_32 = -D_BOOT_TARGET_i386 161DBOOT_MACH_64 = -D_BOOT_TARGET_amd64 162DBOOT_DEFS = -D_BOOT $(DBOOT_MACH_$(CLASS)) 163DBOOT_DEFS += -D_MACHDEP -D_KMEMUSER -U_KERNEL -D_I32LPx 164 165DBOOT_CC_INCL = -I$(SRC)/common $(INCLUDE_PATH) 166DBOOT_AS_INCL = $(AS_INC_PATH) 167 168DBOOT_AS = $(ONBLD_TOOLS)/bin/$(MACH)/aw 169 170DBOOT_LINTS_DIR = $(DBOOT_OBJS_DIR) 171DBOOT_LINTFLAGS_i86pc = $(LINTFLAGS_i386_32) $(LINTTAGS_i386_32) 172 173DBOOT_LINTFLAGS = $(DBOOT_LINTFLAGS_$(PLATFORM)) $(LINTTAGS) $(C99LMODE) \ 174 $(CPPFLAGS) $(DBOOT_DEFS) 175DBOOT_LOCAL_LINTFLAGS = -c -dirout=$(DBOOT_LINTS_DIR) -I$(SRC)/common \ 176 $(DBOOT_LINTFLAGS) $(DBOOT_LINTTAGS) 177 178$(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/boot/%.c 179 $(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 180 181$(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/dboot/%.c 182 $(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 183 184$(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/intel/ia32/%.s 185 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $< 186 187$(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/util/%.c 188 $(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 189 190$(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/util/i386/%.s 191 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $< 192 193$(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/dboot/%.s 194 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $< 195 196# 197# Stuff to build bios_call.o for the kernel. 198# 199MAPFILE_BIOS = $(UTSBASE)/i86pc/conf/Mapfile.bios 200$(OBJS_DIR)/bios_call.o: $(UTSBASE)/i86pc/ml/bios_call_src.s 201 $(COMPILE.s) -o $(OBJS_DIR)/bios_call_src.o \ 202 $(UTSBASE)/i86pc/ml/bios_call_src.s 203 $(LD) -dn -M $(MAPFILE_BIOS) \ 204 -o $(OBJS_DIR)/bios_call_src $(OBJS_DIR)/bios_call_src.o 205 @echo " .data" > $(OBJS_DIR)/bios_call.s 206 @echo " .globl bios_image" >> $(OBJS_DIR)/bios_call.s 207 @echo "bios_image:" >> $(OBJS_DIR)/bios_call.s 208 $(ELFEXTRACT) $(OBJS_DIR)/bios_call_src >> $(OBJS_DIR)/bios_call.s 209 @echo " .align 4" >> $(OBJS_DIR)/bios_call.s 210 @echo " .globl bios_size" >> $(OBJS_DIR)/bios_call.s 211 @echo "bios_size:" >> $(OBJS_DIR)/bios_call.s 212 @echo " .long . - bios_image" >> $(OBJS_DIR)/bios_call.s 213 $(COMPILE.s) -o $@ $(OBJS_DIR)/bios_call.s 214 215# ridiculous contortions --- 216ATOMIC_SUBDIR_32 = i386 217ATOMIC_SUBDIR_64 = amd64 218ATOMIC_SUBDIR = $(ATOMIC_SUBDIR_$(CLASS)) 219 220$(OBJS_DIR)/%.o: $(SRC)/common/atomic/$(ATOMIC_SUBDIR)/%.s 221 $(COMPILE.s) -o $@ $< 222 223$(OBJS_DIR)/%.o: $(SRC)/common/mc/mc-amd/%.c 224 $(COMPILE.c) -o $@ $< 225 $(CTFCONVERT_O) 226 227# 228# dtrace stubs 229# 230 231$(OBJS_DIR)/dtracestubs.s: $(UNIX_O) $(LIBS) 232 nm -u $(UNIX_O) $(LIBS) | grep __dtrace_probe_ | sort | uniq | nawk '{ \ 233 printf("\t.globl %s\n\t.type %s,@function\n%s:\n", \ 234 $$1, $$1, $$1); }' > $(OBJS_DIR)/dtracestubs.s 235 236$(DTRACESTUBS): $(DTRACESTUBS_O) 237 $(BUILD.SO) $(DTRACESTUBS_O) 238 239# 240# Section 1b: Lint `object' build rules 241# 242$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/conf/%.c 243 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 244 245$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/cpu/amd_opteron/%.c 246 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 247 248$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/cpu/authenticamd/%.c 249 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 250 251$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/cpu/generic_cpu/%.c 252 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 253 254$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/cpu/genuineintel/%.c 255 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 256 257$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/intel_nb5000/%.c 258 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 259 260$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/%.c 261 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 262 263$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/acpi_drv/%.c 264 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 265 266$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/ioat/%.c 267 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 268 269$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/mc/%.c 270 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 271 272$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/pci/%.c 273 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 274 275$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/pciex/%.c 276 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 277 278$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/pcplusmp/%.c 279 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 280 281$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/pcplusmp/%.s 282 @($(LHEAD) $(LINT.s) $< $(LTAIL)) 283 284$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/ppm/%.c 285 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 286 287$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/ppm/%.s 288 @($(LHEAD) $(LINT.s) $< $(LTAIL)) 289 290$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/psm/%.c 291 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 292 293$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/psm/%.s 294 @($(LHEAD) $(LINT.s) $< $(LTAIL)) 295 296$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/tzmon/%.c 297 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 298 299$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/ml/%.s 300 @($(LHEAD) $(LINT.s) $< $(LTAIL)) 301 302$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/os/%.c 303 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 304 305$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/boot/%.c 306 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 307 308$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/vm/%.c 309 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 310 311$(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/%.c 312 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 313 314$(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/ppm/%.c 315 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 316 317$(LINTS_DIR)/%.ln: $(UTSBASE)/common/os/%.c 318 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 319 320$(LINTS_DIR)/%.ln: $(SRC)/common/dis/i386/%.c 321 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 322 323$(LINTS_DIR)/%.ln: $(SRC)/common/atomic/%.c 324 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 325 326$(LINTS_DIR)/%.ln: $(SRC)/common/mc/mc-amd/%.c 327 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 328 329$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/gfx_private/%.c 330 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 331 332$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/xsvc/%.c 333 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 334 335# 336# bios call has a funky name change while building 337# 338$(LINTS_DIR)/bios_call.ln: $(UTSBASE)/i86pc/ml/bios_call_src.s 339 @($(LHEAD) $(LINT.s) $(UTSBASE)/i86pc/ml/bios_call_src.s $(LTAIL)) 340 @mv $(LINTS_DIR)/bios_call_src.ln $(LINTS_DIR)/bios_call.ln 341 342# 343# dboot always compiles in 32-bit mode, so force lint to be 32-bit mode too. 344# 345$(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/dboot/%.c 346 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL)) 347 348$(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/dboot/%.s 349 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL)) 350 351$(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/boot/%.c 352 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL)) 353 354$(DBOOT_LINTS_DIR)/%.ln: $(COMMONBASE)/util/%.c 355 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL)) 356 357$(DBOOT_LINTS_DIR)/%.ln: $(COMMONBASE)/util/i386/%.s 358 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL)) 359