xref: /titanic_41/usr/src/Makefile (revision 2386db6850f3faeca05a34f5928b3eff8a4a87c6)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5fb9f9b97Skupfer# Common Development and Distribution License (the "License").
6fb9f9b97Skupfer# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
21d583b39bSJohn Wren Kennedy
227c478bd9Sstevel@tonic-gate#
2378add226Sjmcp# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24d583b39bSJohn Wren Kennedy# Copyright (c) 2012 by Delphix. All rights reserved.
2532a712daSGarrett D'Amore# Copyright 2014 Garrett D'Amore <garrett@damore.org>
2678add226Sjmcp#
27d583b39bSJohn Wren Kennedy
287c478bd9Sstevel@tonic-gate#
297c478bd9Sstevel@tonic-gate# Makefile for system source
307c478bd9Sstevel@tonic-gate#
317c478bd9Sstevel@tonic-gate# include global definitions
327c478bd9Sstevel@tonic-gateinclude Makefile.master
337c478bd9Sstevel@tonic-gate#
347c478bd9Sstevel@tonic-gate# the Targetdirs file is the AT&T target.dirs file in a makefile format.
357c478bd9Sstevel@tonic-gate# it defines TARGETDIRS and ROOTDIRS.
367c478bd9Sstevel@tonic-gateinclude Targetdirs
377c478bd9Sstevel@tonic-gate
38*2386db68SMarcel TelkaCOMMON_SUBDIRS=	data uts lib cmd ucblib ucbcmd psm man test
39e3c7c8f8SMark J. Nelsonsparc_SUBDIRS= stand
40e3c7c8f8SMark J. Nelsoni386_SUBDIRS= grub
417c478bd9Sstevel@tonic-gate
427c478bd9Sstevel@tonic-gate#
43e3c7c8f8SMark J. Nelson# sparc needs to build stand before psm
447c478bd9Sstevel@tonic-gate#
45e3c7c8f8SMark J. Nelson$(SPARC_BLD)psm: stand
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gateSUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
487c478bd9Sstevel@tonic-gate
495bbb4db2SGarrett D'AmoreHDRSUBDIRS=	uts head lib cmd
507c478bd9Sstevel@tonic-gate
517c478bd9Sstevel@tonic-gate# UCB headers are bug-for-bug compatible and not checkable against the header
527c478bd9Sstevel@tonic-gate# standards.
537c478bd9Sstevel@tonic-gate#
547c478bd9Sstevel@tonic-gateCHKHDRSUBDIRS=	head uts lib
557c478bd9Sstevel@tonic-gate
5698157a70Sakolb#
5798157a70Sakolb# Headers that can be built in parallel
5898157a70Sakolb#
595bbb4db2SGarrett D'AmorePARALLEL_HEADERS = sysheaders userheaders libheaders cmdheaders
6098157a70Sakolb
6198157a70Sakolb#
6298157a70Sakolb# Directories that can be built in parallel
6398157a70Sakolb#
64*2386db68SMarcel TelkaPARALLEL_DIRS = data uts lib man
6598157a70Sakolb
667c478bd9Sstevel@tonic-gate# The check target also causes smf(5) service manifests to be validated.
677c478bd9Sstevel@tonic-gateCHKMFSTSUBDIRS=	cmd
687c478bd9Sstevel@tonic-gate
6932a712daSGarrett D'Amore# And man page formats
7032a712daSGarrett D'AmoreCHKMANSUBDIRS = man
7132a712daSGarrett D'Amore
72*2386db68SMarcel TelkaMSGSUBDIRS=	cmd ucbcmd lib data
737c478bd9Sstevel@tonic-gateDOMAINS= \
747c478bd9Sstevel@tonic-gate	SUNW_OST_ADMIN \
757c478bd9Sstevel@tonic-gate	SUNW_OST_NETRPC \
767c478bd9Sstevel@tonic-gate	SUNW_OST_OSCMD \
777c478bd9Sstevel@tonic-gate	SUNW_OST_OSLIB \
787c478bd9Sstevel@tonic-gate	SUNW_OST_UCBCMD \
797c478bd9Sstevel@tonic-gate	SUNW_OST_ZONEINFO
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gateMSGDDIRS=       $(DOMAINS:%=$(MSGROOT)/%)
827c478bd9Sstevel@tonic-gateMSGDIRS=        $(MSGROOT) $(MSGDDIRS) $(MSGROOT)/LC_TIME
837c478bd9Sstevel@tonic-gate
84694c35faSJosef 'Jeff' Sipekall :=			TARGET= all
85694c35faSJosef 'Jeff' Sipekinstall :=		TARGET= install
86e3c7c8f8SMark J. Nelsoninstall1 :=		TARGET= install
87e3c7c8f8SMark J. Nelsoninstall2 :=		TARGET= install
887c478bd9Sstevel@tonic-gateinstall_h :=		TARGET= install_h
897c478bd9Sstevel@tonic-gateclean :=		TARGET= clean
907c478bd9Sstevel@tonic-gateclobber :=		TARGET= clobber
917c478bd9Sstevel@tonic-gatecheck :=		TARGET= check
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gate.KEEP_STATE:
947c478bd9Sstevel@tonic-gate
957c478bd9Sstevel@tonic-gate#
96e3c7c8f8SMark J. Nelson# Note: install does not cause a build in pkg.  To build packages,
97ead1f93eSLiane Praza#	cd pkg and do a 'make install'
987c478bd9Sstevel@tonic-gate#
99e3c7c8f8SMark J. Nelson
100e3c7c8f8SMark J. Nelsonall: mapfiles closedbins sgs .WAIT $(SUBDIRS) pkg
101e3c7c8f8SMark J. Nelson
1025084e753SMark J. Nelson#
1035084e753SMark J. Nelson# The _msg build is a two-step process.  First, the _msg dependency
1045084e753SMark J. Nelson# causes recursive makes in $(MSGSUBDIRS), which stages raw message
1055084e753SMark J. Nelson# files in $(ROOT)/catalog.  Second, the action from the install
1065084e753SMark J. Nelson# target rule causes those messages to be post-processed from where
1075084e753SMark J. Nelson# they were staged in $(ROOT)/catalog, and the results placed into the
1085084e753SMark J. Nelson# proto area.
1095084e753SMark J. Nelson#
1105084e753SMark J. Nelson# The stage-licenses target causes the license files needed for
1115084e753SMark J. Nelson# packaging to be pulled from $(SRC) and $(CLOSED) and staged in
1125084e753SMark J. Nelson# $(ROOT)/licenses.
1135084e753SMark J. Nelson#
1145084e753SMark J. Nelsoninstall: install1 install2 _msg stage-licenses
115581cede6SMark J. Nelson	@cd msg; pwd; $(MAKE) _msg
1167c478bd9Sstevel@tonic-gate	@rm -rf "$(ROOT)/catalog"
1177c478bd9Sstevel@tonic-gate
1185084e753SMark J. Nelsonstage-licenses: install2
1195084e753SMark J. Nelson	@cd pkg; pwd; $(MAKE) stage-licenses
1205084e753SMark J. Nelson
121e3c7c8f8SMark J. Nelsoninstall1: mapfiles closedbins sgs
122e3c7c8f8SMark J. Nelson
123e3c7c8f8SMark J. Nelsoninstall2: install1 $(SUBDIRS)
124e3c7c8f8SMark J. Nelson
125b6805bf7SGordon Ross_msg: _msgdirs rootdirs FRC
126e3c7c8f8SMark J. Nelson	@for m in $(MSGSUBDIRS); do \
127e3c7c8f8SMark J. Nelson		cd $$m; pwd; $(MAKE) _msg; cd ..; \
128e3c7c8f8SMark J. Nelson	done
129e3c7c8f8SMark J. Nelson
130232c6638Sriemapfiles: bldtools
13124da5b34Srie	@cd common/mapfiles; pwd; $(MAKE) install
13224da5b34Srie
133b6805bf7SGordon Rossclean: $(SUBDIRS) head pkg
134b6805bf7SGordon Rossclobber: $(SUBDIRS) head pkg clobber_local
135b6805bf7SGordon Rossclobber_local:
136b6805bf7SGordon Ross	@cd tools; pwd; $(MAKE) clobber
137b6805bf7SGordon Ross	@cd common/mapfiles; pwd; $(MAKE) clobber
138b6805bf7SGordon Ross	@cd msg; pwd; $(MAKE) clobber
1397c478bd9Sstevel@tonic-gate
140a0ed5030SJason Kingclosedbins: bldtools $(ROOTDIRS) FRC
1415b43ca41Sah89892	@CLOSED_ROOT="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
1425b43ca41Sah89892	if [ ! -d "$$CLOSED_ROOT" ]; then \
143e95181daSJosef 'Jeff' Sipek		$(ECHO) "Error: ON_CLOSED_BINS must point to closed" \
144e95181daSJosef 'Jeff' Sipek		    "binaries."; \
1455b43ca41Sah89892		$(ECHO) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \
1465b43ca41Sah89892		    "present in $$ON_CLOSED_BINS."; \
147fb9f9b97Skupfer		exit 1; \
148fb9f9b97Skupfer	fi; \
1495b43ca41Sah89892	$(ECHO) "Copying closed binaries from $$CLOSED_ROOT"; \
1502ad72058SGarrett D'Amore	(cd $$CLOSED_ROOT; \
1512ad72058SGarrett D'Amore	    $(TAR) cfX - $(CODEMGR_WS)/exception_lists/closed-bins .) | \
1522ad72058SGarrett D'Amore	    (cd $(ROOT); $(TAR) xBpf -); \
153a0ed5030SJason King	( cd $(ROOT); $(CTFSTRIP) $$(cd $$CLOSED_ROOT; $(FIND) \
154a0ed5030SJason King	    ./kernel ./usr/kernel ./platform/*/kernel -type f -a -perm -u+x | \
155e95181daSJosef 'Jeff' Sipek	    $(EGREP) -vf $(CODEMGR_WS)/exception_lists/closed-bins) )
156fb9f9b97Skupfer
15798157a70Sakolb#
158e3c7c8f8SMark J. Nelson# Declare what parts can be built in parallel
15998157a70Sakolb# DUMMY at the end is used in case macro expansion produces an empty string to
16098157a70Sakolb# prevent everything going in parallel
16198157a70Sakolb#
16298157a70Sakolb.PARALLEL: $(PARALLEL_HEADERS) DUMMY
16398157a70Sakolb.PARALLEL: $(PARALLEL_DIRS) DUMMY
16498157a70Sakolb
165ead1f93eSLiane Praza$(SUBDIRS) head pkg: FRC
1667c478bd9Sstevel@tonic-gate	@cd $@; pwd; $(MAKE) $(TARGET)
1677c478bd9Sstevel@tonic-gate
1687c478bd9Sstevel@tonic-gate# librpcsvc has a dependency on headers installed by
1697c478bd9Sstevel@tonic-gate# userheaders, hence the .WAIT before libheaders.
1707c478bd9Sstevel@tonic-gatesgs: rootdirs .WAIT sysheaders userheaders .WAIT \
1715bbb4db2SGarrett D'Amore	libheaders cmdheaders
1727c478bd9Sstevel@tonic-gate
1737c478bd9Sstevel@tonic-gate#
174232c6638Srie# Top-level setup target to setup the development environment that includes
175232c6638Srie# headers, tools and generated mapfiles.  For open-only builds (i.e.: source
176232c6638Srie# trees w/o usr/closed), this also depends on the closedbins target (above)
177232c6638Srie# in order to properly seed the proto area.  Note, although the tools are
178232c6638Srie# dependent on a number of constant mapfiles, the tools themselves are
179232c6638Srie# required to build the generated mapfiles.
1807345d6c1Sstevel#
18178add226Sjmcpsetup: closedbins bldtools sgs mapfiles
182232c6638Srie
18378add226Sjmcpbldtools:
1847c478bd9Sstevel@tonic-gate	@cd tools; pwd; $(MAKE) install
1857c478bd9Sstevel@tonic-gate
1867c478bd9Sstevel@tonic-gate# /var/mail/:saved is a special case because of the colon in the name.
1877c478bd9Sstevel@tonic-gate#
1887c478bd9Sstevel@tonic-gaterootdirs: $(ROOTDIRS)
1897c478bd9Sstevel@tonic-gate	$(INS) -d -m 775 $(ROOT)/var/mail/:saved
1907c478bd9Sstevel@tonic-gate
1917c478bd9Sstevel@tonic-gatelint: FRC
1927c478bd9Sstevel@tonic-gate	$(MAKE) -f Makefile.lint
1937c478bd9Sstevel@tonic-gate
1947c478bd9Sstevel@tonic-gate_msgdirs:       $(MSGDIRS)
1957c478bd9Sstevel@tonic-gate
1967c478bd9Sstevel@tonic-gate$(ROOTDIRS) $(MSGDIRS):
1977c478bd9Sstevel@tonic-gate	$(INS.dir)
1987c478bd9Sstevel@tonic-gate
1997c478bd9Sstevel@tonic-gateuserheaders: FRC
2007c478bd9Sstevel@tonic-gate	@cd head; pwd; $(MAKE) install_h
2017c478bd9Sstevel@tonic-gate
20278add226Sjmcplibheaders: bldtools
2037c478bd9Sstevel@tonic-gate	@cd lib; pwd; $(MAKE) install_h
2047c478bd9Sstevel@tonic-gate
2057c478bd9Sstevel@tonic-gatesysheaders: FRC
2067c478bd9Sstevel@tonic-gate	@cd uts; pwd; $(MAKE) install_h
2077c478bd9Sstevel@tonic-gate
2087c478bd9Sstevel@tonic-gatecmdheaders: FRC
2097c478bd9Sstevel@tonic-gate	@cd cmd/fm; pwd; $(MAKE) install_h
2107c478bd9Sstevel@tonic-gate	@cd cmd/mdb; pwd; $(MAKE) install_h
2117c478bd9Sstevel@tonic-gate
21232a712daSGarrett D'Amorecheck:	$(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS) $(CHKMANSUBDIRS)
2137c478bd9Sstevel@tonic-gate
2147c478bd9Sstevel@tonic-gate#
2157c478bd9Sstevel@tonic-gate# Cross-reference customization: skip all of the subdirectories that
2167c478bd9Sstevel@tonic-gate# don't contain actual source code.
2177c478bd9Sstevel@tonic-gate#
218694c35faSJosef 'Jeff' SipekXRPRUNE = pkg prototypes
2197c478bd9Sstevel@tonic-gateXRINCDIRS = uts/common head ucbhead
2207c478bd9Sstevel@tonic-gate
2217c478bd9Sstevel@tonic-gatecscope.out tags: FRC
2227c478bd9Sstevel@tonic-gate	$(XREF) -f -x $@
2237c478bd9Sstevel@tonic-gate
2247c478bd9Sstevel@tonic-gateFRC:
2257c478bd9Sstevel@tonic-gate
2267c478bd9Sstevel@tonic-gate#
2277c478bd9Sstevel@tonic-gate# Targets for reporting compiler versions; nightly uses these.
2287c478bd9Sstevel@tonic-gate#
2297c478bd9Sstevel@tonic-gate
2307c478bd9Sstevel@tonic-gatecc-version:
2311912d2c4Swesolows	@if $($(MACH)_CC) -_versions >/dev/null 2>/dev/null; then \
232010b217aSwesolows		$(ECHO) 32-bit compiler;			\
2337c478bd9Sstevel@tonic-gate		$(ECHO) $($(MACH)_CC);				\
2341912d2c4Swesolows		$($(MACH)_CC) -_versions 2>&1 |			\
2351912d2c4Swesolows		    $(EGREP) '^(cw|cc|gcc|primary|shadow)';	\
2367c478bd9Sstevel@tonic-gate	else							\
237bf40377cSwesolows		__COMPILER=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
238bf40377cSwesolows		if [ -z "$$__COMPILER" ]; then			\
239010b217aSwesolows			$(ECHO) No 32-bit compiler found;	\
2407c478bd9Sstevel@tonic-gate			exit 1;					\
241bf40377cSwesolows		else						\
242010b217aSwesolows			$(ECHO) 32-bit compiler;		\
243bf40377cSwesolows			$(ECHO) $($(MACH)_CC);			\
244bf40377cSwesolows			$(ECHO) $$__COMPILER;			\
245bf40377cSwesolows			$($(MACH)_CC) -V 2>&1 | head -1;	\
246bf40377cSwesolows		fi;						\
2477c478bd9Sstevel@tonic-gate	fi
2487c478bd9Sstevel@tonic-gate
2497c478bd9Sstevel@tonic-gatecc64-version:
2501912d2c4Swesolows	@if $($(MACH64)_CC) -_versions >/dev/null 2>/dev/null; then \
251010b217aSwesolows		$(ECHO) 64-bit compiler;			\
2527c478bd9Sstevel@tonic-gate		$(ECHO) $($(MACH64)_CC);			\
2531912d2c4Swesolows		$($(MACH64)_CC) -_versions 2>&1 |		\
2541912d2c4Swesolows		    $(EGREP) '^(cw|cc|gcc|primary|shadow)';	\
2557c478bd9Sstevel@tonic-gate	else							\
256bf40377cSwesolows		__COMPILER=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
257bf40377cSwesolows		if [ -z "$$__COMPILER" ]; then			\
2587c478bd9Sstevel@tonic-gate			$(ECHO) No 64-bit compiler found;	\
259bf40377cSwesolows			exit 1;					\
260bf40377cSwesolows		else						\
261010b217aSwesolows			$(ECHO) 64-bit compiler;		\
262bf40377cSwesolows			$(ECHO) $($(MACH64)_CC);		\
263bf40377cSwesolows			$(ECHO) $$__COMPILER;			\
264bf40377cSwesolows			$($(MACH64)_CC) -V 2>&1 | head -1;	\
265bf40377cSwesolows		fi;						\
2667c478bd9Sstevel@tonic-gate	fi
2677c478bd9Sstevel@tonic-gate
2687c478bd9Sstevel@tonic-gatejava-version:
2697c478bd9Sstevel@tonic-gate	@if [ -x "$(JAVAC)" ]; then			\
2707c478bd9Sstevel@tonic-gate		$(ECHO) $(JAVAC);			\
2717c478bd9Sstevel@tonic-gate		$(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1;	\
2727c478bd9Sstevel@tonic-gate	else						\
2737c478bd9Sstevel@tonic-gate		$(ECHO) No Java compiler found;		\
2747c478bd9Sstevel@tonic-gate		exit 1;					\
2757c478bd9Sstevel@tonic-gate	fi
276