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# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27
28#
29# We build each flavor in a separate make invocation to improve clarity(!) in
30# Makefile.com.  The subordinate makes have $(CURTYPE) set to indicate the
31# flavor they're supposed to build.  This causes the correct set of source
32# files and compiler and linker flags to be selected.
33#
34# The SPARC library is built from the closed gate.  This Makefile is shared
35# between both environments, so all paths must be absolute.
36#
37
38install: $(TYPES:%=install.%)
39
40all: $(TYPES:%=all.%)
41
42$(TYPES:%=all.%):
43	@CURTYPE=$(@:all.%=%) $(MAKE) $@.targ
44
45$(TYPES:%=install.%):
46	@CURTYPE=$(@:install.%=%) $(MAKE) $@.targ
47
48install.library.targ: all.library $(INSTALL_DEPS_library)
49install.standalone.targ: all.standalone $(INSTALL_DEPS_standalone)
50
51all.library.targ: $(LIBS)
52all.standalone.targ: $(STANDLIBRARY)
53
54lint: $(TYPES:%=lint.%)
55
56$(TYPES:%=lint.%):
57	@CURTYPE=$(@:lint.%=%) $(MAKE) lintcheck
58
59$(STANDLIBRARY): $(OBJS) $(LINKTEST_OBJ)
60	$(LD) -Breduce -zdefs $(LDFLAGS) -o $@.linktest $(OBJS) $(LINKTEST_OBJ)
61	rm $@.linktest
62	$(LD) $(LDFLAGS) -o $@ $(OBJS)
63
64clobber: $(TYPES:%=clobber.%)
65
66$(TYPES:%=clobber.%):
67	@CURTYPE=$(@:clobber.%=%) $(MAKE) clobber.targ
68
69clobber.targ: clean
70	-$(RM) $(CLOBBERTARGFILES)
71
72# include library targets
73include $(SRC)/lib/Makefile.targ
74
75$(PICS): pics
76$(OBJS): objs
77
78objs/%.o pics/%.o: $(ISASRCDIR)/%.c
79	$(COMPILE.c) -o $@ $<
80	$(POST_PROCESS_O)
81
82objs/%.o pics/%.o: $(ISASRCDIR)/%.s
83	$(COMPILE.s) -o $@ $<
84	$(POST_PROCESS_O)
85
86objs/%.o pics/%.o: $(COMDIR)/%.c
87	$(COMPILE.c) -o $@ $<
88	$(POST_PROCESS_O)
89
90# install rule for lint library target
91$(ROOTLINTDIR)/%: $(COMDIR)/%
92	$(INS.file)
93
94# install rule for x86 common source
95objs/%.o pics/%.o: $(SRC)/common/dis/i386/%.c
96	$(COMPILE.c) -o $@ $<
97	$(POST_PROCESS_O)
98