Makefile revision b6805bf78d2bbbeeaea8909a05623587b42d58b3
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# CDDL HEADER START
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# The contents of this file are subject to the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Common Development and Distribution License (the "License").
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# You may not use this file except in compliance with the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# or http://www.opensolaris.org/os/licensing.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# See the License for the specific language governing permissions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# and limitations under the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# When distributing Covered Code, include this CDDL HEADER in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# If applicable, add the following below this CDDL HEADER, with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# fields enclosed by brackets "[]" replaced with your own identifying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# information: Portions Copyright [yyyy] [name of copyright owner]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# CDDL HEADER END
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Copyright (c) 2012 by Delphix. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Makefile for system source
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# include global definitions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chininclude Makefile.master
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# the Targetdirs file is the AT&T target.dirs file in a makefile format.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# it defines TARGETDIRS and ROOTDIRS.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chininclude Targetdirs
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinCOMMON_SUBDIRS= uts lib cmd ucblib ucbcmd psm man test
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinsparc_SUBDIRS= stand
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chini386_SUBDIRS= grub
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# sparc needs to build stand before psm
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin$(SPARC_BLD)psm: stand
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinSUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinHDRSUBDIRS= uts head lib cmd
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# UCB headers are bug-for-bug compatible and not checkable against the header
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# standards.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinCHKHDRSUBDIRS= head uts lib
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Headers that can be built in parallel
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinPARALLEL_HEADERS = sysheaders userheaders libheaders cmdheaders
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Directories that can be built in parallel
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinPARALLEL_DIRS = uts lib man
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# The check target also causes smf(5) service manifests to be validated.
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. FaulknerCHKMFSTSUBDIRS= cmd
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinMSGSUBDIRS= cmd ucbcmd lib
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinDOMAINS= \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin SUNW_OST_ADMIN \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin SUNW_OST_NETRPC \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin SUNW_OST_OSCMD \
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz SUNW_OST_OSLIB \
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz SUNW_OST_UCBCMD \
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz SUNW_OST_ZONEINFO
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinMSGDDIRS= $(DOMAINS:%=$(MSGROOT)/%)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinMSGDIRS= $(MSGROOT) $(MSGDDIRS) $(MSGROOT)/LC_TIME
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinall := TARGET= all
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chininstall := TARGET= install
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chininstall1 := TARGET= install
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chininstall2 := TARGET= install
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chininstall_h := TARGET= install_h
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinclean := TARGET= clean
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinclobber := TARGET= clobber
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chincheck := TARGET= check
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.KEEP_STATE:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Note: install does not cause a build in pkg. To build packages,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# cd pkg and do a 'make install'
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinall: mapfiles closedbins sgs .WAIT $(SUBDIRS) pkg
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# The _msg build is a two-step process. First, the _msg dependency
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# causes recursive makes in $(MSGSUBDIRS), which stages raw message
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# files in $(ROOT)/catalog. Second, the action from the install
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# target rule causes those messages to be post-processed from where
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# they were staged in $(ROOT)/catalog, and the results placed into the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# proto area.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# The stage-licenses target causes the license files needed for
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# packaging to be pulled from $(SRC) and $(CLOSED) and staged in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# $(ROOT)/licenses.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chininstall: install1 install2 _msg stage-licenses
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin @cd msg; pwd; $(MAKE) _msg
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin @rm -rf "$(ROOT)/catalog"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstage-licenses: install2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin @cd pkg; pwd; $(MAKE) stage-licenses
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chininstall1: mapfiles closedbins sgs
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chininstall2: install1 $(SUBDIRS)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin_msg: _msgdirs rootdirs FRC
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin @for m in $(MSGSUBDIRS); do \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin cd $$m; pwd; $(MAKE) _msg; cd ..; \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin done
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinmapfiles: bldtools
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin @cd common/mapfiles; pwd; $(MAKE) install
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinclean: $(SUBDIRS) head pkg
clobber: $(SUBDIRS) head pkg clobber_local
clobber_local:
@cd tools; pwd; $(MAKE) clobber
@cd common/mapfiles; pwd; $(MAKE) clobber
@cd msg; pwd; $(MAKE) clobber
closedbins: bldtools $(ROOTDIRS) FRC
@CLOSED_ROOT="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
if [ "$$CLOSED_IS_PRESENT" = no ]; then \
if [ ! -d "$$CLOSED_ROOT" ]; then \
$(ECHO) "Error: if closed sources are not present," \
"ON_CLOSED_BINS must point to closed binaries."; \
$(ECHO) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \
"present in $$ON_CLOSED_BINS."; \
exit 1; \
fi; \
$(ECHO) "Copying closed binaries from $$CLOSED_ROOT"; \
(cd $$CLOSED_ROOT; \
$(TAR) cfX - $(CODEMGR_WS)/exception_lists/closed-bins .) | \
(cd $(ROOT); $(TAR) xBpf -); \
( cd $(ROOT); $(CTFSTRIP) $$(cd $$CLOSED_ROOT; $(FIND) \
./kernel ./usr/kernel ./platform/*/kernel -type f -a -perm -u+x | \
$(EGREP) -vf $(CODEMGR_WS)/exception_lists/closed-bins) ); \
fi
#
# Declare what parts can be built in parallel
# DUMMY at the end is used in case macro expansion produces an empty string to
# prevent everything going in parallel
#
.PARALLEL: $(PARALLEL_HEADERS) DUMMY
.PARALLEL: $(PARALLEL_DIRS) DUMMY
$(SUBDIRS) head pkg: FRC
@cd $@; pwd; $(MAKE) $(TARGET)
# librpcsvc has a dependency on headers installed by
# userheaders, hence the .WAIT before libheaders.
sgs: rootdirs .WAIT sysheaders userheaders .WAIT \
libheaders cmdheaders
#
# Top-level setup target to setup the development environment that includes
# headers, tools and generated mapfiles. For open-only builds (i.e.: source
# trees w/o usr/closed), this also depends on the closedbins target (above)
# in order to properly seed the proto area. Note, although the tools are
# dependent on a number of constant mapfiles, the tools themselves are
# required to build the generated mapfiles.
#
setup: closedbins bldtools sgs mapfiles
bldtools:
@cd tools; pwd; $(MAKE) install
# /var/mail/:saved is a special case because of the colon in the name.
#
rootdirs: $(ROOTDIRS)
$(INS) -d -m 775 $(ROOT)/var/mail/:saved
lint: FRC
$(MAKE) -f Makefile.lint
_msgdirs: $(MSGDIRS)
$(ROOTDIRS) $(MSGDIRS):
$(INS.dir)
userheaders: FRC
@cd head; pwd; $(MAKE) install_h
libheaders: bldtools
@cd lib; pwd; $(MAKE) install_h
sysheaders: FRC
@cd uts; pwd; $(MAKE) install_h
cmdheaders: FRC
@cd cmd/fm; pwd; $(MAKE) install_h
@cd cmd/mdb; pwd; $(MAKE) install_h
check: $(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS)
#
# Cross-reference customization: skip all of the subdirectories that
# don't contain actual source code.
#
$(CLOSED_BUILD)XRDIRS += ../closed
XRPRUNE = pkg prototypes
XRINCDIRS = uts/common head ucbhead
$(CLOSED_BUILD)XRINCDIRS = uts/common ../closed/uts/common head ucbhead
cscope.out tags: FRC
$(XREF) -f -x $@
FRC:
#
# Targets for reporting compiler versions; nightly uses these.
#
cc-version:
@if $($(MACH)_CC) -_versions >/dev/null 2>/dev/null; then \
$(ECHO) 32-bit compiler; \
$(ECHO) $($(MACH)_CC); \
$($(MACH)_CC) -_versions 2>&1 | \
$(EGREP) '^(cw|cc|gcc|primary|shadow)'; \
else \
__COMPILER=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
if [ -z "$$__COMPILER" ]; then \
$(ECHO) No 32-bit compiler found; \
exit 1; \
else \
$(ECHO) 32-bit compiler; \
$(ECHO) $($(MACH)_CC); \
$(ECHO) $$__COMPILER; \
$($(MACH)_CC) -V 2>&1 | head -1; \
fi; \
fi
cc64-version:
@if $($(MACH64)_CC) -_versions >/dev/null 2>/dev/null; then \
$(ECHO) 64-bit compiler; \
$(ECHO) $($(MACH64)_CC); \
$($(MACH64)_CC) -_versions 2>&1 | \
$(EGREP) '^(cw|cc|gcc|primary|shadow)'; \
else \
__COMPILER=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
if [ -z "$$__COMPILER" ]; then \
$(ECHO) No 64-bit compiler found; \
exit 1; \
else \
$(ECHO) 64-bit compiler; \
$(ECHO) $($(MACH64)_CC); \
$(ECHO) $$__COMPILER; \
$($(MACH64)_CC) -V 2>&1 | head -1; \
fi; \
fi
java-version:
@if [ -x "$(JAVAC)" ]; then \
$(ECHO) $(JAVAC); \
$(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1; \
else \
$(ECHO) No Java compiler found; \
exit 1; \
fi