dmake top level: also parallelize _msg
[unleashed.git] / usr / src / Makefile
blob00bf121e19084f083364635cf31ce6030f199648
2 # CDDL HEADER START
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]
19 # CDDL HEADER END
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>
28 # Copyright 2017 Joyent, Inc.
32 # Makefile for system source
34 # include global definitions
35 include Makefile.master
37 # the Targetdirs file is the AT&T target.dirs file in a makefile format.
38 # it defines TARGETDIRS and ROOTDIRS.
39 include Targetdirs
41 COMMON_SUBDIRS= uts lib cmd psm test
42 sparc_SUBDIRS= stand
43 i386_SUBDIRS= boot
46 # sparc needs to build stand before psm
48 $(SPARC_BLD)psm: stand
50 SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
52 HDRSUBDIRS= uts lib cmd
54 # UCB headers are bug-for-bug compatible and not checkable against the header
55 # standards.
57 CHKHDRSUBDIRS= uts lib
59 # The check target also causes smf(5) service manifests to be validated.
60 CHKMFSTSUBDIRS= cmd
62 MSGSUBDIRS= cmd lib
63 DOMAINS= \
64 SUNW_OST_ADMIN \
65 SUNW_OST_NETRPC \
66 SUNW_OST_OSCMD \
67 SUNW_OST_OSLIB
69 MSGDDIRS= $(DOMAINS:%=$(MSGROOT)/%)
70 MSGDIRS= $(MSGROOT) $(MSGDDIRS) $(MSGROOT)/LC_TIME
72 all := TARGET= all
73 install := TARGET= install
74 install1 := TARGET= install
75 install2 := TARGET= install
76 install_h := TARGET= install_h
77 clean := TARGET= clean
78 clobber := TARGET= clobber
79 check := TARGET= check
81 .KEEP_STATE:
84 # Note: install does not cause a build in pkg. To build packages,
85 # cd pkg and do a 'make install'
88 all: mapfiles sgs .WAIT $(SUBDIRS)
91 # The _msg build is a two-step process. First, the _msg dependency
92 # causes recursive makes in $(MSGSUBDIRS), which stages raw message
93 # files in $(ROOT)/catalog. Second, the action from the install
94 # target rule causes those messages to be post-processed from where
95 # they were staged in $(ROOT)/catalog, and the results placed into the
96 # proto area.
98 install: install1 install2 _msg
99 @cd msg; pwd; $(MAKE) _msg
100 @rm -rf "$(ROOT)/catalog"
102 install1: mapfiles sgs
104 install2: install1 .WAIT $(SUBDIRS)
106 _msg: _msgdirs rootdirs FRC
107 @for m in $(MSGSUBDIRS); do \
108 cd $$m; pwd; $(MAKE) _msg; cd ..; \
109 done
111 mapfiles: bldtools
112 @cd common/mapfiles; pwd; $(MAKE) install
114 clean: $(SUBDIRS) pkg
115 clobber: $(SUBDIRS) pkg clobber_local
116 clobber_local:
117 @cd tools; pwd; $(MAKE) clobber
118 @cd common/mapfiles; pwd; $(MAKE) clobber
119 @cd msg; pwd; $(MAKE) clobber
122 # Declare what parts can be built in parallel
124 .PARALLEL: sysheaders libheaders cmdheaders
125 .PARALLEL: uts lib boot cmd test _msg
127 boot cmd test: lib
128 _msg: cmd lib
130 $(SUBDIRS) pkg: FRC
131 @cd $@; pwd; $(MAKE) $(TARGET)
133 sgs: rootdirs .WAIT sysheaders .WAIT \
134 libheaders cmdheaders
137 # Top-level setup target to setup the development environment that includes
138 # headers, tools and generated mapfiles. Note, although the tools are
139 # dependent on a number of constant mapfiles, the tools themselves are
140 # required to build the generated mapfiles.
142 setup: bldtools sgs mapfiles
144 bldtools:
145 @cd tools; pwd; $(MAKE) install
147 # /var/mail/:saved is a special case because of the colon in the name.
149 rootdirs: $(ROOTDIRS)
150 $(INS) -d -m 775 $(ROOT)/var/mail/:saved
152 _msgdirs: $(MSGDIRS)
154 $(ROOTDIRS) $(MSGDIRS):
155 $(INS.dir)
157 libheaders: bldtools
158 @cd lib; pwd; $(MAKE) install_h
159 @cd $(SRCTOP)/lib && make obj && make includes DESTDIR=$(ROOT)
161 sysheaders: FRC
162 @cd uts; pwd; $(MAKE) install_h
164 cmdheaders: FRC
165 @cd cmd/devfsadm; pwd; $(MAKE) install_h
166 @cd cmd/fm; pwd; $(MAKE) install_h
167 @cd cmd/mdb; pwd; $(MAKE) install_h
169 check: $(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS)
171 FRC: