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>
31 # Makefile for system source
33 # include global definitions
34 include Makefile.master
36 # the Targetdirs file is the AT&T target.dirs file in a makefile format.
37 # it defines TARGETDIRS and ROOTDIRS.
40 COMMON_SUBDIRS
= uts lib cmd psm man
test
45 # sparc needs to build stand before psm
47 $(SPARC_BLD
)psm
: stand
49 SUBDIRS
= $(COMMON_SUBDIRS
) $($(MACH
)_SUBDIRS
)
51 HDRSUBDIRS
= uts lib cmd
53 # UCB headers are bug-for-bug compatible and not checkable against the header
56 CHKHDRSUBDIRS
= uts lib
59 # Headers that can be built in parallel
61 PARALLEL_HEADERS
= sysheaders libheaders cmdheaders
64 # Directories that can be built in parallel
66 PARALLEL_DIRS
= uts lib man
68 # The check target also causes smf(5) service manifests to be validated.
71 # And man page formats
82 MSGDDIRS
= $(DOMAINS
:%=$(MSGROOT
)/%)
83 MSGDIRS
= $(MSGROOT
) $(MSGDDIRS
) $(MSGROOT
)/LC_TIME
86 install := TARGET
= install
87 install1
:= TARGET
= install
88 install2
:= TARGET
= install
89 install_h
:= TARGET
= install_h
90 clean := TARGET
= clean
91 clobber := TARGET
= clobber
92 check := TARGET
= check
97 # Note: install does not cause a build in pkg. To build packages,
98 # cd pkg and do a 'make install'
101 all: mapfiles closedbins sgs .WAIT
$(SUBDIRS
) pkg
104 # The _msg build is a two-step process. First, the _msg dependency
105 # causes recursive makes in $(MSGSUBDIRS), which stages raw message
106 # files in $(ROOT)/catalog. Second, the action from the install
107 # target rule causes those messages to be post-processed from where
108 # they were staged in $(ROOT)/catalog, and the results placed into the
111 # The stage-licenses target causes the license files needed for
112 # packaging to be pulled from $(SRC) and $(CLOSED) and staged in
115 install: install1 install2 _msg stage-licenses
116 @cd msg
; pwd
; $(MAKE
) _msg
117 @
rm -rf
"$(ROOT)/catalog"
119 stage-licenses
: install2
120 @cd pkg
; pwd
; $(MAKE
) stage-licenses
122 install1
: mapfiles closedbins sgs
124 install2
: install1
$(SUBDIRS
)
126 _msg
: _msgdirs rootdirs FRC
127 @for m in
$(MSGSUBDIRS
); do \
128 cd
$$m; pwd
; $(MAKE
) _msg
; cd ..
; \
132 @cd common
/mapfiles
; pwd
; $(MAKE
) install
134 clean: $(SUBDIRS
) pkg
135 clobber: $(SUBDIRS
) pkg clobber_local
137 @cd tools
; pwd
; $(MAKE
) clobber
138 @cd common
/mapfiles
; pwd
; $(MAKE
) clobber
139 @cd msg
; pwd
; $(MAKE
) clobber
141 # If the tarballs are included inside ON_CLOSED_BINS, use those to extract and
142 # preserve the permissions (in case a distro ships them).
144 closedbins
: bldtools
$(ROOTDIRS
) FRC
145 @CLOSED_ROOT
="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
146 if
[ -f
"$$ON_CLOSED_BINS/on-closed-bins$${RELEASE_BUILD+-nd}.$(MACH).tar.bz2" ]; then \
147 $(ECHO
) "Extracting tarball $$ON_CLOSED_BINS/on-closed-bins$${RELEASE_BUILD+-nd}.$(MACH).tar.bz2"; \
149 $(TAR
) xjpf
$$ON_CLOSED_BINS/on-closed-bins
$${RELEASE_BUILD
+-nd
}.
$(MACH
).
tar.bz2
); \
150 CLOSED_ROOT
="$(CODEMGR_WS)/closed/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
152 if
[ ! -d
"$$CLOSED_ROOT" ]; then \
153 $(ECHO
) "Error: ON_CLOSED_BINS must point to closed" \
155 $(ECHO
) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \
156 "present in $$ON_CLOSED_BINS."; \
159 $(ECHO
) "Copying closed binaries from $$CLOSED_ROOT"; \
161 $(TAR
) cfX
- $(CODEMGR_WS
)/exception_lists
/closed-bins .
) | \
162 (cd
$(ROOT
); $(TAR
) xBpf
-); \
163 ( cd
$(ROOT
); $(CTFSTRIP
) $$(cd
$$CLOSED_ROOT; $(FIND
) \
164 .
/kernel .
/usr
/kernel .
/platform
/*/kernel
-type f
-a
-perm
-u
+x | \
165 $(EGREP
) -vf
$(CODEMGR_WS
)/exception_lists
/closed-bins
) )
168 # Declare what parts can be built in parallel
169 # DUMMY at the end is used in case macro expansion produces an empty string to
170 # prevent everything going in parallel
172 .PARALLEL
: $(PARALLEL_HEADERS
) DUMMY
173 .PARALLEL
: $(PARALLEL_DIRS
) DUMMY
176 @cd
$@
; pwd
; $(MAKE
) $(TARGET
)
178 sgs
: rootdirs .WAIT sysheaders .WAIT \
179 libheaders cmdheaders
182 # Top-level setup target to setup the development environment that includes
183 # headers, tools and generated mapfiles. For open-only builds (i.e.: source
184 # trees w/o usr/closed), this also depends on the closedbins target (above)
185 # in order to properly seed the proto area. Note, although the tools are
186 # dependent on a number of constant mapfiles, the tools themselves are
187 # required to build the generated mapfiles.
189 setup
: closedbins bldtools sgs mapfiles
192 @cd tools
; pwd
; $(MAKE
) install
194 # /var/mail/:saved is a special case because of the colon in the name.
196 rootdirs
: $(ROOTDIRS
)
197 $(INS
) -d
-m
775 $(ROOT
)/var
/mail
/:saved
201 $(ROOTDIRS
) $(MSGDIRS
):
205 @cd lib
; pwd
; $(MAKE
) install_h
208 @cd uts
; pwd
; $(MAKE
) install_h
211 @cd cmd
/fm
; pwd
; $(MAKE
) install_h
212 @cd cmd
/mdb
; pwd
; $(MAKE
) install_h
214 check: $(CHKHDRSUBDIRS
) $(CHKMFSTSUBDIRS
) $(CHKMANSUBDIRS
)