#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#pragma ident	"%Z%%M%	%I%	%E% SMI"
#

#	This Makefile defines the build rules for the directory uts/i86pc
#	and its children. These are the source files which are i86pc
#	"implementation architecture" dependent.
#
#	The following two-level ordering must be maintained in this file.
#	  Lines are sorted first in order of decreasing specificity based on
#	  the first directory component.  That is, sun4u rules come before
#	  sparc rules come before common rules.
#
#	  Lines whose initial directory components are equal are sorted
#	  alphabetically by the remaining components.

#
#	Section 1a: C object build rules
#
$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/conf/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/pci/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/pciex/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/pciex/hotplug/pciehpc/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/pcplusmp/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/pcplusmp/%.s
	$(COMPILE.s) -o $@ $<

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/psm/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/psm/%.s
	$(COMPILE.s) -o $@ $<

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/ml/%.s
	$(COMPILE.s) -o $@ $<

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/os/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/vm/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/common/io/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/common/os/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(SRC)/common/dis/i386/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/agpgart/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/gfx_private/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

# ridiculous contortions ---
ATOMIC_SUBDIR_32	= i386
ATOMIC_SUBDIR_64	= amd64
ATOMIC_SUBDIR		= $(ATOMIC_SUBDIR_$(CLASS))

$(OBJS_DIR)/%.o:		$(SRC)/common/atomic/$(ATOMIC_SUBDIR)/%.s
	$(COMPILE.s) -o $@ $<

$(OBJS_DIR)/%.o:		$(UTSBASE)/common/io/power/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/acpica/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/acpica/%.s
	$(COMPILE.s) -o $@ $<

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/acpica/debugger/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/acpica/events/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/acpica/hardware/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/acpica/interpreter/dispatcher/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/acpica/interpreter/executer/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/acpica/interpreter/parser/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/acpica/namespace/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/acpica/resources/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/acpica/tables/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/%.o:		$(UTSBASE)/i86pc/io/acpica/utilities/%.c
	$(COMPILE.c) -o $@ $<
	$(CTFCONVERT_O)

$(OBJS_DIR)/dtracestubs.s:	$(UNIX_O) $(LIBS)
	nm -u $(UNIX_O) $(LIBS) | grep __dtrace_probe_ | sort | uniq | nawk '{ \
	    printf("\t.globl %s\n\t.type %s,@function\n%s:\n", \
	    $$1, $$1, $$1); }' > $(OBJS_DIR)/dtracestubs.s

$(DTRACESTUBS):	$(DTRACESTUBS_O)
	$(BUILD.SO) $(DTRACESTUBS_O)

#
#	Section 1b: Lint `object' build rules
#
$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/conf/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pci/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pciex/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pciex/hotplug/pciehpc/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pcplusmp/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/pcplusmp/%.s
	@($(LHEAD) $(LINT.s) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/psm/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/psm/%.s
	@($(LHEAD) $(LINT.s) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/ml/%.s
	@($(LHEAD) $(LINT.s) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/os/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/vm/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/common/io/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/common/os/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(SRC)/common/dis/i386/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/agpgart/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(SRC)/common/atomic/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/acpica/%.s
	@($(LHEAD) $(LINT.s) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/acpica/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/acpica/debugger/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/acpica/events/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/acpica/hardware/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/acpica/interpreter/dispatcher/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/acpica/interpreter/executer/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/acpica/interpreter/parser/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/acpica/namespace/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/acpica/resources/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/acpica/tables/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/acpica/utilities/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))

$(LINTS_DIR)/%.ln:		$(UTSBASE)/i86pc/io/gfx_private/%.c
	@($(LHEAD) $(LINT.c) $< $(LTAIL))