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