xref: /illumos-gate/usr/src/uts/Makefile (revision a5619348a00282a0a129610076aefdb4dd7ab2ab)
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 (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24# Copyright 2018 Nexenta Systems, Inc.
25#
26
27include ../Makefile.master
28
29#
30# List of architectures to build as part of the standard build.
31#
32# Some of these architectures are built in parallel (see i386_PARALLEL and
33# sparc_PARALLEL). This requires building some parts first before parallel build
34# can start. Platform make files know what should be built as a prerequisite for
35# the parallel build to work. The i386_PREREQ and sparc_PREREQ variables tell
36# which platform directory to enter to start making prerequisite dependencies.
37#
38sparc_ARCHITECTURES = sun4v sun4u sparc
39
40i386_ARCHITECTURES = i86pc i86xpv intel
41
42#
43# For i386 all architectures can be compiled in parallel.
44#
45# intel/Makefile knows how to build prerequisites needed for parallel build.
46#
47i386_PREREQ = intel
48i386_PARALLEL = $(i386_ARCHITECTURES)
49
50#
51# For sparc all architectures can be compiled in parallel.
52#
53# sun4/Makefile knows how to build prerequisites needed for parallel build.
54# can start.
55#
56sparc_PREREQ = sun4
57sparc_PARALLEL = $(sparc_ARCHITECTURES)
58
59#
60# Platforms defined in $(MACH)_PARALLEL are built in parallel. DUMMY is placed
61# at the end in case $(MACH)_PARALLEL is empty to prevent everything going in
62# parallel.
63#
64.PARALLEL: $($(MACH)_PARALLEL) DUMMY
65
66#
67# For build prerequisites we use a special target which is constructed by adding
68# '.prereq' suffix to the $(MACH)_PREREQ.
69#
70PREREQ_TARGET = $($(MACH)_PREREQ:%=%.prereq)
71
72
73def		:=	TARGET= def
74all		:=	TARGET= all
75install		:=	TARGET= install
76install_h	:=	TARGET= install_h
77clean		:=	TARGET= clean
78clobber		:=	TARGET= clobber
79clobber_h	:=	TARGET= clobber
80check		:=	TARGET= check
81modlist		:=	TARGET= modlist
82modlist		:=	NO_STATE= -K $$MODSTATE$$$$
83
84.KEEP_STATE:
85
86def all: 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/c2 \
134		common/des \
135		common/fs \
136		common/gssapi \
137		common/idmap \
138		common/klm \
139		common/inet \
140		common/inet/ipf/netinet \
141		common/inet/kssl \
142		common/inet/nca \
143		common/inet/sockmods/netpacket \
144		common/io/bpf/net \
145		common/io/fibre-channel/fca/qlc \
146		common/ipp \
147		common/net \
148		common/netinet \
149		common/nfs \
150		common/pcmcia/sys \
151		common/rpc \
152		common/rpcsvc \
153		common/sharefs \
154		common/smb \
155		common/smbsrv \
156		common/sys \
157		common/vm
158
159
160#
161# Subset of COMMON_HDRDIRS in which at least one header is generated
162# at runtime (e.g., rpcgen), and in which "make clean" should run.
163# Other directories should be included here, but do not yet have the
164# necessary Makefile support (make clean).
165#
166DYNHDRDIRS =	common/gssapi \
167		common/idmap \
168		common/io/fibre-channel/fca/qlc \
169		common/klm \
170		common/rpc \
171		common/rpcsvc \
172		common/sys
173
174sparc_HDRDIRS= sun/sys
175i386_HDRDIRS= i86pc/vm i86xpv/vm
176
177HDRDIRS= $(COMMON_HDRDIRS) $($(MACH)_HDRDIRS)
178install_h check: $(HDRDIRS) $($(MACH)_ARCHITECTURES)
179
180$(HDRDIRS): FRC
181	@cd $@; pwd; $(MAKE) $(TARGET)
182
183# ensures that headers made by rpcgen and others are available in uts source
184# for kernel builds to reference without building install_h
185#
186all_h: FRC
187	@cd common/sys; pwd; $(MAKE) $@
188	@cd common/rpc; pwd; $(MAKE) $@
189	@cd common/rpcsvc; pwd; $(MAKE) $@
190	@cd common/gssapi; pwd; $(MAKE) $@
191	@cd common/idmap; pwd; $(MAKE) $@
192	@cd common/klm; pwd; $(MAKE) $@
193
194clean clobber: $($(MACH)_ARCHITECTURES) $(DYNHDRDIRS)
195	@if [ '$(PATCH_BUILD)' != '#' ] ; then \
196		echo $(RM) $(PMTMO_FILE) ; \
197		$(RM) $(PMTMO_FILE) ; \
198	fi
199
200# testing convenience
201clobber_h: $(DYNHDRDIRS)
202
203modlist: $($(MACH)_ARCHITECTURES)
204
205#
206# Cross-reference customization: build a cross-reference over all of
207# the supported architectures.  Although there's no correct way to set
208# the include path (since we don't know what architecture is the one
209# the user will be interested in), it's historically been set to
210# mirror the $(XRDIRS) list, and that works kinda sorta okay.
211#
212XRDIRS = $(sparc_ARCHITECTURES) $(i386_ARCHITECTURES) sun4 sfmmu	\
213	sun common
214
215XRINCDIRS = $(XRDIRS)
216
217cscope.out tags: FRC
218	$(XREF) -x $@
219
220FRC:
221