xref: /illumos-gate/usr/src/uts/Makefile (revision 79fb40ac)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5f4b3ec61Sdh# Common Development and Distribution License (the "License").
6f4b3ec61Sdh# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
21cb41b9c5SYuri Pankov
227c478bd9Sstevel@tonic-gate#
23148c5f43SAlan Wright# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24cb41b9c5SYuri Pankov# Copyright 2018 Nexenta Systems, Inc.
2515f90b02SGarrett D'Amore# Copyright 2022 Garrett D'Amore
267c478bd9Sstevel@tonic-gate#
27cb41b9c5SYuri Pankov
287c478bd9Sstevel@tonic-gateinclude ../Makefile.master
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate#
317c478bd9Sstevel@tonic-gate# List of architectures to build as part of the standard build.
327c478bd9Sstevel@tonic-gate#
3398157a70Sakolb# Some of these architectures are built in parallel (see i386_PARALLEL and
3498157a70Sakolb# sparc_PARALLEL). This requires building some parts first before parallel build
3598157a70Sakolb# can start. Platform make files know what should be built as a prerequisite for
3698157a70Sakolb# the parallel build to work. The i386_PREREQ and sparc_PREREQ variables tell
3798157a70Sakolb# which platform directory to enter to start making prerequisite dependencies.
387c478bd9Sstevel@tonic-gate#
397c478bd9Sstevel@tonic-gatesparc_ARCHITECTURES = sun4v sun4u sparc
407c478bd9Sstevel@tonic-gate
4198157a70Sakolbi386_ARCHITECTURES = i86pc i86xpv intel
4298157a70Sakolb
4398157a70Sakolb#
4498157a70Sakolb# For i386 all architectures can be compiled in parallel.
4598157a70Sakolb#
4698157a70Sakolb# intel/Makefile knows how to build prerequisites needed for parallel build.
4798157a70Sakolb#
4898157a70Sakolbi386_PREREQ = intel
4998157a70Sakolbi386_PARALLEL = $(i386_ARCHITECTURES)
5098157a70Sakolb
5198157a70Sakolb#
5298157a70Sakolb# For sparc all architectures can be compiled in parallel.
5398157a70Sakolb#
5498157a70Sakolb# sun4/Makefile knows how to build prerequisites needed for parallel build.
5598157a70Sakolb# can start.
5698157a70Sakolb#
5798157a70Sakolbsparc_PREREQ = sun4
5898157a70Sakolbsparc_PARALLEL = $(sparc_ARCHITECTURES)
5998157a70Sakolb
6098157a70Sakolb#
6198157a70Sakolb# Platforms defined in $(MACH)_PARALLEL are built in parallel. DUMMY is placed
6298157a70Sakolb# at the end in case $(MACH)_PARALLEL is empty to prevent everything going in
6398157a70Sakolb# parallel.
6498157a70Sakolb#
6598157a70Sakolb.PARALLEL: $($(MACH)_PARALLEL) DUMMY
6698157a70Sakolb
6798157a70Sakolb#
6898157a70Sakolb# For build prerequisites we use a special target which is constructed by adding
6998157a70Sakolb# '.prereq' suffix to the $(MACH)_PREREQ.
7098157a70Sakolb#
7198157a70SakolbPREREQ_TARGET = $($(MACH)_PREREQ:%=%.prereq)
7298157a70Sakolb
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gatedef		:=	TARGET= def
757c478bd9Sstevel@tonic-gateall		:=	TARGET= all
767c478bd9Sstevel@tonic-gateinstall		:=	TARGET= install
777c478bd9Sstevel@tonic-gateinstall_h	:=	TARGET= install_h
787c478bd9Sstevel@tonic-gateclean		:=	TARGET= clean
797c478bd9Sstevel@tonic-gateclobber		:=	TARGET= clobber
80b6805bf7SGordon Rossclobber_h	:=	TARGET= clobber
817c478bd9Sstevel@tonic-gatecheck		:=	TARGET= check
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate.KEEP_STATE:
847c478bd9Sstevel@tonic-gate
85*fc910014SRichard Lowedef all: all_h $($(MACH)_ARCHITECTURES)
867c478bd9Sstevel@tonic-gate
87*fc910014SRichard Loweinstall: all_h install_dirs $($(MACH)_ARCHITECTURES)
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gateinstall_dirs:
907c478bd9Sstevel@tonic-gate	@cd ..; pwd; $(MAKE) rootdirs
917c478bd9Sstevel@tonic-gate	@pwd
927c478bd9Sstevel@tonic-gate
9398157a70Sakolb#
9498157a70Sakolb# Rule to build prerequisites. The left part of the pattern will match
9598157a70Sakolb# PREREQ_TARGET.
9698157a70Sakolb#
9798157a70Sakolb# The location of the Makefile is determined by strippinng '.prereq' suffix from
9898157a70Sakolb# the target name. We add '.prereq' suffix to the target passed to the child
9998157a70Sakolb# Makefile so that it can distinguish prerequisite build from the regular one.
10098157a70Sakolb#
10198157a70Sakolb#
10298157a70Sakolb%.prereq:
10398157a70Sakolb	@cd $(@:%.prereq=%); pwd; $(MAKE) $(NO_STATE) $(TARGET).prereq
10498157a70Sakolb
10598157a70Sakolb#
10698157a70Sakolb# Rule to build architecture files. Build all required prerequisites and then
10798157a70Sakolb# build the rest (potentially in parallel).
10898157a70Sakolb#
10998157a70Sakolb$($(MACH)_ARCHITECTURES): $(PREREQ_TARGET) FRC
110fb9f9b97Skupfer	@cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
1117c478bd9Sstevel@tonic-gate
1127c478bd9Sstevel@tonic-gate#
1137c478bd9Sstevel@tonic-gate# The following is the list of directories which contain Makefiles with
1147c478bd9Sstevel@tonic-gate# targets to install header file. The machine independent headers are
1157c478bd9Sstevel@tonic-gate# installed by invoking the Makefile in the directory containing the
1167c478bd9Sstevel@tonic-gate# header files. Machine and architecture dependent headers are installed
1177c478bd9Sstevel@tonic-gate# by invoking the main makefile for that architecture/machine which,
1187c478bd9Sstevel@tonic-gate# in turn, is responsible for invoking the Makefiles which install headers.
1197c478bd9Sstevel@tonic-gate# It is done this way so as not to assume that all of the header files in
1207c478bd9Sstevel@tonic-gate# the architecture/machine dependent subdirectories are in completely
1217c478bd9Sstevel@tonic-gate# isomorphic locations.
1227c478bd9Sstevel@tonic-gate#
123cb41b9c5SYuri PankovCOMMON_HDRDIRS= common/c2 \
124fcf3ce44SJohn Forte		common/des \
125fcf3ce44SJohn Forte		common/fs \
126fcf3ce44SJohn Forte		common/gssapi \
127fcf3ce44SJohn Forte		common/idmap \
128bbaa8b60SDan Kruchinin		common/klm \
129fcf3ce44SJohn Forte		common/inet \
130fcf3ce44SJohn Forte		common/inet/ipf/netinet \
1310a0e9771SDarren Reed		common/inet/sockmods/netpacket \
1320a0e9771SDarren Reed		common/io/bpf/net \
133b6805bf7SGordon Ross		common/io/fibre-channel/fca/qlc \
134fcf3ce44SJohn Forte		common/ipp \
135fcf3ce44SJohn Forte		common/net \
136fcf3ce44SJohn Forte		common/netinet \
137fcf3ce44SJohn Forte		common/nfs \
138fcf3ce44SJohn Forte		common/pcmcia/sys \
139fcf3ce44SJohn Forte		common/rpc \
140fcf3ce44SJohn Forte		common/rpcsvc \
141fcf3ce44SJohn Forte		common/sharefs \
142148c5f43SAlan Wright		common/smb \
143fcf3ce44SJohn Forte		common/smbsrv \
144fcf3ce44SJohn Forte		common/sys \
145fcf3ce44SJohn Forte		common/vm
146fcf3ce44SJohn Forte
147f4b3ec61Sdh
1489b214d32SJordan Brown#
1499b214d32SJordan Brown# Subset of COMMON_HDRDIRS in which at least one header is generated
150bbaa8b60SDan Kruchinin# at runtime (e.g., rpcgen), and in which "make clean" should run.
151bbaa8b60SDan Kruchinin# Other directories should be included here, but do not yet have the
152cb41b9c5SYuri Pankov# necessary Makefile support (make clean).
1539b214d32SJordan Brown#
154cb41b9c5SYuri PankovDYNHDRDIRS =	common/gssapi \
155b6805bf7SGordon Ross		common/idmap \
156b6805bf7SGordon Ross		common/io/fibre-channel/fca/qlc \
157bbaa8b60SDan Kruchinin		common/klm \
158b6805bf7SGordon Ross		common/rpc \
159bbaa8b60SDan Kruchinin		common/rpcsvc \
160bbaa8b60SDan Kruchinin		common/sys
1619b214d32SJordan Brown
1627c478bd9Sstevel@tonic-gatesparc_HDRDIRS= sun/sys
163843e1988Sjohnlevi386_HDRDIRS= i86pc/vm i86xpv/vm
1647c478bd9Sstevel@tonic-gate
1657c478bd9Sstevel@tonic-gateHDRDIRS= $(COMMON_HDRDIRS) $($(MACH)_HDRDIRS)
1667c478bd9Sstevel@tonic-gateinstall_h check: $(HDRDIRS) $($(MACH)_ARCHITECTURES)
1677c478bd9Sstevel@tonic-gate
1687c478bd9Sstevel@tonic-gate$(HDRDIRS): FRC
1697c478bd9Sstevel@tonic-gate	@cd $@; pwd; $(MAKE) $(TARGET)
1707c478bd9Sstevel@tonic-gate
1717c478bd9Sstevel@tonic-gate# ensures that headers made by rpcgen and others are available in uts source
1727c478bd9Sstevel@tonic-gate# for kernel builds to reference without building install_h
1737c478bd9Sstevel@tonic-gate#
1747c478bd9Sstevel@tonic-gateall_h: FRC
1757c478bd9Sstevel@tonic-gate	@cd common/sys; pwd; $(MAKE) $@
1767c478bd9Sstevel@tonic-gate	@cd common/rpc; pwd; $(MAKE) $@
1777c478bd9Sstevel@tonic-gate	@cd common/rpcsvc; pwd; $(MAKE) $@
1787c478bd9Sstevel@tonic-gate	@cd common/gssapi; pwd; $(MAKE) $@
179c5c4113dSnw	@cd common/idmap; pwd; $(MAKE) $@
180bbaa8b60SDan Kruchinin	@cd common/klm; pwd; $(MAKE) $@
1817c478bd9Sstevel@tonic-gate
1820fb96ba1SBill SommerfeldFRC:
1830fb96ba1SBill Sommerfeld
1849b214d32SJordan Brownclean clobber: $($(MACH)_ARCHITECTURES) $(DYNHDRDIRS)
1859b214d32SJordan Brown
186b6805bf7SGordon Ross# testing convenience
187b6805bf7SGordon Rossclobber_h: $(DYNHDRDIRS)
1889b214d32SJordan Brown
1897c478bd9Sstevel@tonic-gate#
1907c478bd9Sstevel@tonic-gate# Cross-reference customization: build a cross-reference over all of
1917c478bd9Sstevel@tonic-gate# the supported architectures.  Although there's no correct way to set
1927c478bd9Sstevel@tonic-gate# the include path (since we don't know what architecture is the one
1937c478bd9Sstevel@tonic-gate# the user will be interested in), it's historically been set to
1947c478bd9Sstevel@tonic-gate# mirror the $(XRDIRS) list, and that works kinda sorta okay.
1957c478bd9Sstevel@tonic-gate#
196c0e7977aSJosef 'Jeff' SipekXRDIRS = $(sparc_ARCHITECTURES) $(i386_ARCHITECTURES) sun4 sfmmu	\
197fb9f9b97Skupfer	sun common
198fb9f9b97Skupfer
1997c478bd9Sstevel@tonic-gateXRINCDIRS = $(XRDIRS)
2007c478bd9Sstevel@tonic-gate
2010fb96ba1SBill Sommerfeldinclude ../Makefile.xref
202