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/mc/%.c 77 $(COMPILE.c) -o $@ $< 78 $(CTFCONVERT_O) 79 80$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pci/%.c 81 $(COMPILE.c) -o $@ $< 82 $(CTFCONVERT_O) 83 84$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pciex/%.c 85 $(COMPILE.c) -o $@ $< 86 $(CTFCONVERT_O) 87 88$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pcplusmp/%.c 89 $(COMPILE.c) -o $@ $< 90 $(CTFCONVERT_O) 91 92$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pcplusmp/%.s 93 $(COMPILE.s) -o $@ $< 94 95$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ppm/%.c 96 $(COMPILE.c) -o $@ $< 97 $(CTFCONVERT_O) 98 99$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ppm/%.s 100 $(COMPILE.s) -o $@ $< 101 102$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/psm/%.c 103 $(COMPILE.c) -o $@ $< 104 $(CTFCONVERT_O) 105 106$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/psm/%.s 107 $(COMPILE.s) -o $@ $< 108 109$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/tzmon/%.c 110 $(COMPILE.c) -o $@ $< 111 $(CTFCONVERT_O) 112 113$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/ml/%.s 114 $(COMPILE.s) -o $@ $< 115 116$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/os/%.c 117 $(COMPILE.c) -o $@ $< 118 $(CTFCONVERT_O) 119 120$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/boot/%.c 121 $(COMPILE.c) -o $@ $< 122 $(CTFCONVERT_O) 123 124$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/vm/%.c 125 $(COMPILE.c) -o $@ $< 126 $(CTFCONVERT_O) 127 128$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/%.c 129 $(COMPILE.c) -o $@ $< 130 $(CTFCONVERT_O) 131 132$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/ppm/%.c 133 $(COMPILE.c) -o $@ $< 134 $(CTFCONVERT_O) 135 136$(OBJS_DIR)/%.o: $(UTSBASE)/common/os/%.c 137 $(COMPILE.c) -o $@ $< 138 $(CTFCONVERT_O) 139 140$(OBJS_DIR)/%.o: $(SRC)/common/dis/i386/%.c 141 $(COMPILE.c) -o $@ $< 142 $(CTFCONVERT_O) 143 144$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/gfx_private/%.c 145 $(COMPILE.c) -o $@ $< 146 $(CTFCONVERT_O) 147 148$(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/xsvc/%.c 149 $(COMPILE.c) -o $@ $< 150 $(CTFCONVERT_O) 151 152# 153# dboot stuff is always 32 bit, linked to run with phys_addr == virt_addr 154# 155DBOOT_OBJS_DIR = dboot/$(OBJS_DIR) 156DBOOT_MACH_32 = -D_BOOT_TARGET_i386 157DBOOT_MACH_64 = -D_BOOT_TARGET_amd64 158DBOOT_DEFS = -D_BOOT $(DBOOT_MACH_$(CLASS)) 159DBOOT_DEFS += -D_MACHDEP -D_KMEMUSER -U_KERNEL -D_I32LPx 160 161DBOOT_CC_INCL = -I$(SRC)/common $(INCLUDE_PATH) 162DBOOT_AS_INCL = $(AS_INC_PATH) 163 164DBOOT_AS = $(ONBLD_TOOLS)/bin/$(MACH)/aw 165 166DBOOT_LINTS_DIR = $(DBOOT_OBJS_DIR) 167DBOOT_LINTFLAGS_i86pc = $(LINTFLAGS_i386_32) $(LINTTAGS_i386_32) 168 169DBOOT_LINTFLAGS = $(DBOOT_LINTFLAGS_$(PLATFORM)) $(LINTTAGS) $(C99LMODE) \ 170 $(CPPFLAGS) $(DBOOT_DEFS) 171DBOOT_LOCAL_LINTFLAGS = -c -dirout=$(DBOOT_LINTS_DIR) -I$(SRC)/common \ 172 $(DBOOT_LINTFLAGS) $(DBOOT_LINTTAGS) 173 174$(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/boot/%.c 175 $(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 176 177$(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/dboot/%.c 178 $(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 179 180$(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/intel/ia32/%.s 181 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $< 182 183$(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/util/%.c 184 $(i386_CC) $(CERRWARN) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $< 185 186$(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/util/i386/%.s 187 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $< 188 189$(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/dboot/%.s 190 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $< 191 192# 193# Stuff to build bios_call.o for the kernel. 194# 195MAPFILE_BIOS = $(UTSBASE)/i86pc/conf/Mapfile.bios 196$(OBJS_DIR)/bios_call.o: $(UTSBASE)/i86pc/ml/bios_call_src.s 197 $(COMPILE.s) -o $(OBJS_DIR)/bios_call_src.o \ 198 $(UTSBASE)/i86pc/ml/bios_call_src.s 199 $(LD) -dn -M $(MAPFILE_BIOS) \ 200 -o $(OBJS_DIR)/bios_call_src $(OBJS_DIR)/bios_call_src.o 201 @echo " .data" > $(OBJS_DIR)/bios_call.s 202 @echo " .globl bios_image" >> $(OBJS_DIR)/bios_call.s 203 @echo "bios_image:" >> $(OBJS_DIR)/bios_call.s 204 $(ELFEXTRACT) $(OBJS_DIR)/bios_call_src >> $(OBJS_DIR)/bios_call.s 205 @echo " .align 4" >> $(OBJS_DIR)/bios_call.s 206 @echo " .globl bios_size" >> $(OBJS_DIR)/bios_call.s 207 @echo "bios_size:" >> $(OBJS_DIR)/bios_call.s 208 @echo " .long . - bios_image" >> $(OBJS_DIR)/bios_call.s 209 $(COMPILE.s) -o $@ $(OBJS_DIR)/bios_call.s 210 211# ridiculous contortions --- 212ATOMIC_SUBDIR_32 = i386 213ATOMIC_SUBDIR_64 = amd64 214ATOMIC_SUBDIR = $(ATOMIC_SUBDIR_$(CLASS)) 215 216$(OBJS_DIR)/%.o: $(SRC)/common/atomic/$(ATOMIC_SUBDIR)/%.s 217 $(COMPILE.s) -o $@ $< 218 219$(OBJS_DIR)/%.o: $(SRC)/common/mc/mc-amd/%.c 220 $(COMPILE.c) -o $@ $< 221 $(CTFCONVERT_O) 222 223# 224# dtrace stubs 225# 226 227$(OBJS_DIR)/dtracestubs.s: $(UNIX_O) $(LIBS) 228 nm -u $(UNIX_O) $(LIBS) | grep __dtrace_probe_ | sort | uniq | nawk '{ \ 229 printf("\t.globl %s\n\t.type %s,@function\n%s:\n", \ 230 $$1, $$1, $$1); }' > $(OBJS_DIR)/dtracestubs.s 231 232$(DTRACESTUBS): $(DTRACESTUBS_O) 233 $(BUILD.SO) $(DTRACESTUBS_O) 234 235# 236# Section 1b: Lint `object' build rules 237# 238$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/conf/%.c 239 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 240 241$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/cpu/amd_opteron/%.c 242 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 243 244$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/cpu/authenticamd/%.c 245 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 246 247$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/cpu/generic_cpu/%.c 248 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 249 250$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/cpu/genuineintel/%.c 251 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 252 253$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/intel_nb5000/%.c 254 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 255 256$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/%.c 257 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 258 259$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/acpi_drv/%.c 260 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 261 262$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/mc/%.c 263 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 264 265$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/pci/%.c 266 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 267 268$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/pciex/%.c 269 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 270 271$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/pcplusmp/%.c 272 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 273 274$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/pcplusmp/%.s 275 @($(LHEAD) $(LINT.s) $< $(LTAIL)) 276 277$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/ppm/%.c 278 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 279 280$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/ppm/%.s 281 @($(LHEAD) $(LINT.s) $< $(LTAIL)) 282 283$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/psm/%.c 284 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 285 286$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/psm/%.s 287 @($(LHEAD) $(LINT.s) $< $(LTAIL)) 288 289$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/tzmon/%.c 290 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 291 292$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/ml/%.s 293 @($(LHEAD) $(LINT.s) $< $(LTAIL)) 294 295$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/os/%.c 296 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 297 298$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/boot/%.c 299 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 300 301$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/vm/%.c 302 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 303 304$(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/%.c 305 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 306 307$(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/ppm/%.c 308 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 309 310$(LINTS_DIR)/%.ln: $(UTSBASE)/common/os/%.c 311 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 312 313$(LINTS_DIR)/%.ln: $(SRC)/common/dis/i386/%.c 314 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 315 316$(LINTS_DIR)/%.ln: $(SRC)/common/atomic/%.c 317 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 318 319$(LINTS_DIR)/%.ln: $(SRC)/common/mc/mc-amd/%.c 320 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 321 322$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/gfx_private/%.c 323 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 324 325$(LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/io/xsvc/%.c 326 @($(LHEAD) $(LINT.c) $< $(LTAIL)) 327 328# 329# bios call has a funky name change while building 330# 331$(LINTS_DIR)/bios_call.ln: $(UTSBASE)/i86pc/ml/bios_call_src.s 332 @($(LHEAD) $(LINT.s) $(UTSBASE)/i86pc/ml/bios_call_src.s $(LTAIL)) 333 @mv $(LINTS_DIR)/bios_call_src.ln $(LINTS_DIR)/bios_call.ln 334 335# 336# dboot always compiles in 32-bit mode, so force lint to be 32-bit mode too. 337# 338$(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/dboot/%.c 339 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL)) 340 341$(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/dboot/%.s 342 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL)) 343 344$(DBOOT_LINTS_DIR)/%.ln: $(UTSBASE)/i86pc/boot/%.c 345 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL)) 346 347$(DBOOT_LINTS_DIR)/%.ln: $(COMMONBASE)/util/%.c 348 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL)) 349 350$(DBOOT_LINTS_DIR)/%.ln: $(COMMONBASE)/util/i386/%.s 351 @($(LHEAD) $(DBOOT_LINT) $(DBOOT_LOCAL_LINTFLAGS) $< $(LTAIL)) 352