xref: /illumos-gate/usr/src/uts/Makefile (revision 8b0687e22a8de32264ac01083e07099701686911)
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# Copyright 2022 Garrett D'Amore
26#
27
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
80clobber_h	:=	TARGET= clobber
81check		:=	TARGET= check
82modlist		:=	TARGET= modlist
83modlist		:=	NO_STATE= -K $$MODSTATE$$$$
84
85.KEEP_STATE:
86
87def all: all_h $($(MACH)_ARCHITECTURES)
88
89install: all_h install_dirs $($(MACH)_ARCHITECTURES)
90
91install_dirs:
92	@cd ..; pwd; $(MAKE) rootdirs
93	@pwd
94
95#
96# Rule to build prerequisites. The left part of the pattern will match
97# PREREQ_TARGET.
98#
99# The location of the Makefile is determined by strippinng '.prereq' suffix from
100# the target name. We add '.prereq' suffix to the target passed to the child
101# Makefile so that it can distinguish prerequisite build from the regular one.
102#
103#
104%.prereq:
105	@cd $(@:%.prereq=%); pwd; $(MAKE) $(NO_STATE) $(TARGET).prereq
106
107#
108# Rule to build architecture files. Build all required prerequisites and then
109# build the rest (potentially in parallel).
110#
111$($(MACH)_ARCHITECTURES): $(PREREQ_TARGET) FRC
112	@cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
113
114#
115# The following is the list of directories which contain Makefiles with
116# targets to install header file. The machine independent headers are
117# installed by invoking the Makefile in the directory containing the
118# header files. Machine and architecture dependent headers are installed
119# by invoking the main makefile for that architecture/machine which,
120# in turn, is responsible for invoking the Makefiles which install headers.
121# It is done this way so as not to assume that all of the header files in
122# the architecture/machine dependent subdirectories are in completely
123# isomorphic locations.
124#
125COMMON_HDRDIRS= common/c2 \
126		common/des \
127		common/fs \
128		common/gssapi \
129		common/idmap \
130		common/klm \
131		common/inet \
132		common/inet/ipf/netinet \
133		common/inet/sockmods/netpacket \
134		common/io/bpf/net \
135		common/io/fibre-channel/fca/qlc \
136		common/ipp \
137		common/net \
138		common/netinet \
139		common/nfs \
140		common/pcmcia/sys \
141		common/rpc \
142		common/rpcsvc \
143		common/sharefs \
144		common/smb \
145		common/smbsrv \
146		common/sys \
147		common/vm
148
149
150#
151# Subset of COMMON_HDRDIRS in which at least one header is generated
152# at runtime (e.g., rpcgen), and in which "make clean" should run.
153# Other directories should be included here, but do not yet have the
154# necessary Makefile support (make clean).
155#
156DYNHDRDIRS =	common/gssapi \
157		common/idmap \
158		common/io/fibre-channel/fca/qlc \
159		common/klm \
160		common/rpc \
161		common/rpcsvc \
162		common/sys
163
164sparc_HDRDIRS= sun/sys
165i386_HDRDIRS= i86pc/vm i86xpv/vm
166
167HDRDIRS= $(COMMON_HDRDIRS) $($(MACH)_HDRDIRS)
168install_h check: $(HDRDIRS) $($(MACH)_ARCHITECTURES)
169
170$(HDRDIRS): FRC
171	@cd $@; pwd; $(MAKE) $(TARGET)
172
173# ensures that headers made by rpcgen and others are available in uts source
174# for kernel builds to reference without building install_h
175#
176all_h: FRC
177	@cd common/sys; pwd; $(MAKE) $@
178	@cd common/rpc; pwd; $(MAKE) $@
179	@cd common/rpcsvc; pwd; $(MAKE) $@
180	@cd common/gssapi; pwd; $(MAKE) $@
181	@cd common/idmap; pwd; $(MAKE) $@
182	@cd common/klm; pwd; $(MAKE) $@
183
184FRC:
185
186clean clobber: $($(MACH)_ARCHITECTURES) $(DYNHDRDIRS)
187
188# testing convenience
189clobber_h: $(DYNHDRDIRS)
190
191modlist: $($(MACH)_ARCHITECTURES)
192
193#
194# Cross-reference customization: build a cross-reference over all of
195# the supported architectures.  Although there's no correct way to set
196# the include path (since we don't know what architecture is the one
197# the user will be interested in), it's historically been set to
198# mirror the $(XRDIRS) list, and that works kinda sorta okay.
199#
200XRDIRS = $(sparc_ARCHITECTURES) $(i386_ARCHITECTURES) sun4 sfmmu	\
201	sun common
202
203XRINCDIRS = $(XRDIRS)
204
205include ../Makefile.xref
206