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]
23 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright (c) 2012 by Delphix. All rights reserved.
25 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
29 # Makefile for system source
31 # include global definitions
32 include Makefile.master
34 # the Targetdirs file is the AT&T target.dirs file in a makefile format.
35 # it defines TARGETDIRS and ROOTDIRS.
38 COMMON_SUBDIRS
= uts lib cmd ucblib ucbcmd psm man
test
43 # sparc needs to build stand before psm
45 $(SPARC_BLD
)psm
: stand
47 SUBDIRS
= $(COMMON_SUBDIRS
) $($(MACH
)_SUBDIRS
)
49 HDRSUBDIRS
= uts head lib cmd
51 # UCB headers are bug-for-bug compatible and not checkable against the header
54 CHKHDRSUBDIRS
= head uts lib
57 # Headers that can be built in parallel
59 PARALLEL_HEADERS
= sysheaders userheaders libheaders cmdheaders
62 # Directories that can be built in parallel
64 PARALLEL_DIRS
= uts lib man
66 # The check target also causes smf(5) service manifests to be validated.
69 # And man page formats
72 MSGSUBDIRS
= cmd ucbcmd lib
81 MSGDDIRS
= $(DOMAINS
:%=$(MSGROOT
)/%)
82 MSGDIRS
= $(MSGROOT
) $(MSGDDIRS
) $(MSGROOT
)/LC_TIME
85 install := TARGET
= install
86 install1
:= TARGET
= install
87 install2
:= TARGET
= install
88 install_h
:= TARGET
= install_h
89 clean := TARGET
= clean
90 clobber := TARGET
= clobber
91 check := TARGET
= check
96 # Note: install does not cause a build in pkg. To build packages,
97 # cd pkg and do a 'make install'
100 all: mapfiles closedbins sgs .WAIT
$(SUBDIRS
) pkg
103 # The _msg build is a two-step process. First, the _msg dependency
104 # causes recursive makes in $(MSGSUBDIRS), which stages raw message
105 # files in $(ROOT)/catalog. Second, the action from the install
106 # target rule causes those messages to be post-processed from where
107 # they were staged in $(ROOT)/catalog, and the results placed into the
110 # The stage-licenses target causes the license files needed for
111 # packaging to be pulled from $(SRC) and $(CLOSED) and staged in
114 install: install1 install2 _msg stage-licenses
115 @cd msg
; pwd
; $(MAKE
) _msg
116 @
rm -rf
"$(ROOT)/catalog"
118 stage-licenses
: install2
119 @cd pkg
; pwd
; $(MAKE
) stage-licenses
121 install1
: mapfiles closedbins sgs
123 install2
: install1
$(SUBDIRS
)
125 _msg
: _msgdirs rootdirs FRC
126 @for m in
$(MSGSUBDIRS
); do \
127 cd
$$m; pwd
; $(MAKE
) _msg
; cd ..
; \
131 @cd common
/mapfiles
; pwd
; $(MAKE
) install
133 clean: $(SUBDIRS
) head pkg
134 clobber: $(SUBDIRS
) head pkg clobber_local
136 @cd tools
; pwd
; $(MAKE
) clobber
137 @cd common
/mapfiles
; pwd
; $(MAKE
) clobber
138 @cd msg
; pwd
; $(MAKE
) clobber
140 closedbins
: bldtools
$(ROOTDIRS
) FRC
141 @CLOSED_ROOT
="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
142 if
[ ! -d
"$$CLOSED_ROOT" ]; then \
143 $(ECHO
) "Error: ON_CLOSED_BINS must point to closed" \
145 $(ECHO
) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \
146 "present in $$ON_CLOSED_BINS."; \
149 $(ECHO
) "Copying closed binaries from $$CLOSED_ROOT"; \
151 $(TAR
) cfX
- $(CODEMGR_WS
)/exception_lists
/closed-bins .
) | \
152 (cd
$(ROOT
); $(TAR
) xBpf
-); \
153 ( cd
$(ROOT
); $(CTFSTRIP
) $$(cd
$$CLOSED_ROOT; $(FIND
) \
154 .
/kernel .
/usr
/kernel .
/platform
/*/kernel
-type f
-a
-perm
-u
+x | \
155 $(EGREP
) -vf
$(CODEMGR_WS
)/exception_lists
/closed-bins
) )
158 # Declare what parts can be built in parallel
159 # DUMMY at the end is used in case macro expansion produces an empty string to
160 # prevent everything going in parallel
162 .PARALLEL
: $(PARALLEL_HEADERS
) DUMMY
163 .PARALLEL
: $(PARALLEL_DIRS
) DUMMY
165 $(SUBDIRS
) head pkg
: FRC
166 @cd
$@
; pwd
; $(MAKE
) $(TARGET
)
168 # librpcsvc has a dependency on headers installed by
169 # userheaders, hence the .WAIT before libheaders.
170 sgs
: rootdirs .WAIT sysheaders userheaders .WAIT \
171 libheaders cmdheaders
174 # Top-level setup target to setup the development environment that includes
175 # headers, tools and generated mapfiles. For open-only builds (i.e.: source
176 # trees w/o usr/closed), this also depends on the closedbins target (above)
177 # in order to properly seed the proto area. Note, although the tools are
178 # dependent on a number of constant mapfiles, the tools themselves are
179 # required to build the generated mapfiles.
181 setup
: closedbins bldtools sgs mapfiles
184 @cd tools
; pwd
; $(MAKE
) install
186 # /var/mail/:saved is a special case because of the colon in the name.
188 rootdirs
: $(ROOTDIRS
)
189 $(INS
) -d
-m
775 $(ROOT
)/var
/mail
/:saved
192 $(MAKE
) -f Makefile.lint
196 $(ROOTDIRS
) $(MSGDIRS
):
200 @cd head
; pwd
; $(MAKE
) install_h
203 @cd lib
; pwd
; $(MAKE
) install_h
206 @cd uts
; pwd
; $(MAKE
) install_h
209 @cd cmd
/fm
; pwd
; $(MAKE
) install_h
210 @cd cmd
/mdb
; pwd
; $(MAKE
) install_h
212 check: $(CHKHDRSUBDIRS
) $(CHKMFSTSUBDIRS
) $(CHKMANSUBDIRS
)
215 # Cross-reference customization: skip all of the subdirectories that
216 # don't contain actual source code.
218 XRPRUNE
= pkg prototypes
219 XRINCDIRS
= uts
/common head ucbhead
227 # Targets for reporting compiler versions; nightly uses these.
231 @if
$($(MACH
)_CC
) -_versions
>/dev
/null
2>/dev
/null
; then \
232 $(ECHO
) 32-bit compiler
; \
233 $(ECHO
) $($(MACH
)_CC
); \
234 $($(MACH
)_CC
) -_versions
2>&1 | \
235 $(EGREP
) '^(cw|cc|gcc|primary|shadow)'; \
237 __COMPILER
=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
238 if
[ -z
"$$__COMPILER" ]; then \
239 $(ECHO
) No
32-bit compiler found
; \
242 $(ECHO
) 32-bit compiler
; \
243 $(ECHO
) $($(MACH
)_CC
); \
244 $(ECHO
) $$__COMPILER; \
245 $($(MACH
)_CC
) -V
2>&1 | head
-1; \
250 @if
$($(MACH64
)_CC
) -_versions
>/dev
/null
2>/dev
/null
; then \
251 $(ECHO
) 64-bit compiler
; \
252 $(ECHO
) $($(MACH64
)_CC
); \
253 $($(MACH64
)_CC
) -_versions
2>&1 | \
254 $(EGREP
) '^(cw|cc|gcc|primary|shadow)'; \
256 __COMPILER
=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
257 if
[ -z
"$$__COMPILER" ]; then \
258 $(ECHO
) No
64-bit compiler found
; \
261 $(ECHO
) 64-bit compiler
; \
262 $(ECHO
) $($(MACH64
)_CC
); \
263 $(ECHO
) $$__COMPILER; \
264 $($(MACH64
)_CC
) -V
2>&1 | head
-1; \
269 @if
[ -x
"$(JAVAC)" ]; then \
271 $(JAVA_ROOT
)/bin
/java
-fullversion
2>&1 | head
-1; \
273 $(ECHO
) No Java compiler found
; \