xref: /titanic_52/usr/src/Makefile (revision fe817b6022080da0a98b5d2d8cd179f594d6ca5e)
1#
2# CDDL HEADER START
3#
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.
7#
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.
12#
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]
18#
19# CDDL HEADER END
20#
21#
22# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23#
24#
25# Makefile for system source
26#
27# include global definitions
28include Makefile.master
29#
30# the Targetdirs file is the AT&T target.dirs file in a makefile format.
31# it defines TARGETDIRS and ROOTDIRS.
32include Targetdirs
33
34COMMON_SUBDIRS=	uts lib cmd ucblib ucbcmd psm
35sparc_SUBDIRS= stand
36i386_SUBDIRS= grub
37
38#
39# sparc needs to build stand before psm
40#
41$(SPARC_BLD)psm: stand
42
43SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
44
45HDRSUBDIRS=	uts head lib cmd
46
47# UCB headers are bug-for-bug compatible and not checkable against the header
48# standards.
49#
50CHKHDRSUBDIRS=	head uts lib
51
52#
53# Headers that can be built in parallel
54#
55PARALLEL_HEADERS = sysheaders userheaders libheaders cmdheaders
56
57#
58# Directories that can be built in parallel
59#
60PARALLEL_DIRS = uts lib
61
62# The check target also causes smf(5) service manifests to be validated.
63CHKMFSTSUBDIRS=	cmd
64
65MSGSUBDIRS=	cmd ucbcmd lib
66DOMAINS= \
67	SUNW_OST_ADMIN \
68	SUNW_OST_NETRPC \
69	SUNW_OST_OSCMD \
70	SUNW_OST_OSLIB \
71	SUNW_OST_UCBCMD \
72	SUNW_OST_ZONEINFO
73
74MSGDDIRS=       $(DOMAINS:%=$(MSGROOT)/%)
75MSGDIRS=        $(MSGROOT) $(MSGDDIRS) $(MSGROOT)/LC_TIME
76
77all all_xmod :=		TARGET= all
78install install_xmod :=	TARGET= install
79install1 :=		TARGET= install
80install2 :=		TARGET= install
81install_h :=		TARGET= install_h
82clean :=		TARGET= clean
83clobber :=		TARGET= clobber
84check :=		TARGET= check
85
86.KEEP_STATE:
87
88#
89# Note: install does not cause a build in pkg.  To build packages,
90#	cd pkg and do a 'make install'
91#
92
93all: mapfiles closedbins sgs .WAIT $(SUBDIRS) pkg
94
95install: install1 install2 _msg
96	@cd msg; pwd; $(MAKE) _msg
97	@rm -rf "$(ROOT)/catalog"
98
99install1: mapfiles closedbins sgs
100
101install2: install1 $(SUBDIRS)
102
103_msg: _msgdirs rootdirs install2 FRC
104	@for m in $(MSGSUBDIRS); do \
105		cd $$m; pwd; $(MAKE) _msg; cd ..; \
106	done
107
108mapfiles: bldtools
109	@cd common/mapfiles; pwd; $(MAKE) install
110
111clean clobber: $(SUBDIRS) head pkg
112
113closedbins: FRC $(ROOTDIRS)
114	@CLOSED_ROOT="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \
115	if [ "$$CLOSED_IS_PRESENT" = no ]; then \
116		if [ ! -d "$$CLOSED_ROOT" ]; then \
117			$(ECHO) "Error: if closed sources are not present," \
118			    "ON_CLOSED_BINS must point to closed binaries."; \
119			$(ECHO) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \
120			    "present in $$ON_CLOSED_BINS."; \
121			exit 1; \
122		fi; \
123		$(ECHO) "Copying closed binaries from $$CLOSED_ROOT"; \
124		(cd $$CLOSED_ROOT; tar cf - .) | \
125		    (cd $(ROOT); tar xBpf -); \
126	fi
127
128#
129# Declare what parts can be built in parallel
130# DUMMY at the end is used in case macro expansion produces an empty string to
131# prevent everything going in parallel
132#
133.PARALLEL: $(PARALLEL_HEADERS) DUMMY
134.PARALLEL: $(PARALLEL_DIRS) DUMMY
135
136$(SUBDIRS) head pkg: FRC
137	@cd $@; pwd; $(MAKE) $(TARGET)
138
139# librpcsvc has a dependency on headers installed by
140# userheaders, hence the .WAIT before libheaders.
141sgs: rootdirs .WAIT sysheaders userheaders .WAIT \
142	libheaders cmdheaders
143
144#
145# Top-level setup target to setup the development environment that includes
146# headers, tools and generated mapfiles.  For open-only builds (i.e.: source
147# trees w/o usr/closed), this also depends on the closedbins target (above)
148# in order to properly seed the proto area.  Note, although the tools are
149# dependent on a number of constant mapfiles, the tools themselves are
150# required to build the generated mapfiles.
151#
152setup: closedbins bldtools sgs mapfiles
153
154bldtools:
155	@cd tools; pwd; $(MAKE) install
156
157# /var/mail/:saved is a special case because of the colon in the name.
158#
159rootdirs: $(ROOTDIRS)
160	$(INS) -d -m 775 $(ROOT)/var/mail/:saved
161
162lint: FRC
163	$(MAKE) -f Makefile.lint
164
165_msgdirs:       $(MSGDIRS)
166
167$(ROOTDIRS) $(MSGDIRS):
168	$(INS.dir)
169
170userheaders: FRC
171	@cd head; pwd; $(MAKE) install_h
172
173libheaders: bldtools
174	@cd lib; pwd; $(MAKE) install_h
175
176sysheaders: FRC
177	@cd uts; pwd; $(MAKE) install_h
178
179cmdheaders: FRC
180	@cd cmd/fm; pwd; $(MAKE) install_h
181	@cd cmd/mdb; pwd; $(MAKE) install_h
182
183# each xmod target depends on a corresponding MACH-specific pseudotarget
184# before doing common xmod work
185#
186all_xmod install_xmod: $$@_$(MACH)
187	@cd uts/common/sys; pwd; $(MAKE) svvs_h
188
189all_xmod_sparc install_xmod_sparc: FRC
190	@cd uts/sparc; pwd; \
191	  $(MAKE) TARGET=$(TARGET) svvs pm wsdrv
192
193all_xmod_i386 install_xmod_i386: FRC
194	@cd uts/i86; pwd; $(MAKE) TARGET=$(TARGET) svvs
195
196check:	$(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS)
197
198#
199# Cross-reference customization: skip all of the subdirectories that
200# don't contain actual source code.
201#
202$(CLOSED_BUILD)XRDIRS += ../closed
203XRPRUNE = pkg prototypes xmod
204XRINCDIRS = uts/common head ucbhead
205$(CLOSED_BUILD)XRINCDIRS = uts/common ../closed/uts/common head ucbhead
206
207cscope.out tags: FRC
208	$(XREF) -f -x $@
209
210FRC:
211
212# EXPORT DELETE START
213
214XMOD_DELETE_FILES:sh = cat xmod/xmod_files
215
216EXPORT_SRC:
217	@cd $(CLOSED)/cmd/cmd-inet/usr.lib/in.iked;  pwd; $(MAKE) EXPORT_SRC
218	@cd $(CLOSED)/cmd/cmd-inet/usr.lib/ike-certutils;  pwd; \
219	    $(MAKE) EXPORT_SRC
220	@cd cmd/cmd-inet/usr.sbin; pwd; $(MAKE) EXPORT_SRC
221	@cd $(CLOSED)/cmd/cmd-crypto/etc; pwd; $(MAKE) EXPORT_SRC
222	@cd cmd/crypt;	  pwd; $(MAKE) EXPORT_SRC
223	@cd cmd/gss/gssd;         pwd; $(MAKE) EXPORT_SRC
224	@cd cmd/krb5/kadmin;  pwd; $(MAKE) EXPORT_SRC
225	@cd cmd/sendmail/src; pwd; $(MAKE) EXPORT_SRC
226	@cd common/crypto/aes;	  pwd; $(MAKE) EXPORT_SRC
227	@cd common/crypto/arcfour; pwd; $(MAKE) EXPORT_SRC
228	@cd common/crypto/blowfish;	  pwd; $(MAKE) EXPORT_SRC
229	@cd common/crypto/des;	  pwd; $(MAKE) EXPORT_SRC
230	@cd common/crypto/rsa;	  pwd; $(MAKE) EXPORT_SRC
231	@cd lib/crypt_modules/bsdbf; pwd ; $(MAKE) EXPORT_SRC
232	@cd lib/gss_mechs/mech_dummy;   pwd; $(MAKE) EXPORT_SRC
233	@cd lib/gss_mechs/mech_dh/backend;	pwd; $(MAKE) EXPORT_SRC
234	@cd lib/gss_mechs/mech_krb5;		pwd; $(MAKE) EXPORT_SRC
235	@cd lib/gss_mechs/mech_spnego;		pwd; $(MAKE) EXPORT_SRC
236	@cd lib/libcrypt; pwd; $(MAKE) EXPORT_SRC
237	@cd lib/libgss;   pwd; $(MAKE) EXPORT_SRC
238	@cd $(CLOSED)/lib/libike;   pwd; $(MAKE) EXPORT_SRC
239	@cd lib/libnsl;	  pwd; $(MAKE) EXPORT_SRC
240	@cd lib/pkcs11/pkcs11_softtoken/common;  pwd; $(MAKE) EXPORT_SRC
241	@cd lib/libsldap; pwd; $(MAKE) EXPORT_SRC
242	@cd lib/libsasl; pwd; $(MAKE) EXPORT_SRC
243	@cd lib/sasl_plugins; pwd; $(MAKE) EXPORT_SRC
244	@cd lib/pam_modules/krb5;   pwd; $(MAKE) EXPORT_SRC
245	@cd psm/stand/boot; pwd; $(MAKE) EXPORT_SRC
246	@cd uts/common/crypto/io; pwd; $(MAKE) EXPORT_SRC
247	@cd uts/common/des; pwd; $(MAKE) EXPORT_SRC
248	@cd uts/common/rpc; pwd; $(MAKE) EXPORT_SRC
249	@cd uts/common/sys; pwd; $(MAKE) EXPORT_SRC
250	@cd uts/common/gssapi/include;		pwd; $(MAKE) EXPORT_SRC
251	@cd uts/common/gssapi;			pwd; $(MAKE) EXPORT_SRC
252	@cd uts/common/gssapi/mechs/dummy;	pwd; $(MAKE) EXPORT_SRC
253	@cd uts/common/gssapi/mechs/krb5;	pwd; $(MAKE) EXPORT_SRC
254	@cd uts/common; pwd; $(MAKE) EXPORT_SRC
255	@cd uts/sparc; pwd; $(MAKE) EXPORT_SRC
256	@cd $(CLOSED)/uts/sun4u/forthdebug; pwd; $(MAKE) EXPORT_SRC
257	@cd $(CLOSED)/uts/sun4v/forthdebug; pwd; $(MAKE) EXPORT_SRC
258	@cd uts/intel; pwd; $(MAKE) EXPORT_SRC
259	@cd uts/sun4u; pwd; $(MAKE) EXPORT_SRC
260	@cd $(CLOSED)/uts/sun4v/io/ncp;	pwd;	$(MAKE) EXPORT_SRC
261	@cd $(CLOSED)/uts/sun4v/io/n2cp; pwd;	$(MAKE) EXPORT_SRC
262	@cd pkg; pwd;	$(MAKE) EXPORT_SRC
263	$(RM) -r $(XMOD_DELETE_FILES)
264	$(RM) Targetdirs+
265	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
266			< Targetdirs > Targetdirs+
267	$(MV) Targetdirs+ Targetdirs
268	$(CHMOD) 444 Targetdirs
269	$(RM) Makefile+
270	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
271			< Makefile > Makefile+
272	$(MV) Makefile+ Makefile
273	$(CHMOD) 444 Makefile
274	$(RM) Makefile.master+
275	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
276			< Makefile.master > Makefile.master+
277	$(MV) Makefile.master+ Makefile.master
278	$(CHMOD) 444 Makefile.master
279
280CRYPT_SRC:
281	@cd $(CLOSED)/cmd/cmd-crypto/etc;  pwd; $(MAKE) CRYPT_SRC
282	@cd $(CLOSED)/cmd/cmd-inet/usr.lib/in.iked;  pwd; $(MAKE) CRYPT_SRC
283	@cd $(CLOSED)/cmd/cmd-inet/usr.lib/ike-certutils;  pwd; \
284	    $(MAKE) CRYPT_SRC
285	@cd lib/crypt_modules/bsdbf; pwd ; $(MAKE) CRYPT_SRC
286	@cd lib/gss_mechs/mech_dummy;   pwd; $(MAKE) CRYPT_SRC
287	@cd lib/gss_mechs/mech_dh/backend; pwd; $(MAKE) CRYPT_SRC
288	@cd lib/gss_mechs/mech_krb5; pwd; $(MAKE) CRYPT_SRC
289	@cd lib/gss_mechs/mech_spnego; pwd; $(MAKE) CRYPT_SRC
290	@cd $(CLOSED)/lib/libike;   pwd; $(MAKE) CRYPT_SRC
291	@cd lib/libnsl;	 pwd; $(MAKE) CRYPT_SRC
292	@cd lib/libsasl;	 pwd; $(MAKE) CRYPT_SRC
293	@cd lib/sasl_plugins; pwd; $(MAKE) CRYPT_SRC
294	@cd lib/pam_modules/krb5;   pwd; $(MAKE) CRYPT_SRC
295	@cd uts/common/gssapi;    pwd; $(MAKE) CRYPT_SRC
296	@cd uts/common/gssapi/include;    pwd; $(MAKE) CRYPT_SRC
297	@cd uts/common/gssapi/mechs/dummy;        pwd; $(MAKE) CRYPT_SRC
298	@cd uts/common/gssapi/mechs/krb5; pwd; $(MAKE) CRYPT_SRC
299	@cd pkg;    pwd; $(MAKE) CRYPT_SRC
300	$(RM) Makefile+
301	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
302			< Makefile > Makefile+
303	$(MV) Makefile+ Makefile
304	$(CHMOD) 444 Makefile
305	$(RM) Makefile.master+
306	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
307			< Makefile.master > Makefile.master+
308	$(MV) Makefile.master+ Makefile.master
309	$(CHMOD) 444 Makefile.master
310
311# EXPORT DELETE END
312
313ONC_PLUS:
314	@cd cmd/login; pwd; $(MAKE) ONC_PLUS
315	@cd uts; pwd; $(MAKE) ONC_PLUS
316
317#
318# Targets for reporting compiler versions; nightly uses these.
319#
320
321cc-version:
322	@if $($(MACH)_CC) -_versions >/dev/null 2>/dev/null; then \
323		$(ECHO) 32-bit compiler;			\
324		$(ECHO) $($(MACH)_CC);				\
325		$($(MACH)_CC) -_versions 2>&1 |			\
326		    $(EGREP) '^(cw|cc|gcc|primary|shadow)';	\
327	else							\
328		__COMPILER=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
329		if [ -z "$$__COMPILER" ]; then			\
330			$(ECHO) No 32-bit compiler found;	\
331			exit 1;					\
332		else						\
333			$(ECHO) 32-bit compiler;		\
334			$(ECHO) $($(MACH)_CC);			\
335			$(ECHO) $$__COMPILER;			\
336			$($(MACH)_CC) -V 2>&1 | head -1;	\
337		fi;						\
338	fi
339
340cc64-version:
341	@if $($(MACH64)_CC) -_versions >/dev/null 2>/dev/null; then \
342		$(ECHO) 64-bit compiler;			\
343		$(ECHO) $($(MACH64)_CC);			\
344		$($(MACH64)_CC) -_versions 2>&1 |		\
345		    $(EGREP) '^(cw|cc|gcc|primary|shadow)';	\
346	else							\
347		__COMPILER=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
348		if [ -z "$$__COMPILER" ]; then			\
349			$(ECHO) No 64-bit compiler found;	\
350			exit 1;					\
351		else						\
352			$(ECHO) 64-bit compiler;		\
353			$(ECHO) $($(MACH64)_CC);		\
354			$(ECHO) $$__COMPILER;			\
355			$($(MACH64)_CC) -V 2>&1 | head -1;	\
356		fi;						\
357	fi
358
359java-version:
360	@if [ -x "$(JAVAC)" ]; then			\
361		$(ECHO) $(JAVAC);			\
362		$(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1;	\
363	else						\
364		$(ECHO) No Java compiler found;		\
365		exit 1;					\
366	fi
367