9348 mii: duplicate 'const' declaration specifier
[unleashed.git] / usr / src / Makefile
blob26e0988215fa2a85223a94a3bd4618eeeed12a17
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= data uts lib cmd ucblib ucbcmd psm man test
42 sparc_SUBDIRS= stand
43 i386_SUBDIRS= grub boot
46 # sparc needs to build stand before psm
48 $(SPARC_BLD)psm: stand
50 SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
52 HDRSUBDIRS= uts head lib cmd
54 # UCB headers are bug-for-bug compatible and not checkable against the header
55 # standards.
57 CHKHDRSUBDIRS= head uts lib
60 # Headers that can be built in parallel
62 PARALLEL_HEADERS = sysheaders userheaders libheaders cmdheaders
65 # Directories that can be built in parallel
67 PARALLEL_DIRS = data uts lib man
69 # The check target also causes smf(5) service manifests to be validated.
70 CHKMFSTSUBDIRS= cmd
72 # And man page formats
73 CHKMANSUBDIRS = man
75 MSGSUBDIRS= cmd ucbcmd lib data
76 DOMAINS= \
77 SUNW_OST_ADMIN \
78 SUNW_OST_NETRPC \
79 SUNW_OST_OSCMD \
80 SUNW_OST_OSLIB \
81 SUNW_OST_UCBCMD \
82 SUNW_OST_ZONEINFO
84 MSGDDIRS= $(DOMAINS:%=$(MSGROOT)/%)
85 MSGDIRS= $(MSGROOT) $(MSGDDIRS) $(MSGROOT)/LC_TIME
87 all := TARGET= all
88 install := TARGET= install
89 install1 := TARGET= install
90 install2 := TARGET= install
91 install_h := TARGET= install_h
92 clean := TARGET= clean
93 clobber := TARGET= clobber
94 check := TARGET= check
96 .KEEP_STATE:
99 # Note: install does not cause a build in pkg. To build packages,
100 # cd pkg and do a 'make install'
103 all: mapfiles closedbins sgs .WAIT $(SUBDIRS) pkg
106 # The _msg build is a two-step process. First, the _msg dependency
107 # causes recursive makes in $(MSGSUBDIRS), which stages raw message
108 # files in $(ROOT)/catalog. Second, the action from the install
109 # target rule causes those messages to be post-processed from where
110 # they were staged in $(ROOT)/catalog, and the results placed into the
111 # proto area.
113 # The stage-licenses target causes the license files needed for
114 # packaging to be pulled from $(SRC) and $(CLOSED) and staged in
115 # $(ROOT)/licenses.
117 install: install1 install2 _msg stage-licenses
118 @cd msg; pwd; $(MAKE) _msg
119 @rm -rf "$(ROOT)/catalog"
121 stage-licenses: install2
122 @cd pkg; pwd; $(MAKE) stage-licenses
124 install1: mapfiles closedbins sgs
126 install2: install1 .WAIT $(SUBDIRS)
128 _msg: _msgdirs rootdirs FRC
129 @for m in $(MSGSUBDIRS); do \
130 cd $$m; pwd; $(MAKE) _msg; cd ..; \
131 done
133 mapfiles: bldtools
134 @cd common/mapfiles; pwd; $(MAKE) install
136 clean: $(SUBDIRS) head pkg
137 clobber: $(SUBDIRS) head pkg clobber_local
138 clobber_local:
139 @cd tools; pwd; $(MAKE) clobber
140 @cd common/mapfiles; pwd; $(MAKE) clobber
141 @cd msg; pwd; $(MAKE) clobber
143 # If the tarballs are included inside ON_CLOSED_BINS, use those to extract and
144 # preserve the permissions (in case a distro ships them).
146 closedbins: bldtools $(ROOTDIRS) FRC
147 @CLOSED_ROOT="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
148 if [ -f "$$ON_CLOSED_BINS/on-closed-bins$${RELEASE_BUILD+-nd}.$(MACH).tar.bz2" ]; then \
149 $(ECHO) "Extracting tarball $$ON_CLOSED_BINS/on-closed-bins$${RELEASE_BUILD+-nd}.$(MACH).tar.bz2"; \
150 (cd $(CODEMGR_WS); \
151 $(TAR) xjpf $$ON_CLOSED_BINS/on-closed-bins$${RELEASE_BUILD+-nd}.$(MACH).tar.bz2); \
152 CLOSED_ROOT="$(CODEMGR_WS)/closed/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
153 fi; \
154 if [ ! -d "$$CLOSED_ROOT" ]; then \
155 $(ECHO) "Error: ON_CLOSED_BINS must point to closed" \
156 "binaries."; \
157 $(ECHO) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \
158 "present in $$ON_CLOSED_BINS."; \
159 exit 1; \
160 fi; \
161 $(ECHO) "Copying closed binaries from $$CLOSED_ROOT"; \
162 (cd $$CLOSED_ROOT; \
163 $(TAR) cfX - $(CODEMGR_WS)/exception_lists/closed-bins .) | \
164 (cd $(ROOT); $(TAR) xBpf -); \
165 ( cd $(ROOT); $(CTFSTRIP) $$(cd $$CLOSED_ROOT; $(FIND) \
166 ./kernel ./usr/kernel ./platform/*/kernel -type f -a -perm -u+x | \
167 $(EGREP) -vf $(CODEMGR_WS)/exception_lists/closed-bins) )
170 # Declare what parts can be built in parallel
171 # DUMMY at the end is used in case macro expansion produces an empty string to
172 # prevent everything going in parallel
174 .PARALLEL: $(PARALLEL_HEADERS) DUMMY
175 .PARALLEL: $(PARALLEL_DIRS) DUMMY
177 $(SUBDIRS) head pkg: FRC
178 @cd $@; pwd; $(MAKE) $(TARGET)
180 # librpcsvc has a dependency on headers installed by
181 # userheaders, hence the .WAIT before libheaders.
182 sgs: rootdirs .WAIT sysheaders userheaders .WAIT \
183 libheaders cmdheaders
186 # Top-level setup target to setup the development environment that includes
187 # headers, tools and generated mapfiles. For open-only builds (i.e.: source
188 # trees w/o usr/closed), this also depends on the closedbins target (above)
189 # in order to properly seed the proto area. Note, although the tools are
190 # dependent on a number of constant mapfiles, the tools themselves are
191 # required to build the generated mapfiles.
193 setup: closedbins bldtools sgs mapfiles
195 bldtools:
196 @cd tools; pwd; $(MAKE) install
198 # /var/mail/:saved is a special case because of the colon in the name.
200 rootdirs: $(ROOTDIRS)
201 $(INS) -d -m 775 $(ROOT)/var/mail/:saved
203 lint: FRC
204 $(MAKE) -f Makefile.lint
206 _msgdirs: $(MSGDIRS)
208 $(ROOTDIRS) $(MSGDIRS):
209 $(INS.dir)
211 userheaders: FRC
212 @cd head; pwd; $(MAKE) install_h
214 libheaders: bldtools
215 @cd lib; pwd; $(MAKE) install_h
217 sysheaders: FRC
218 @cd uts; pwd; $(MAKE) install_h
220 cmdheaders: FRC
221 @cd cmd/devfsadm; pwd; $(MAKE) install_h
222 @cd cmd/fm; pwd; $(MAKE) install_h
223 @cd cmd/mdb; pwd; $(MAKE) install_h
225 check: $(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS) $(CHKMANSUBDIRS)
228 # Cross-reference customization: skip all of the subdirectories that
229 # don't contain actual source code.
231 XRPRUNE = pkg prototypes
232 XRINCDIRS = uts/common head ucbhead
234 cscope.out tags: FRC
235 $(XREF) -f -x $@
237 FRC:
240 # Targets for reporting compiler versions; nightly uses these.
243 cc-version:
244 @if $($(MACH)_CC) -_versions >/dev/null 2>/dev/null; then \
245 $(ECHO) 32-bit compiler; \
246 $(ECHO) $($(MACH)_CC); \
247 $($(MACH)_CC) -_versions 2>&1 | \
248 $(EGREP) '^(cw|cc|gcc|primary|shadow)'; \
249 else \
250 __COMPILER=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
251 if [ -z "$$__COMPILER" ]; then \
252 $(ECHO) No 32-bit compiler found; \
253 exit 1; \
254 else \
255 $(ECHO) 32-bit compiler; \
256 $(ECHO) $($(MACH)_CC); \
257 $(ECHO) $$__COMPILER; \
258 $($(MACH)_CC) -V 2>&1 | head -1; \
259 fi; \
262 cc64-version:
263 @if $($(MACH64)_CC) -_versions >/dev/null 2>/dev/null; then \
264 $(ECHO) 64-bit compiler; \
265 $(ECHO) $($(MACH64)_CC); \
266 $($(MACH64)_CC) -_versions 2>&1 | \
267 $(EGREP) '^(cw|cc|gcc|primary|shadow)'; \
268 else \
269 __COMPILER=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
270 if [ -z "$$__COMPILER" ]; then \
271 $(ECHO) No 64-bit compiler found; \
272 exit 1; \
273 else \
274 $(ECHO) 64-bit compiler; \
275 $(ECHO) $($(MACH64)_CC); \
276 $(ECHO) $$__COMPILER; \
277 $($(MACH64)_CC) -V 2>&1 | head -1; \
278 fi; \
281 java-version:
282 @if [ -x "$(JAVAC)" ]; then \
283 $(ECHO) $(JAVAC); \
284 $(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1; \
285 else \
286 $(ECHO) No Java compiler found; \
287 exit 1; \