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>
26 # Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved.
27 # Copyright 2016 Toomas Soome <tsoome@me.com>
28 # Copyright 2017 Joyent, Inc.
29 # Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
33 # Makefile for system source
35 # include global definitions
36 include Makefile.master
38 # the Targetdirs file is the AT&T target.dirs file in a makefile format.
39 # it defines TARGETDIRS and ROOTDIRS.
42 COMMON_SUBDIRS
= data uts lib cmd ucblib ucbcmd psm man
test
44 i386_SUBDIRS
= grub boot
47 # sparc needs to build stand before psm
49 $(SPARC_BLD
)psm
: stand
51 SUBDIRS
= $(COMMON_SUBDIRS
) $($(MACH
)_SUBDIRS
)
53 HDRSUBDIRS
= uts head lib cmd
55 # UCB headers are bug-for-bug compatible and not checkable against the header
58 CHKHDRSUBDIRS
= head uts lib
61 # Headers that can be built in parallel
63 PARALLEL_HEADERS
= sysheaders userheaders libheaders cmdheaders
66 # Directories that can be built in parallel
68 PARALLEL_DIRS
= data uts lib man
70 # The check target also causes smf(5) service manifests to be validated.
73 # And man page formats
76 MSGSUBDIRS
= cmd ucbcmd lib data
85 MSGDDIRS
= $(DOMAINS
:%=$(MSGROOT
)/%)
86 MSGDIRS
= $(MSGROOT
) $(MSGDDIRS
) $(MSGROOT
)/LC_TIME
89 install := TARGET
= install
90 install1
:= TARGET
= install
91 install2
:= TARGET
= install
92 install_h
:= TARGET
= install_h
93 clean := TARGET
= clean
94 clobber := TARGET
= clobber
95 check := TARGET
= check
100 # Note: install does not cause a build in pkg. To build packages,
101 # cd pkg and do a 'make install'
104 all: mapfiles closedbins sgs .WAIT
$(SUBDIRS
) pkg
107 # The _msg build is a two-step process. First, the _msg dependency
108 # causes recursive makes in $(MSGSUBDIRS), which stages raw message
109 # files in $(ROOT)/catalog. Second, the action from the install
110 # target rule causes those messages to be post-processed from where
111 # they were staged in $(ROOT)/catalog, and the results placed into the
114 # The stage-licenses target causes the license files needed for
115 # packaging to be pulled from $(SRC) and $(CLOSED) and staged in
118 install: install1 install2 _msg stage-licenses
119 @cd msg
; pwd
; $(MAKE
) _msg
120 @
rm -rf
"$(ROOT)/catalog"
122 stage-licenses
: install2
123 @cd pkg
; pwd
; $(MAKE
) stage-licenses
125 install1
: mapfiles closedbins sgs
127 install2
: install1 .WAIT
$(SUBDIRS
)
129 _msg
: _msgdirs rootdirs FRC
130 @for m in
$(MSGSUBDIRS
); do \
131 cd
$$m; pwd
; $(MAKE
) _msg
; cd ..
; \
135 @cd common
/mapfiles
; pwd
; $(MAKE
) install
137 clean: $(SUBDIRS
) head pkg
138 clobber: $(SUBDIRS
) head pkg clobber_local
140 @cd tools
; pwd
; $(MAKE
) clobber
141 @cd common
/mapfiles
; pwd
; $(MAKE
) clobber
142 @cd msg
; pwd
; $(MAKE
) clobber
144 # If the tarballs are included inside ON_CLOSED_BINS, use those to extract and
145 # preserve the permissions (in case a distro ships them).
147 closedbins
: bldtools
$(ROOTDIRS
) FRC
148 @CLOSED_ROOT
="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
149 if
[ -f
"$$ON_CLOSED_BINS/on-closed-bins$${RELEASE_BUILD+-nd}.$(MACH).tar.bz2" ]; then \
150 $(ECHO
) "Extracting tarball $$ON_CLOSED_BINS/on-closed-bins$${RELEASE_BUILD+-nd}.$(MACH).tar.bz2"; \
152 $(TAR
) xjpf
$$ON_CLOSED_BINS/on-closed-bins
$${RELEASE_BUILD
+-nd
}.
$(MACH
).
tar.bz2
); \
153 CLOSED_ROOT
="$(CODEMGR_WS)/closed/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
155 if
[ ! -d
"$$CLOSED_ROOT" ]; then \
156 $(ECHO
) "Error: ON_CLOSED_BINS must point to closed" \
158 $(ECHO
) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \
159 "present in $$ON_CLOSED_BINS."; \
162 $(ECHO
) "Copying closed binaries from $$CLOSED_ROOT"; \
164 $(TAR
) cfX
- $(CODEMGR_WS
)/exception_lists
/closed-bins .
) | \
165 (cd
$(ROOT
); $(TAR
) xBpf
-); \
166 ( cd
$(ROOT
); $(CTFSTRIP
) $$(cd
$$CLOSED_ROOT; $(FIND
) \
167 .
/kernel .
/usr
/kernel .
/platform
/*/kernel
-type f
-a
-perm
-u
+x | \
168 $(EGREP
) -vf
$(CODEMGR_WS
)/exception_lists
/closed-bins
) )
171 # Declare what parts can be built in parallel
172 # DUMMY at the end is used in case macro expansion produces an empty string to
173 # prevent everything going in parallel
175 .PARALLEL
: $(PARALLEL_HEADERS
) DUMMY
176 .PARALLEL
: $(PARALLEL_DIRS
) DUMMY
178 $(SUBDIRS
) head pkg
: FRC
179 @cd
$@
; pwd
; $(MAKE
) $(TARGET
)
181 # librpcsvc has a dependency on headers installed by
182 # userheaders, hence the .WAIT before libheaders.
183 sgs
: rootdirs .WAIT sysheaders userheaders .WAIT \
184 libheaders cmdheaders
187 # Top-level setup target to setup the development environment that includes
188 # headers, tools and generated mapfiles. For open-only builds (i.e.: source
189 # trees w/o usr/closed), this also depends on the closedbins target (above)
190 # in order to properly seed the proto area. Note, although the tools are
191 # dependent on a number of constant mapfiles, the tools themselves are
192 # required to build the generated mapfiles.
194 setup
: closedbins bldtools sgs mapfiles
197 @cd tools
; pwd
; $(MAKE
) install
199 # /var/mail/:saved is a special case because of the colon in the name.
201 rootdirs
: $(ROOTDIRS
)
202 $(INS
) -d
-m
775 $(ROOT
)/var
/mail
/:saved
205 $(MAKE
) -f Makefile.lint
209 $(ROOTDIRS
) $(MSGDIRS
):
213 @cd head
; pwd
; $(MAKE
) install_h
216 @cd lib
; pwd
; $(MAKE
) install_h
219 @cd uts
; pwd
; $(MAKE
) install_h
222 @cd cmd
/devfsadm
; pwd
; $(MAKE
) install_h
223 @cd cmd
/fm
; pwd
; $(MAKE
) install_h
224 @cd cmd
/mdb
; pwd
; $(MAKE
) install_h
226 check: $(CHKHDRSUBDIRS
) $(CHKMFSTSUBDIRS
) $(CHKMANSUBDIRS
)
229 # Cross-reference customization: skip all of the subdirectories that
230 # don't contain actual source code.
232 XRPRUNE
= pkg prototypes
233 XRINCDIRS
= uts
/common head ucbhead
241 # Targets for reporting compiler versions; nightly uses these.
245 @if
$($(MACH
)_CC
) -_versions
>/dev
/null
2>/dev
/null
; then \
246 $(ECHO
) 32-bit compiler
; \
247 $(ECHO
) $($(MACH
)_CC
); \
248 $($(MACH
)_CC
) -_versions
2>&1 | \
249 $(EGREP
) '^(cw|cc|gcc|primary|shadow)'; \
251 __COMPILER
=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
252 if
[ -z
"$$__COMPILER" ]; then \
253 $(ECHO
) No
32-bit compiler found
; \
256 $(ECHO
) 32-bit compiler
; \
257 $(ECHO
) $($(MACH
)_CC
); \
258 $(ECHO
) $$__COMPILER; \
259 $($(MACH
)_CC
) -V
2>&1 | head
-1; \
264 @if
$($(MACH64
)_CC
) -_versions
>/dev
/null
2>/dev
/null
; then \
265 $(ECHO
) 64-bit compiler
; \
266 $(ECHO
) $($(MACH64
)_CC
); \
267 $($(MACH64
)_CC
) -_versions
2>&1 | \
268 $(EGREP
) '^(cw|cc|gcc|primary|shadow)'; \
270 __COMPILER
=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
271 if
[ -z
"$$__COMPILER" ]; then \
272 $(ECHO
) No
64-bit compiler found
; \
275 $(ECHO
) 64-bit compiler
; \
276 $(ECHO
) $($(MACH64
)_CC
); \
277 $(ECHO
) $$__COMPILER; \
278 $($(MACH64
)_CC
) -V
2>&1 | head
-1; \
283 @if
[ -x
"$(JAVAC)" ]; then \
285 $(JAVA_ROOT
)/bin
/java
-fullversion
2>&1 | head
-1; \
287 $(ECHO
) No Java compiler found
; \
292 @if
[ -x
"$(OPENSSL)" ]; then \
293 $(ECHO
) $(OPENSSL
); \
294 $(OPENSSL
) version
; \
295 $(OPENSSL
) version
-f | \
296 $(SED
) -n
'/_API/{s/.*_API/ API/;s/ -.*//;p;}'; \
298 $(ECHO
) No OpenSSL utility found
; \