blob: d03de46952f7f41ff992c2a2fab52fb99e0cf90f [file] [log] [blame]
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -07001#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
dh155122f4b3ec62007-01-19 16:59:38 -08005# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -07007#
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#
Yuri Pankovcb41b9c2018-08-07 16:46:21 -070021
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070022#
Alan Wright148c5f42010-05-27 15:26:41 -070023# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
Yuri Pankovcb41b9c2018-08-07 16:46:21 -070024# Copyright 2018 Nexenta Systems, Inc.
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070025#
Yuri Pankovcb41b9c2018-08-07 16:46:21 -070026
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070027include ../Makefile.master
28
29#
30# List of architectures to build as part of the standard build.
31#
akolb98157a72008-02-27 15:35:58 -080032# 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.
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070037#
38sparc_ARCHITECTURES = sun4v sun4u sparc
39
akolb98157a72008-02-27 15:35:58 -080040i386_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
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070072
73def := TARGET= def
74all := TARGET= all
75install := TARGET= install
76install_h := TARGET= install_h
77clean := TARGET= clean
78clobber := TARGET= clobber
Gordon Rossb6805bf2013-08-23 18:31:03 -040079clobber_h := TARGET= clobber
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070080lint := TARGET= lint
81clean.lint := TARGET= clean.lint
82check := TARGET= check
kupferfb9f9b92005-12-21 19:47:57 -080083modlist := TARGET= modlist
84modlist := NO_STATE= -K $$MODSTATE$$$$
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070085
86.KEEP_STATE:
87
88def all lint: all_h $(PMTMO_FILE) $($(MACH)_ARCHITECTURES)
89
90install: all_h install_dirs $(PMTMO_FILE) $($(MACH)_ARCHITECTURES)
91
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070092install_dirs:
93 @cd ..; pwd; $(MAKE) rootdirs
94 @pwd
95
akolb98157a72008-02-27 15:35:58 -080096#
97# Rule to build prerequisites. The left part of the pattern will match
98# PREREQ_TARGET.
99#
100# The location of the Makefile is determined by strippinng '.prereq' suffix from
101# the target name. We add '.prereq' suffix to the target passed to the child
102# Makefile so that it can distinguish prerequisite build from the regular one.
103#
104#
105%.prereq:
106 @cd $(@:%.prereq=%); pwd; $(MAKE) $(NO_STATE) $(TARGET).prereq
107
108#
109# Rule to build architecture files. Build all required prerequisites and then
110# build the rest (potentially in parallel).
111#
112$($(MACH)_ARCHITECTURES): $(PREREQ_TARGET) FRC
kupferfb9f9b92005-12-21 19:47:57 -0800113 @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700114
115$(PMTMO_FILE) pmtmo_file: $(PATCH_MAKEUP_TABLE)
116 @if [ -z "$(PATCH_MAKEUP_TABLE)" ] ; then \
117 echo 'ERROR: $$(PATCH_MAKEUP_TABLE) not set' \
118 'in environment' >&2 ; \
119 exit 1 ; \
120 fi
121 RELEASE="$(RELEASE)" MACH="$(MACH)" \
122 $(CTFCVTPTBL) -o $(PMTMO_FILE) $(PATCH_MAKEUP_TABLE)
123
124#
125# The following is the list of directories which contain Makefiles with
126# targets to install header file. The machine independent headers are
127# installed by invoking the Makefile in the directory containing the
128# header files. Machine and architecture dependent headers are installed
129# by invoking the main makefile for that architecture/machine which,
130# in turn, is responsible for invoking the Makefiles which install headers.
131# It is done this way so as not to assume that all of the header files in
132# the architecture/machine dependent subdirectories are in completely
133# isomorphic locations.
134#
Yuri Pankovcb41b9c2018-08-07 16:46:21 -0700135COMMON_HDRDIRS= common/c2 \
John Fortefcf3ce42008-10-14 15:09:13 -0700136 common/des \
137 common/fs \
138 common/gssapi \
139 common/idmap \
Dan Kruchininbbaa8b62013-08-26 20:42:32 -0800140 common/klm \
John Fortefcf3ce42008-10-14 15:09:13 -0700141 common/inet \
142 common/inet/ipf/netinet \
143 common/inet/kssl \
144 common/inet/nca \
Darren Reed0a0e9772009-09-24 07:28:12 -0700145 common/inet/sockmods/netpacket \
146 common/io/bpf/net \
Gordon Rossb6805bf2013-08-23 18:31:03 -0400147 common/io/fibre-channel/fca/qlc \
John Fortefcf3ce42008-10-14 15:09:13 -0700148 common/ipp \
149 common/net \
150 common/netinet \
151 common/nfs \
152 common/pcmcia/sys \
153 common/rpc \
154 common/rpcsvc \
155 common/sharefs \
Alan Wright148c5f42010-05-27 15:26:41 -0700156 common/smb \
John Fortefcf3ce42008-10-14 15:09:13 -0700157 common/smbsrv \
158 common/sys \
159 common/vm
160
dh155122f4b3ec62007-01-19 16:59:38 -0800161
Jordan Brown9b214d32009-05-07 12:31:08 -0700162#
163# Subset of COMMON_HDRDIRS in which at least one header is generated
Dan Kruchininbbaa8b62013-08-26 20:42:32 -0800164# at runtime (e.g., rpcgen), and in which "make clean" should run.
165# Other directories should be included here, but do not yet have the
Yuri Pankovcb41b9c2018-08-07 16:46:21 -0700166# necessary Makefile support (make clean).
Jordan Brown9b214d32009-05-07 12:31:08 -0700167#
Yuri Pankovcb41b9c2018-08-07 16:46:21 -0700168DYNHDRDIRS = common/gssapi \
Gordon Rossb6805bf2013-08-23 18:31:03 -0400169 common/idmap \
170 common/io/fibre-channel/fca/qlc \
Dan Kruchininbbaa8b62013-08-26 20:42:32 -0800171 common/klm \
Gordon Rossb6805bf2013-08-23 18:31:03 -0400172 common/rpc \
Dan Kruchininbbaa8b62013-08-26 20:42:32 -0800173 common/rpcsvc \
174 common/sys
Jordan Brown9b214d32009-05-07 12:31:08 -0700175
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700176sparc_HDRDIRS= sun/sys
johnlev843e1982007-09-18 15:46:43 -0700177i386_HDRDIRS= i86pc/vm i86xpv/vm
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700178
179HDRDIRS= $(COMMON_HDRDIRS) $($(MACH)_HDRDIRS)
180install_h check: $(HDRDIRS) $($(MACH)_ARCHITECTURES)
181
182$(HDRDIRS): FRC
183 @cd $@; pwd; $(MAKE) $(TARGET)
184
185# ensures that headers made by rpcgen and others are available in uts source
186# for kernel builds to reference without building install_h
187#
188all_h: FRC
189 @cd common/sys; pwd; $(MAKE) $@
190 @cd common/rpc; pwd; $(MAKE) $@
191 @cd common/rpcsvc; pwd; $(MAKE) $@
192 @cd common/gssapi; pwd; $(MAKE) $@
nw141292c5c41132007-06-21 19:11:00 -0700193 @cd common/idmap; pwd; $(MAKE) $@
Dan Kruchininbbaa8b62013-08-26 20:42:32 -0800194 @cd common/klm; pwd; $(MAKE) $@
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700195
Jordan Brown9b214d32009-05-07 12:31:08 -0700196clean clobber: $($(MACH)_ARCHITECTURES) $(DYNHDRDIRS)
197 @if [ '$(PATCH_BUILD)' != '#' ] ; then \
198 echo $(RM) $(PMTMO_FILE) ; \
199 $(RM) $(PMTMO_FILE) ; \
200 fi
201
Gordon Rossb6805bf2013-08-23 18:31:03 -0400202# testing convenience
203clobber_h: $(DYNHDRDIRS)
Jordan Brown9b214d32009-05-07 12:31:08 -0700204
205clean.lint modlist: $($(MACH)_ARCHITECTURES)
206
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700207#
208# Cross-reference customization: build a cross-reference over all of
209# the supported architectures. Although there's no correct way to set
210# the include path (since we don't know what architecture is the one
211# the user will be interested in), it's historically been set to
212# mirror the $(XRDIRS) list, and that works kinda sorta okay.
213#
Josef 'Jeff' Sipekc0e79772013-10-15 00:21:04 -0400214XRDIRS = $(sparc_ARCHITECTURES) $(i386_ARCHITECTURES) sun4 sfmmu \
kupferfb9f9b92005-12-21 19:47:57 -0800215 sun common
kupferfb9f9b92005-12-21 19:47:57 -0800216
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700217XRINCDIRS = $(XRDIRS)
218
219cscope.out tags: FRC
220 $(XREF) -x $@
221
222FRC: