blob: 56dbdff6b02e54d81758b563f3886c9336dec08b [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
kupferfb9f9b92005-12-21 19:47:57 -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#
John Wren Kennedyd583b392012-12-05 22:04:50 -050021
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070022#
jmcp78add222010-07-06 17:14:19 -070023# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
John Wren Kennedyd583b392012-12-05 22:04:50 -050024# Copyright (c) 2012 by Delphix. All rights reserved.
Garrett D'Amore95c635e2014-07-14 20:10:37 -070025# Copyright 2014 Garrett D'Amore <garrett@damore.org>
Dan McDonald2e27c222015-10-20 19:01:25 -040026# Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved.
Toomas Soome199767f2015-10-25 00:06:51 +030027# Copyright 2016 Toomas Soome <tsoome@me.com>
John Levonaa9ef482018-08-31 15:22:38 +000028# Copyright 2018 Joyent, Inc.
Andy Fiddaman300fdee2018-01-16 21:39:56 +000029# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
jmcp78add222010-07-06 17:14:19 -070030#
John Wren Kennedyd583b392012-12-05 22:04:50 -050031
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070032#
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070033# Makefile for system source
34#
35# include global definitions
36include Makefile.master
37#
38# the Targetdirs file is the AT&T target.dirs file in a makefile format.
39# it defines TARGETDIRS and ROOTDIRS.
40include Targetdirs
41
Yuri Pankov503609a2017-03-29 17:42:07 +030042COMMON_SUBDIRS= data uts lib cmd ucblib ucbcmd psm man test
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -060043sparc_SUBDIRS= stand
Toomas Soome199767f2015-10-25 00:06:51 +030044i386_SUBDIRS= grub boot
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070045
46#
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -060047# sparc needs to build stand before psm
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070048#
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -060049$(SPARC_BLD)psm: stand
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070050
51SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
52
Garrett D'Amore5bbb4db2009-10-09 17:01:12 -070053HDRSUBDIRS= uts head lib cmd
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070054
55# UCB headers are bug-for-bug compatible and not checkable against the header
56# standards.
57#
58CHKHDRSUBDIRS= head uts lib
59
akolb98157a72008-02-27 15:35:58 -080060#
61# Headers that can be built in parallel
62#
Garrett D'Amore5bbb4db2009-10-09 17:01:12 -070063PARALLEL_HEADERS = sysheaders userheaders libheaders cmdheaders
akolb98157a72008-02-27 15:35:58 -080064
65#
66# Directories that can be built in parallel
67#
Yuri Pankov503609a2017-03-29 17:42:07 +030068PARALLEL_DIRS = data uts lib man
akolb98157a72008-02-27 15:35:58 -080069
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070070# The check target also causes smf(5) service manifests to be validated.
71CHKMFSTSUBDIRS= cmd
72
Garrett D'Amore95c635e2014-07-14 20:10:37 -070073# And man page formats
74CHKMANSUBDIRS = man
75
Yuri Pankov503609a2017-03-29 17:42:07 +030076MSGSUBDIRS= cmd ucbcmd lib data
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070077DOMAINS= \
78 SUNW_OST_ADMIN \
79 SUNW_OST_NETRPC \
80 SUNW_OST_OSCMD \
81 SUNW_OST_OSLIB \
82 SUNW_OST_UCBCMD \
83 SUNW_OST_ZONEINFO
84
85MSGDDIRS= $(DOMAINS:%=$(MSGROOT)/%)
86MSGDIRS= $(MSGROOT) $(MSGDDIRS) $(MSGROOT)/LC_TIME
87
Josef 'Jeff' Sipek694c35f2013-07-29 16:16:59 -040088all := TARGET= all
89install := TARGET= install
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -060090install1 := TARGET= install
91install2 := TARGET= install
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070092install_h := TARGET= install_h
93clean := TARGET= clean
94clobber := TARGET= clobber
95check := TARGET= check
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070096
97.KEEP_STATE:
98
99#
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -0600100# Note: install does not cause a build in pkg. To build packages,
Liane Prazaead1f932010-03-02 19:29:26 -0700101# cd pkg and do a 'make install'
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700102#
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -0600103
104all: mapfiles closedbins sgs .WAIT $(SUBDIRS) pkg
105
Mark J. Nelson5084e752010-08-02 16:37:22 -0600106#
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
112# proto area.
113#
114# The stage-licenses target causes the license files needed for
115# packaging to be pulled from $(SRC) and $(CLOSED) and staged in
116# $(ROOT)/licenses.
117#
118install: install1 install2 _msg stage-licenses
Mark J. Nelson581cede2009-08-31 16:44:41 -0600119 @cd msg; pwd; $(MAKE) _msg
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700120 @rm -rf "$(ROOT)/catalog"
121
Mark J. Nelson5084e752010-08-02 16:37:22 -0600122stage-licenses: install2
123 @cd pkg; pwd; $(MAKE) stage-licenses
124
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -0600125install1: mapfiles closedbins sgs
126
Jason Kingf15a6fd2017-06-12 18:10:37 -0500127install2: install1 .WAIT $(SUBDIRS)
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -0600128
Gordon Rossb6805bf2013-08-23 18:31:03 -0400129_msg: _msgdirs rootdirs FRC
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -0600130 @for m in $(MSGSUBDIRS); do \
131 cd $$m; pwd; $(MAKE) _msg; cd ..; \
132 done
133
rie232c6632007-06-12 11:39:43 -0700134mapfiles: bldtools
rie24da5b32007-05-17 16:27:31 -0700135 @cd common/mapfiles; pwd; $(MAKE) install
136
Gordon Rossb6805bf2013-08-23 18:31:03 -0400137clean: $(SUBDIRS) head pkg
138clobber: $(SUBDIRS) head pkg clobber_local
139clobber_local:
140 @cd tools; pwd; $(MAKE) clobber
141 @cd common/mapfiles; pwd; $(MAKE) clobber
142 @cd msg; pwd; $(MAKE) clobber
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700143
Dan McDonald2e27c222015-10-20 19:01:25 -0400144# If the tarballs are included inside ON_CLOSED_BINS, use those to extract and
145# preserve the permissions (in case a distro ships them).
146
Jason Kinga0ed5032012-09-14 12:26:23 -0400147closedbins: bldtools $(ROOTDIRS) FRC
ah898925b43ca42006-11-27 21:56:37 -0800148 @CLOSED_ROOT="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
Dan McDonald2e27c222015-10-20 19:01:25 -0400149 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"; \
151 (cd $(CODEMGR_WS); \
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}"; \
154 fi; \
Josef 'Jeff' Sipekc0e79772013-10-15 00:21:04 -0400155 if [ ! -d "$$CLOSED_ROOT" ]; then \
156 $(ECHO) "Error: ON_CLOSED_BINS must point to closed" \
157 "binaries."; \
158 $(ECHO) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \
159 "present in $$ON_CLOSED_BINS."; \
160 exit 1; \
161 fi; \
162 $(ECHO) "Copying closed binaries from $$CLOSED_ROOT"; \
163 (cd $$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) )
kupferfb9f9b92005-12-21 19:47:57 -0800169
akolb98157a72008-02-27 15:35:58 -0800170#
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -0600171# Declare what parts can be built in parallel
akolb98157a72008-02-27 15:35:58 -0800172# DUMMY at the end is used in case macro expansion produces an empty string to
173# prevent everything going in parallel
174#
175.PARALLEL: $(PARALLEL_HEADERS) DUMMY
176.PARALLEL: $(PARALLEL_DIRS) DUMMY
177
Liane Prazaead1f932010-03-02 19:29:26 -0700178$(SUBDIRS) head pkg: FRC
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700179 @cd $@; pwd; $(MAKE) $(TARGET)
180
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700181# librpcsvc has a dependency on headers installed by
182# userheaders, hence the .WAIT before libheaders.
183sgs: rootdirs .WAIT sysheaders userheaders .WAIT \
Garrett D'Amore5bbb4db2009-10-09 17:01:12 -0700184 libheaders cmdheaders
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700185
186#
rie232c6632007-06-12 11:39:43 -0700187# 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.
stevel7345d6c2006-05-12 15:47:12 -0700193#
jmcp78add222010-07-06 17:14:19 -0700194setup: closedbins bldtools sgs mapfiles
rie232c6632007-06-12 11:39:43 -0700195
jmcp78add222010-07-06 17:14:19 -0700196bldtools:
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700197 @cd tools; pwd; $(MAKE) install
198
199# /var/mail/:saved is a special case because of the colon in the name.
200#
201rootdirs: $(ROOTDIRS)
202 $(INS) -d -m 775 $(ROOT)/var/mail/:saved
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700203
204lint: FRC
205 $(MAKE) -f Makefile.lint
206
207_msgdirs: $(MSGDIRS)
208
209$(ROOTDIRS) $(MSGDIRS):
210 $(INS.dir)
211
212userheaders: FRC
213 @cd head; pwd; $(MAKE) install_h
214
jmcp78add222010-07-06 17:14:19 -0700215libheaders: bldtools
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700216 @cd lib; pwd; $(MAKE) install_h
217
218sysheaders: FRC
219 @cd uts; pwd; $(MAKE) install_h
220
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700221cmdheaders: FRC
Patrick Mooney2dc323c2016-12-29 19:07:36 +0000222 @cd cmd/devfsadm; pwd; $(MAKE) install_h
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700223 @cd cmd/fm; pwd; $(MAKE) install_h
224 @cd cmd/mdb; pwd; $(MAKE) install_h
225
Garrett D'Amore95c635e2014-07-14 20:10:37 -0700226check: $(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS) $(CHKMANSUBDIRS)
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700227
228#
229# Cross-reference customization: skip all of the subdirectories that
230# don't contain actual source code.
231#
Josef 'Jeff' Sipek694c35f2013-07-29 16:16:59 -0400232XRPRUNE = pkg prototypes
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700233XRINCDIRS = uts/common head ucbhead
234
235cscope.out tags: FRC
236 $(XREF) -f -x $@
237
238FRC:
239
John Levonaa9ef482018-08-31 15:22:38 +0000240# used by nightly
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700241cc-version:
John Levonaa9ef482018-08-31 15:22:38 +0000242 @$(CW) --versions $(CW_CC_COMPILERS) 2>&1
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700243
John Levonaa9ef482018-08-31 15:22:38 +0000244# for older nightlies
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700245cc64-version:
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700246
247java-version:
248 @if [ -x "$(JAVAC)" ]; then \
249 $(ECHO) $(JAVAC); \
250 $(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1; \
251 else \
252 $(ECHO) No Java compiler found; \
253 exit 1; \
254 fi
Andy Fiddaman300fdee2018-01-16 21:39:56 +0000255
256openssl-version:
257 @if [ -x "$(OPENSSL)" ]; then \
258 $(ECHO) $(OPENSSL); \
259 $(OPENSSL) version; \
260 $(OPENSSL) version -f | \
261 $(SED) -n '/_API/{s/.*_API/ API/;s/ -.*//;p;}'; \
262 else \
263 $(ECHO) No OpenSSL utility found; \
264 fi