Merge commit 'cb41b9c565d4eec9e1f06e24d429696f59f2f07d'
[unleashed.git] / usr / src / uts / Makefile
blob9b867ba8e3861b9a1c9b79ba752242a9b729eb2c
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
23 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
25 # Copyright 2018 Nexenta Systems, Inc.
28 include ../Makefile.master
31 # List of architectures to build as part of the standard build.
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.
39 sparc_ARCHITECTURES = $(CONFIG_PLATFORM) sparc
41 i386_ARCHITECTURES = $(CONFIG_PLATFORM) intel
44 # For i386 all architectures can be compiled in parallel.
46 # intel/Makefile knows how to build prerequisites needed for parallel build.
48 i386_PREREQ = intel
49 i386_PARALLEL = $(i386_ARCHITECTURES)
52 # For sparc all architectures can be compiled in parallel.
54 # sun4/Makefile knows how to build prerequisites needed for parallel build.
55 # can start.
57 sparc_PREREQ = sun4
58 sparc_PARALLEL = $(sparc_ARCHITECTURES)
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.
65 .PARALLEL: $($(MACH)_PARALLEL) DUMMY
68 # For build prerequisites we use a special target which is constructed by adding
69 # '.prereq' suffix to the $(MACH)_PREREQ.
71 PREREQ_TARGET = $($(MACH)_PREREQ:%=%.prereq)
74 def := TARGET= def
75 all := TARGET= all
76 install := TARGET= install
77 install_h := TARGET= install_h
78 clean := TARGET= clean
79 clobber := TARGET= clobber
80 clobber_h := TARGET= clobber
81 check := TARGET= check
82 modlist := TARGET= modlist
83 modlist := NO_STATE= -K $$MODSTATE$$$$
85 .KEEP_STATE:
87 def all: all_h $(PMTMO_FILE) $($(MACH)_ARCHITECTURES)
89 install: all_h install_dirs $(PMTMO_FILE) $($(MACH)_ARCHITECTURES)
91 install_dirs:
92 @cd ..; pwd; $(MAKE) rootdirs
93 @pwd
96 # Rule to build prerequisites. The left part of the pattern will match
97 # PREREQ_TARGET.
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.
104 %.prereq:
105 @cd $(@:%.prereq=%); pwd; $(MAKE) $(NO_STATE) $(TARGET).prereq
108 # Rule to build architecture files. Build all required prerequisites and then
109 # build the rest (potentially in parallel).
111 $($(MACH)_ARCHITECTURES): $(PREREQ_TARGET) FRC
112 @cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
116 # The following is the list of directories which contain Makefiles with
117 # targets to install header file. The machine independent headers are
118 # installed by invoking the Makefile in the directory containing the
119 # header files. Machine and architecture dependent headers are installed
120 # by invoking the main makefile for that architecture/machine which,
121 # in turn, is responsible for invoking the Makefiles which install headers.
122 # It is done this way so as not to assume that all of the header files in
123 # the architecture/machine dependent subdirectories are in completely
124 # isomorphic locations.
126 COMMON_HDRDIRS= common/c2 \
127 common/des \
128 common/gssapi \
129 common/idmap \
130 common/klm \
131 common/io/bpf/net \
132 common/io/fibre-channel/fca/qlc \
133 common/ipp \
134 common/netinet \
135 common/nfs \
136 common/rpc \
137 common/rpcsvc \
138 common/sharefs \
139 common/smb \
140 common/smbsrv
144 # Subset of COMMON_HDRDIRS in which at least one header is generated
145 # at runtime (e.g., rpcgen), and in which "make clean" should run.
146 # Other directories should be included here, but do not yet have the
147 # necessary Makefile support (make clean).
149 DYNHDRDIRS = common/gssapi \
150 common/idmap \
151 common/io/fibre-channel/fca/qlc \
152 common/klm \
153 common/rpc \
154 common/rpcsvc
156 sparc_HDRDIRS= sun/sys
157 i386_HDRDIRS=
159 HDRDIRS= $(COMMON_HDRDIRS) $($(MACH)_HDRDIRS)
160 install_h check: $(HDRDIRS) $($(MACH)_ARCHITECTURES)
162 $(HDRDIRS): FRC
163 @cd $@; pwd; $(MAKE) $(TARGET)
165 # ensures that headers made by rpcgen and others are available in uts source
166 # for kernel builds to reference without building install_h
168 all_h: FRC
169 @cd common/rpc; pwd; $(MAKE) $@
170 @cd common/rpcsvc; pwd; $(MAKE) $@
171 @cd common/gssapi; pwd; $(MAKE) $@
172 @cd common/idmap; pwd; $(MAKE) $@
173 @cd common/klm; pwd; $(MAKE) $@
175 clean clobber: $($(MACH)_ARCHITECTURES) $(DYNHDRDIRS)
177 # testing convenience
178 clobber_h: $(DYNHDRDIRS)
180 modlist: $($(MACH)_ARCHITECTURES)
182 FRC: