4266 remove Makefile*.shared nonsense in uts
[illumos-gate.git] / usr / src / Makefile
blobef522a4817ee9c0cd11db8db8fedce431d38a0a8
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.
28 # Makefile for system source
30 # include global definitions
31 include Makefile.master
33 # the Targetdirs file is the AT&T target.dirs file in a makefile format.
34 # it defines TARGETDIRS and ROOTDIRS.
35 include Targetdirs
37 COMMON_SUBDIRS= uts lib cmd ucblib ucbcmd psm man test
38 sparc_SUBDIRS= stand
39 i386_SUBDIRS= grub
42 # sparc needs to build stand before psm
44 $(SPARC_BLD)psm: stand
46 SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
48 HDRSUBDIRS= uts head lib cmd
50 # UCB headers are bug-for-bug compatible and not checkable against the header
51 # standards.
53 CHKHDRSUBDIRS= head uts lib
56 # Headers that can be built in parallel
58 PARALLEL_HEADERS = sysheaders userheaders libheaders cmdheaders
61 # Directories that can be built in parallel
63 PARALLEL_DIRS = uts lib man
65 # The check target also causes smf(5) service manifests to be validated.
66 CHKMFSTSUBDIRS= cmd
68 MSGSUBDIRS= cmd ucbcmd lib
69 DOMAINS= \
70 SUNW_OST_ADMIN \
71 SUNW_OST_NETRPC \
72 SUNW_OST_OSCMD \
73 SUNW_OST_OSLIB \
74 SUNW_OST_UCBCMD \
75 SUNW_OST_ZONEINFO
77 MSGDDIRS= $(DOMAINS:%=$(MSGROOT)/%)
78 MSGDIRS= $(MSGROOT) $(MSGDDIRS) $(MSGROOT)/LC_TIME
80 all := TARGET= all
81 install := TARGET= install
82 install1 := TARGET= install
83 install2 := TARGET= install
84 install_h := TARGET= install_h
85 clean := TARGET= clean
86 clobber := TARGET= clobber
87 check := TARGET= check
89 .KEEP_STATE:
92 # Note: install does not cause a build in pkg. To build packages,
93 # cd pkg and do a 'make install'
96 all: mapfiles closedbins sgs .WAIT $(SUBDIRS) pkg
99 # The _msg build is a two-step process. First, the _msg dependency
100 # causes recursive makes in $(MSGSUBDIRS), which stages raw message
101 # files in $(ROOT)/catalog. Second, the action from the install
102 # target rule causes those messages to be post-processed from where
103 # they were staged in $(ROOT)/catalog, and the results placed into the
104 # proto area.
106 # The stage-licenses target causes the license files needed for
107 # packaging to be pulled from $(SRC) and $(CLOSED) and staged in
108 # $(ROOT)/licenses.
110 install: install1 install2 _msg stage-licenses
111 @cd msg; pwd; $(MAKE) _msg
112 @rm -rf "$(ROOT)/catalog"
114 stage-licenses: install2
115 @cd pkg; pwd; $(MAKE) stage-licenses
117 install1: mapfiles closedbins sgs
119 install2: install1 $(SUBDIRS)
121 _msg: _msgdirs rootdirs FRC
122 @for m in $(MSGSUBDIRS); do \
123 cd $$m; pwd; $(MAKE) _msg; cd ..; \
124 done
126 mapfiles: bldtools
127 @cd common/mapfiles; pwd; $(MAKE) install
129 clean: $(SUBDIRS) head pkg
130 clobber: $(SUBDIRS) head pkg clobber_local
131 clobber_local:
132 @cd tools; pwd; $(MAKE) clobber
133 @cd common/mapfiles; pwd; $(MAKE) clobber
134 @cd msg; pwd; $(MAKE) clobber
136 closedbins: bldtools $(ROOTDIRS) FRC
137 @CLOSED_ROOT="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
138 if [ ! -d "$$CLOSED_ROOT" ]; then \
139 $(ECHO) "Error: ON_CLOSED_BINS must point to closed" \
140 "binaries."; \
141 $(ECHO) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \
142 "present in $$ON_CLOSED_BINS."; \
143 exit 1; \
144 fi; \
145 $(ECHO) "Copying closed binaries from $$CLOSED_ROOT"; \
146 (cd $$CLOSED_ROOT; \
147 $(TAR) cfX - $(CODEMGR_WS)/exception_lists/closed-bins .) | \
148 (cd $(ROOT); $(TAR) xBpf -); \
149 ( cd $(ROOT); $(CTFSTRIP) $$(cd $$CLOSED_ROOT; $(FIND) \
150 ./kernel ./usr/kernel ./platform/*/kernel -type f -a -perm -u+x | \
151 $(EGREP) -vf $(CODEMGR_WS)/exception_lists/closed-bins) )
154 # Declare what parts can be built in parallel
155 # DUMMY at the end is used in case macro expansion produces an empty string to
156 # prevent everything going in parallel
158 .PARALLEL: $(PARALLEL_HEADERS) DUMMY
159 .PARALLEL: $(PARALLEL_DIRS) DUMMY
161 $(SUBDIRS) head pkg: FRC
162 @cd $@; pwd; $(MAKE) $(TARGET)
164 # librpcsvc has a dependency on headers installed by
165 # userheaders, hence the .WAIT before libheaders.
166 sgs: rootdirs .WAIT sysheaders userheaders .WAIT \
167 libheaders cmdheaders
170 # Top-level setup target to setup the development environment that includes
171 # headers, tools and generated mapfiles. For open-only builds (i.e.: source
172 # trees w/o usr/closed), this also depends on the closedbins target (above)
173 # in order to properly seed the proto area. Note, although the tools are
174 # dependent on a number of constant mapfiles, the tools themselves are
175 # required to build the generated mapfiles.
177 setup: closedbins bldtools sgs mapfiles
179 bldtools:
180 @cd tools; pwd; $(MAKE) install
182 # /var/mail/:saved is a special case because of the colon in the name.
184 rootdirs: $(ROOTDIRS)
185 $(INS) -d -m 775 $(ROOT)/var/mail/:saved
187 lint: FRC
188 $(MAKE) -f Makefile.lint
190 _msgdirs: $(MSGDIRS)
192 $(ROOTDIRS) $(MSGDIRS):
193 $(INS.dir)
195 userheaders: FRC
196 @cd head; pwd; $(MAKE) install_h
198 libheaders: bldtools
199 @cd lib; pwd; $(MAKE) install_h
201 sysheaders: FRC
202 @cd uts; pwd; $(MAKE) install_h
204 cmdheaders: FRC
205 @cd cmd/fm; pwd; $(MAKE) install_h
206 @cd cmd/mdb; pwd; $(MAKE) install_h
208 check: $(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS)
211 # Cross-reference customization: skip all of the subdirectories that
212 # don't contain actual source code.
214 XRPRUNE = pkg prototypes
215 XRINCDIRS = uts/common head ucbhead
217 cscope.out tags: FRC
218 $(XREF) -f -x $@
220 FRC:
223 # Targets for reporting compiler versions; nightly uses these.
226 cc-version:
227 @if $($(MACH)_CC) -_versions >/dev/null 2>/dev/null; then \
228 $(ECHO) 32-bit compiler; \
229 $(ECHO) $($(MACH)_CC); \
230 $($(MACH)_CC) -_versions 2>&1 | \
231 $(EGREP) '^(cw|cc|gcc|primary|shadow)'; \
232 else \
233 __COMPILER=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
234 if [ -z "$$__COMPILER" ]; then \
235 $(ECHO) No 32-bit compiler found; \
236 exit 1; \
237 else \
238 $(ECHO) 32-bit compiler; \
239 $(ECHO) $($(MACH)_CC); \
240 $(ECHO) $$__COMPILER; \
241 $($(MACH)_CC) -V 2>&1 | head -1; \
242 fi; \
245 cc64-version:
246 @if $($(MACH64)_CC) -_versions >/dev/null 2>/dev/null; then \
247 $(ECHO) 64-bit compiler; \
248 $(ECHO) $($(MACH64)_CC); \
249 $($(MACH64)_CC) -_versions 2>&1 | \
250 $(EGREP) '^(cw|cc|gcc|primary|shadow)'; \
251 else \
252 __COMPILER=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
253 if [ -z "$$__COMPILER" ]; then \
254 $(ECHO) No 64-bit compiler found; \
255 exit 1; \
256 else \
257 $(ECHO) 64-bit compiler; \
258 $(ECHO) $($(MACH64)_CC); \
259 $(ECHO) $$__COMPILER; \
260 $($(MACH64)_CC) -V 2>&1 | head -1; \
261 fi; \
264 java-version:
265 @if [ -x "$(JAVAC)" ]; then \
266 $(ECHO) $(JAVAC); \
267 $(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1; \
268 else \
269 $(ECHO) No Java compiler found; \
270 exit 1; \