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