xref: /titanic_50/usr/src/uts/Makefile (revision 895ca178e38ac3583d0c0d8317d51dc5f388df6e)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27# include global definitions
28include ../Makefile.master
29
30#
31# List of architectures to build as part of the standard build.
32#
33# Some of these architectures are built in parallel (see i386_PARALLEL and
34# sparc_PARALLEL). This requires building some parts first before parallel build
35# can start. Platform make files know what should be built as a prerequisite for
36# the parallel build to work. The i386_PREREQ and sparc_PREREQ variables tell
37# which platform directory to enter to start making prerequisite dependencies.
38#
39sparc_ARCHITECTURES = sun4v sun4u sparc
40
41i386_ARCHITECTURES = i86pc i86xpv intel
42
43#
44# For i386 all architectures can be compiled in parallel.
45#
46# intel/Makefile knows how to build prerequisites needed for parallel build.
47#
48i386_PREREQ = intel
49i386_PARALLEL = $(i386_ARCHITECTURES)
50
51#
52# For sparc all architectures can be compiled in parallel.
53#
54# sun4/Makefile knows how to build prerequisites needed for parallel build.
55# can start.
56#
57sparc_PREREQ = sun4
58sparc_PARALLEL = $(sparc_ARCHITECTURES)
59
60#
61# Platforms defined in $(MACH)_PARALLEL are built in parallel. DUMMY is placed
62# at the end in case $(MACH)_PARALLEL is empty to prevent everything going in
63# parallel.
64#
65.PARALLEL: $($(MACH)_PARALLEL) DUMMY
66
67#
68# For build prerequisites we use a special target which is constructed by adding
69# '.prereq' suffix to the $(MACH)_PREREQ.
70#
71PREREQ_TARGET = $($(MACH)_PREREQ:%=%.prereq)
72
73
74def		:=	TARGET= def
75all		:=	TARGET= all
76install		:=	TARGET= install
77install_h	:=	TARGET= install_h
78clean		:=	TARGET= clean
79clobber		:=	TARGET= clobber
80lint		:=	TARGET= lint
81clean.lint	:=	TARGET= clean.lint
82check		:=	TARGET= check
83modlist		:=	TARGET= modlist
84modlist		:=	NO_STATE= -K $$MODSTATE$$$$
85
86.KEEP_STATE:
87
88def all lint: all_h $(PMTMO_FILE) $($(MACH)_ARCHITECTURES)
89
90install: all_h install_dirs $(PMTMO_FILE) $($(MACH)_ARCHITECTURES)
91
92clean clobber: $($(MACH)_ARCHITECTURES)
93	@if [ '$(PATCH_BUILD)' != '#' ] ; then \
94		echo $(RM) $(PMTMO_FILE) ; \
95		$(RM) $(PMTMO_FILE) ; \
96	fi
97
98clean.lint modlist: $($(MACH)_ARCHITECTURES)
99
100install_dirs:
101	@cd ..; pwd; $(MAKE) rootdirs
102	@pwd
103
104#
105# Rule to build prerequisites. The left part of the pattern will match
106# PREREQ_TARGET.
107#
108# The location of the Makefile is determined by strippinng '.prereq' suffix from
109# the target name. We add '.prereq' suffix to the target passed to the child
110# Makefile so that it can distinguish prerequisite build from the regular one.
111#
112#
113%.prereq:
114	@cd $(@:%.prereq=%); pwd; $(MAKE) $(NO_STATE) $(TARGET).prereq
115
116#
117# Rule to build architecture files. Build all required prerequisites and then
118# build the rest (potentially in parallel).
119#
120$($(MACH)_ARCHITECTURES): $(PREREQ_TARGET) FRC
121	@cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
122
123$(PMTMO_FILE) pmtmo_file: $(PATCH_MAKEUP_TABLE)
124	@if [ -z "$(PATCH_MAKEUP_TABLE)" ] ; then \
125		echo 'ERROR: $$(PATCH_MAKEUP_TABLE) not set' \
126		    'in environment' >&2 ; \
127		exit 1 ; \
128	fi
129	RELEASE="$(RELEASE)" MACH="$(MACH)" \
130	    $(CTFCVTPTBL) -o $(PMTMO_FILE) $(PATCH_MAKEUP_TABLE)
131
132#
133# The following is the list of directories which contain Makefiles with
134# targets to install header file. The machine independent headers are
135# installed by invoking the Makefile in the directory containing the
136# header files. Machine and architecture dependent headers are installed
137# by invoking the main makefile for that architecture/machine which,
138# in turn, is responsible for invoking the Makefiles which install headers.
139# It is done this way so as not to assume that all of the header files in
140# the architecture/machine dependent subdirectories are in completely
141# isomorphic locations.
142#
143COMMON_HDRDIRS= common/des common/fs common/gssapi common/inet common/net \
144	common/netinet common/nfs common/rpc common/sys common/vm \
145	common/c2 common/pcmcia/sys common/rpcsvc common/inet/kssl \
146	common/inet/nca common/inet/ipf/netinet common/ipp common/idmap \
147	common/sharefs common/smbsrv
148
149# These aren't the only headers in closed.  But the other directories
150# are simple enough that they can be driven from the src tree.
151$(CLOSED_BUILD)COMMON_HDRDIRS += $(CLOSED)/uts/common/sys
152
153sparc_HDRDIRS= sun/sys
154i386_HDRDIRS= i86pc/vm i86xpv/vm
155
156HDRDIRS= $(COMMON_HDRDIRS) $($(MACH)_HDRDIRS)
157install_h check: $(HDRDIRS) $($(MACH)_ARCHITECTURES)
158
159$(HDRDIRS): FRC
160	@cd $@; pwd; $(MAKE) $(TARGET)
161
162# ensures that headers made by rpcgen and others are available in uts source
163# for kernel builds to reference without building install_h
164#
165all_h: FRC
166	@cd common/sys; pwd; $(MAKE) $@
167	@cd common/rpc; pwd; $(MAKE) $@
168	@cd common/rpcsvc; pwd; $(MAKE) $@
169	@cd common/gssapi; pwd; $(MAKE) $@
170	@cd common/idmap; pwd; $(MAKE) $@
171
172ONC_FILES=	common/io/timod.c \
173		common/os/sig.c \
174		common/os/flock.c \
175		common/os/sysent.c \
176		common/os/swapgeneric.c \
177		common/syscall/fcntl.c
178
179# edit onc plus source files.
180ONC_PLUS:	$(ONC_FILES:%=%_onc_plus)
181
182#
183# Cross-reference customization: build a cross-reference over all of
184# the supported architectures.  Although there's no correct way to set
185# the include path (since we don't know what architecture is the one
186# the user will be interested in), it's historically been set to
187# mirror the $(XRDIRS) list, and that works kinda sorta okay.
188#
189# We need to manually prune usr/closed/uts/{i86xpv|sfmmu} since neither
190# of them exist.
191#
192SHARED_XRDIRS = $(sparc_ARCHITECTURES) $(i386_ARCHITECTURES) sun4 sfmmu	\
193	sun common
194CLOSED_XRDIRS = $(SHARED_XRDIRS:%=% ../../closed/uts/%)
195XRDIRS = $(SHARED_XRDIRS)
196CLOSED_XRDIRS_XEN = $(CLOSED_XRDIRS:../../closed/uts/i86xpv=)
197$(CLOSED_BUILD)XRDIRS = $(CLOSED_XRDIRS_XEN:../../closed/uts/sfmmu=)
198
199XRINCDIRS = $(XRDIRS)
200
201cscope.out tags: FRC
202	$(XREF) -x $@
203
204FRC:
205