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