blob: b9be24788834489211061d60c588dfd67903ed99 [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>
jmcp78add222010-07-06 17:14:19 -070026#
John Wren Kennedyd583b392012-12-05 22:04:50 -050027
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070028#
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070029# Makefile for system source
30#
31# include global definitions
32include Makefile.master
33#
34# the Targetdirs file is the AT&T target.dirs file in a makefile format.
35# it defines TARGETDIRS and ROOTDIRS.
36include Targetdirs
37
John Wren Kennedyd583b392012-12-05 22:04:50 -050038COMMON_SUBDIRS= uts lib cmd ucblib ucbcmd psm man test
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -060039sparc_SUBDIRS= stand
40i386_SUBDIRS= grub
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070041
42#
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -060043# sparc needs to build stand before psm
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070044#
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -060045$(SPARC_BLD)psm: stand
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070046
47SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
48
Garrett D'Amore5bbb4db2009-10-09 17:01:12 -070049HDRSUBDIRS= uts head lib cmd
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070050
51# UCB headers are bug-for-bug compatible and not checkable against the header
52# standards.
53#
54CHKHDRSUBDIRS= head uts lib
55
akolb98157a72008-02-27 15:35:58 -080056#
57# Headers that can be built in parallel
58#
Garrett D'Amore5bbb4db2009-10-09 17:01:12 -070059PARALLEL_HEADERS = sysheaders userheaders libheaders cmdheaders
akolb98157a72008-02-27 15:35:58 -080060
61#
62# Directories that can be built in parallel
63#
Richard Lowec10c16d2011-03-14 14:05:30 -040064PARALLEL_DIRS = uts lib man
akolb98157a72008-02-27 15:35:58 -080065
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070066# The check target also causes smf(5) service manifests to be validated.
67CHKMFSTSUBDIRS= cmd
68
Garrett D'Amore95c635e2014-07-14 20:10:37 -070069# And man page formats
70CHKMANSUBDIRS = man
71
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070072MSGSUBDIRS= cmd ucbcmd lib
73DOMAINS= \
74 SUNW_OST_ADMIN \
75 SUNW_OST_NETRPC \
76 SUNW_OST_OSCMD \
77 SUNW_OST_OSLIB \
78 SUNW_OST_UCBCMD \
79 SUNW_OST_ZONEINFO
80
81MSGDDIRS= $(DOMAINS:%=$(MSGROOT)/%)
82MSGDIRS= $(MSGROOT) $(MSGDDIRS) $(MSGROOT)/LC_TIME
83
Josef 'Jeff' Sipek694c35f2013-07-29 16:16:59 -040084all := TARGET= all
85install := TARGET= install
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -060086install1 := TARGET= install
87install2 := TARGET= install
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070088install_h := TARGET= install_h
89clean := TARGET= clean
90clobber := TARGET= clobber
91check := TARGET= check
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070092
93.KEEP_STATE:
94
95#
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -060096# Note: install does not cause a build in pkg. To build packages,
Liane Prazaead1f932010-03-02 19:29:26 -070097# cd pkg and do a 'make install'
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -070098#
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -060099
100all: mapfiles closedbins sgs .WAIT $(SUBDIRS) pkg
101
Mark J. Nelson5084e752010-08-02 16:37:22 -0600102#
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
108# proto area.
109#
110# The stage-licenses target causes the license files needed for
111# packaging to be pulled from $(SRC) and $(CLOSED) and staged in
112# $(ROOT)/licenses.
113#
114install: install1 install2 _msg stage-licenses
Mark J. Nelson581cede2009-08-31 16:44:41 -0600115 @cd msg; pwd; $(MAKE) _msg
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700116 @rm -rf "$(ROOT)/catalog"
117
Mark J. Nelson5084e752010-08-02 16:37:22 -0600118stage-licenses: install2
119 @cd pkg; pwd; $(MAKE) stage-licenses
120
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -0600121install1: mapfiles closedbins sgs
122
123install2: install1 $(SUBDIRS)
124
Gordon Rossb6805bf2013-08-23 18:31:03 -0400125_msg: _msgdirs rootdirs FRC
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -0600126 @for m in $(MSGSUBDIRS); do \
127 cd $$m; pwd; $(MAKE) _msg; cd ..; \
128 done
129
rie232c6632007-06-12 11:39:43 -0700130mapfiles: bldtools
rie24da5b32007-05-17 16:27:31 -0700131 @cd common/mapfiles; pwd; $(MAKE) install
132
Gordon Rossb6805bf2013-08-23 18:31:03 -0400133clean: $(SUBDIRS) head pkg
134clobber: $(SUBDIRS) head pkg clobber_local
135clobber_local:
136 @cd tools; pwd; $(MAKE) clobber
137 @cd common/mapfiles; pwd; $(MAKE) clobber
138 @cd msg; pwd; $(MAKE) clobber
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700139
Jason Kinga0ed5032012-09-14 12:26:23 -0400140closedbins: bldtools $(ROOTDIRS) FRC
ah898925b43ca42006-11-27 21:56:37 -0800141 @CLOSED_ROOT="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
Josef 'Jeff' Sipekc0e79772013-10-15 00:21:04 -0400142 if [ ! -d "$$CLOSED_ROOT" ]; then \
143 $(ECHO) "Error: ON_CLOSED_BINS must point to closed" \
144 "binaries."; \
145 $(ECHO) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \
146 "present in $$ON_CLOSED_BINS."; \
147 exit 1; \
148 fi; \
149 $(ECHO) "Copying closed binaries from $$CLOSED_ROOT"; \
150 (cd $$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) )
kupferfb9f9b92005-12-21 19:47:57 -0800156
akolb98157a72008-02-27 15:35:58 -0800157#
Mark J. Nelsone3c7c8f2010-07-16 13:18:12 -0600158# Declare what parts can be built in parallel
akolb98157a72008-02-27 15:35:58 -0800159# DUMMY at the end is used in case macro expansion produces an empty string to
160# prevent everything going in parallel
161#
162.PARALLEL: $(PARALLEL_HEADERS) DUMMY
163.PARALLEL: $(PARALLEL_DIRS) DUMMY
164
Liane Prazaead1f932010-03-02 19:29:26 -0700165$(SUBDIRS) head pkg: FRC
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700166 @cd $@; pwd; $(MAKE) $(TARGET)
167
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700168# librpcsvc has a dependency on headers installed by
169# userheaders, hence the .WAIT before libheaders.
170sgs: rootdirs .WAIT sysheaders userheaders .WAIT \
Garrett D'Amore5bbb4db2009-10-09 17:01:12 -0700171 libheaders cmdheaders
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700172
173#
rie232c6632007-06-12 11:39:43 -0700174# 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.
stevel7345d6c2006-05-12 15:47:12 -0700180#
jmcp78add222010-07-06 17:14:19 -0700181setup: closedbins bldtools sgs mapfiles
rie232c6632007-06-12 11:39:43 -0700182
jmcp78add222010-07-06 17:14:19 -0700183bldtools:
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700184 @cd tools; pwd; $(MAKE) install
185
186# /var/mail/:saved is a special case because of the colon in the name.
187#
188rootdirs: $(ROOTDIRS)
189 $(INS) -d -m 775 $(ROOT)/var/mail/:saved
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700190
191lint: FRC
192 $(MAKE) -f Makefile.lint
193
194_msgdirs: $(MSGDIRS)
195
196$(ROOTDIRS) $(MSGDIRS):
197 $(INS.dir)
198
199userheaders: FRC
200 @cd head; pwd; $(MAKE) install_h
201
jmcp78add222010-07-06 17:14:19 -0700202libheaders: bldtools
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700203 @cd lib; pwd; $(MAKE) install_h
204
205sysheaders: FRC
206 @cd uts; pwd; $(MAKE) install_h
207
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700208cmdheaders: FRC
209 @cd cmd/fm; pwd; $(MAKE) install_h
210 @cd cmd/mdb; pwd; $(MAKE) install_h
211
Garrett D'Amore95c635e2014-07-14 20:10:37 -0700212check: $(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS) $(CHKMANSUBDIRS)
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700213
214#
215# Cross-reference customization: skip all of the subdirectories that
216# don't contain actual source code.
217#
Josef 'Jeff' Sipek694c35f2013-07-29 16:16:59 -0400218XRPRUNE = pkg prototypes
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700219XRINCDIRS = uts/common head ucbhead
220
221cscope.out tags: FRC
222 $(XREF) -f -x $@
223
224FRC:
225
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700226#
227# Targets for reporting compiler versions; nightly uses these.
228#
229
230cc-version:
wesolows1912d2c2006-04-11 13:06:32 -0700231 @if $($(MACH)_CC) -_versions >/dev/null 2>/dev/null; then \
wesolows010b2172005-08-24 11:01:45 -0700232 $(ECHO) 32-bit compiler; \
wesolowsbf403772005-07-22 18:40:14 -0700233 $(ECHO) $($(MACH)_CC); \
wesolows1912d2c2006-04-11 13:06:32 -0700234 $($(MACH)_CC) -_versions 2>&1 | \
235 $(EGREP) '^(cw|cc|gcc|primary|shadow)'; \
wesolowsbf403772005-07-22 18:40:14 -0700236 else \
237 __COMPILER=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
238 if [ -z "$$__COMPILER" ]; then \
wesolows010b2172005-08-24 11:01:45 -0700239 $(ECHO) No 32-bit compiler found; \
wesolowsbf403772005-07-22 18:40:14 -0700240 exit 1; \
241 else \
wesolows010b2172005-08-24 11:01:45 -0700242 $(ECHO) 32-bit compiler; \
wesolowsbf403772005-07-22 18:40:14 -0700243 $(ECHO) $($(MACH)_CC); \
244 $(ECHO) $$__COMPILER; \
245 $($(MACH)_CC) -V 2>&1 | head -1; \
246 fi; \
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700247 fi
248
249cc64-version:
wesolows1912d2c2006-04-11 13:06:32 -0700250 @if $($(MACH64)_CC) -_versions >/dev/null 2>/dev/null; then \
wesolows010b2172005-08-24 11:01:45 -0700251 $(ECHO) 64-bit compiler; \
wesolowsbf403772005-07-22 18:40:14 -0700252 $(ECHO) $($(MACH64)_CC); \
wesolows1912d2c2006-04-11 13:06:32 -0700253 $($(MACH64)_CC) -_versions 2>&1 | \
254 $(EGREP) '^(cw|cc|gcc|primary|shadow)'; \
wesolowsbf403772005-07-22 18:40:14 -0700255 else \
256 __COMPILER=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
257 if [ -z "$$__COMPILER" ]; then \
258 $(ECHO) No 64-bit compiler found; \
259 exit 1; \
260 else \
wesolows010b2172005-08-24 11:01:45 -0700261 $(ECHO) 64-bit compiler; \
wesolowsbf403772005-07-22 18:40:14 -0700262 $(ECHO) $($(MACH64)_CC); \
263 $(ECHO) $$__COMPILER; \
264 $($(MACH64)_CC) -V 2>&1 | head -1; \
265 fi; \
stevel@tonic-gate7c478bd2005-06-14 00:00:00 -0700266 fi
267
268java-version:
269 @if [ -x "$(JAVAC)" ]; then \
270 $(ECHO) $(JAVAC); \
271 $(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1; \
272 else \
273 $(ECHO) No Java compiler found; \
274 exit 1; \
275 fi