xref: /titanic_51/usr/src/Makefile (revision 577f006c50d564d2f93145b2f2044a942d47f314)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28# Makefile for system source
29#
30# include global definitions
31include Makefile.master
32#
33# the Targetdirs file is the AT&T target.dirs file in a makefile format.
34# it defines TARGETDIRS and ROOTDIRS.
35include Targetdirs
36
37COMMON_SUBDIRS=	uts lib cmd ucblib ucbcmd
38
39#
40# sparc needs to build both stand and psm, in that order
41# x86 needs to build psm and GRUB
42#
43sparc_SUBDIRS= stand psm
44i386_SUBDIRS= psm grub
45
46SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
47
48HDRSUBDIRS=	uts head lib cmd ucbhead
49
50# UCB headers are bug-for-bug compatible and not checkable against the header
51# standards.
52#
53CHKHDRSUBDIRS=	head uts lib
54
55# The check target also causes smf(5) service manifests to be validated.
56CHKMFSTSUBDIRS=	cmd
57
58MSGSUBDIRS=	cmd ucbcmd lib
59DOMAINS= \
60	SUNW_OST_ADMIN \
61	SUNW_OST_NETRPC \
62	SUNW_OST_OSCMD \
63	SUNW_OST_OSLIB \
64	SUNW_OST_UCBCMD \
65	SUNW_OST_ZONEINFO
66
67MSGDDIRS=       $(DOMAINS:%=$(MSGROOT)/%)
68MSGDIRS=        $(MSGROOT) $(MSGDDIRS) $(MSGROOT)/LC_TIME
69
70all all_xmod :=		TARGET= all
71install install_xmod :=	TARGET= install
72install_h :=		TARGET= install_h
73clean :=		TARGET= clean
74clobber :=		TARGET= clobber
75check :=		TARGET= check
76_msg :=			TARGET= _msg
77
78
79.KEEP_STATE:
80
81#
82# Note: install only builds the all target for the pkgdefs
83#       directory.  We are not yet ready to have an install
84#	build create 'packages' also.  To build packages
85#	cd pkgdefs and do a 'make install'
86#
87all: sgs .WAIT $(SUBDIRS) pkg_all
88install: sgs .WAIT $(SUBDIRS) pkg_all .WAIT _msg
89	@cd pkgdefs/SUNW0on; pwd; $(MAKE) _msg
90	@rm -rf "$(ROOT)/catalog"
91
92clean clobber: $(SUBDIRS) head pkgdefs
93_msg: _msgdirs rootdirs $(MSGSUBDIRS)
94
95# for a complete build from scratch
96crankturn: sgs uts pkg_all
97	@cd lib; pwd; $(MAKE) install
98	@cd cmd; pwd; $(MAKE) all
99	@cd ucblib; pwd; $(MAKE) install
100	@cd ucbcmd; pwd; $(MAKE) all
101
102pkg_all:
103	@cd pkgdefs; pwd; $(MAKE) all
104
105#
106# target for building a proto area for reference via the ROOT macro
107#
108protolibs: rootlibs ucblibs
109
110# build all ucb libraries
111#
112ucblibs:
113	@cd ucblib; pwd; $(MAKE) install
114
115# Base subset of rootproto, excluding ucb libraries
116#
117rootlibs: sgs
118	@cd lib; pwd; $(MAKE) install
119
120$(SUBDIRS) head ucbhead pkgdefs: FRC
121	@cd $@; pwd; $(MAKE) $(TARGET)
122
123.PARALLEL:	sysheaders userheaders libheaders ucbheaders cmdheaders \
124		commonheaders
125
126# librpcsvc has a dependency on headers installed by
127# userheaders, hence the .WAIT before libheaders.
128sgs: rootdirs .WAIT sysheaders userheaders .WAIT \
129	libheaders ucbheaders cmdheaders commonheaders
130
131#
132# top-level setup target (headers/tools)
133setup: sgs
134	@cd tools; pwd; $(MAKE) install
135
136# /var/mail/:saved is a special case because of the colon in the name.
137#
138rootdirs: $(ROOTDIRS)
139	$(INS) -d -m 775 $(ROOT)/var/mail/:saved
140	$(CH)$(CHOWN) root $(ROOT)/var/mail/:saved
141	$(CH)$(CHGRP) mail $(ROOT)/var/mail/:saved
142
143lint: FRC
144	$(MAKE) -f Makefile.lint
145
146_msgdirs:       $(MSGDIRS)
147
148$(ROOTDIRS) $(MSGDIRS):
149	$(INS.dir)
150
151userheaders: FRC
152	@cd head; pwd; $(MAKE) install_h
153
154libheaders: FRC
155	@cd lib; pwd; $(MAKE) install_h
156
157sysheaders: FRC
158	@cd uts; pwd; $(MAKE) install_h
159
160ucbheaders: FRC
161	@cd ucbhead; pwd; $(MAKE) install_h
162
163cmdheaders: FRC
164	@cd cmd/fm; pwd; $(MAKE) install_h
165	@cd cmd/mdb; pwd; $(MAKE) install_h
166
167commonheaders: FRC
168	@cd common/ipf; pwd; $(MAKE) install_h
169
170# each xmod target depends on a corresponding MACH-specific pseudotarget
171# before doing common xmod work
172#
173all_xmod install_xmod: $$@_$(MACH)
174	@cd uts/common/sys; pwd; $(MAKE) svvs_h
175
176all_xmod_sparc install_xmod_sparc: FRC
177	@cd uts/sparc; pwd; \
178	  $(MAKE) TARGET=$(TARGET) svvs pm wsdrv
179
180all_xmod_i386 install_xmod_i386: FRC
181	@cd uts/i86; pwd; $(MAKE) TARGET=$(TARGET) svvs
182
183check:	$(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS)
184
185#
186# Cross-reference customization: skip all of the subdirectories that
187# don't contain actual source code.
188#
189XRPRUNE = spec pkgdefs prototypes xmod
190XRINCDIRS = uts/common head ucbhead
191
192cscope.out tags: FRC
193	$(XREF) -f -x $@
194
195FRC:
196
197# EXPORT DELETE START
198
199XMOD_DELETE_FILES:sh = cat xmod/xmod_files
200
201EXPORT_SRC:
202	@cd cmd/cmd-inet/usr.lib/in.iked;  pwd; $(MAKE) EXPORT_SRC
203	@cd cmd/cmd-inet/usr.lib/ike-certutils;  pwd; $(MAKE) EXPORT_SRC
204	@cd cmd/cmd-inet/usr.sbin; pwd; $(MAKE) EXPORT_SRC
205	@cd cmd/cmd-crypto/etc; pwd; $(MAKE) EXPORT_SRC
206	@cd cmd/crypt;	  pwd; $(MAKE) EXPORT_SRC
207	@cd cmd/gss/gssd;         pwd; $(MAKE) EXPORT_SRC
208	@cd cmd/krb5/kadmin;  pwd; $(MAKE) EXPORT_SRC
209	@cd cmd/sendmail/src; pwd; $(MAKE) EXPORT_SRC
210	@cd cmd/xntpd;	  pwd; $(MAKE) EXPORT_SRC
211	@cd common/crypto/aes;	  pwd; $(MAKE) EXPORT_SRC
212	@cd common/crypto/arcfour; pwd; $(MAKE) EXPORT_SRC
213	@cd common/crypto/blowfish;	  pwd; $(MAKE) EXPORT_SRC
214	@cd common/crypto/des;	  pwd; $(MAKE) EXPORT_SRC
215	@cd common/crypto/rsa;	  pwd; $(MAKE) EXPORT_SRC
216	@cd lib/crypt_modules/bsdbf; pwd ; $(MAKE) EXPORT_SRC
217	@cd lib/gss_mechs/mech_dummy;   pwd; $(MAKE) EXPORT_SRC
218	@cd lib/gss_mechs/mech_dh/backend;	pwd; $(MAKE) EXPORT_SRC
219	@cd lib/gss_mechs/mech_krb5;		pwd; $(MAKE) EXPORT_SRC
220	@cd lib/gss_mechs/mech_spnego;		pwd; $(MAKE) EXPORT_SRC
221	@cd lib/libcrypt; pwd; $(MAKE) EXPORT_SRC
222	@cd lib/libelfsign;   pwd; $(MAKE) EXPORT_SRC
223	@cd lib/libgss;   pwd; $(MAKE) EXPORT_SRC
224	@cd lib/libike;   pwd; $(MAKE) EXPORT_SRC
225	@cd lib/libnsl;	  pwd; $(MAKE) EXPORT_SRC
226	@cd lib/openssl; pwd; $(MAKE) EXPORT_SRC
227	@cd lib/pkcs11/pkcs11_softtoken/common;  pwd; $(MAKE) EXPORT_SRC
228	@cd lib/pkcs11/libpkcs11;  pwd; $(MAKE) EXPORT_SRC
229	@cd lib/pkcs11;  pwd; $(MAKE) EXPORT_SRC
230	@cd lib/libsldap; pwd; $(MAKE) EXPORT_SRC
231	@cd lib/libsasl; pwd; $(MAKE) EXPORT_SRC
232	@cd lib/sasl_plugins; pwd; $(MAKE) EXPORT_SRC
233	@cd lib/smartcard;	  pwd; $(MAKE) EXPORT_SRC
234	@cd lib/pam_modules/krb5;   pwd; $(MAKE) EXPORT_SRC
235	@cd lib/udapl; pwd; $(MAKE) EXPORT_SRC
236	@cd lib/libresolv2; pwd; $(MAKE) EXPORT_SRC
237	@cd tools/elfsign; pwd; $(MAKE) EXPORT_SRC
238	@cd uts/common/crypto/io; pwd; $(MAKE) EXPORT_SRC
239	@cd uts/common/des; pwd; $(MAKE) EXPORT_SRC
240	@cd uts/common/rpc; pwd; $(MAKE) EXPORT_SRC
241	@cd uts/common/sys; pwd; $(MAKE) EXPORT_SRC
242	@cd uts/common/gssapi/include;		pwd; $(MAKE) EXPORT_SRC
243	@cd uts/common/gssapi;			pwd; $(MAKE) EXPORT_SRC
244	@cd uts/common/gssapi/mechs/dummy;	pwd; $(MAKE) EXPORT_SRC
245	@cd uts/common/gssapi/mechs/krb5;	pwd; $(MAKE) EXPORT_SRC
246	@cd uts/common; pwd; $(MAKE) EXPORT_SRC
247	@cd uts/sparc; pwd; $(MAKE) EXPORT_SRC
248	@cd uts/sun4u/forthdebug; pwd; $(MAKE) EXPORT_SRC
249	@cd uts/intel; pwd; $(MAKE) EXPORT_SRC
250	@cd uts/sun4u; pwd; $(MAKE) EXPORT_SRC
251	@cd uts/sun4u/chalupa;	pwd;	$(MAKE) EXPORT_SRC
252	@cd uts/sun4u/cherrystone;	pwd;	$(MAKE) EXPORT_SRC
253	@cd uts/sun4u/daktari;	pwd;	$(MAKE) EXPORT_SRC
254	@cd uts/sun4u/enchilada;	pwd;	$(MAKE) EXPORT_SRC
255	@cd uts/sun4u/ents;	pwd;	$(MAKE) EXPORT_SRC
256	@cd uts/sun4u/excalibur;	pwd;	$(MAKE) EXPORT_SRC
257	@cd uts/sun4u/chicago;	pwd;	$(MAKE) EXPORT_SRC
258	@cd uts/sun4u/boston;	pwd;	$(MAKE) EXPORT_SRC
259	@cd uts/sun4u/seattle;	pwd;	$(MAKE) EXPORT_SRC
260	@cd uts/sun4u/littleneck;	pwd;	$(MAKE) EXPORT_SRC
261	@cd uts/sun4u/lw2plus;	pwd;	$(MAKE) EXPORT_SRC
262	@cd uts/sun4u/lw8;	pwd;	$(MAKE) EXPORT_SRC
263	@cd uts/sun4u/mpxu;	pwd;	$(MAKE) EXPORT_SRC
264	@cd uts/sun4u/serengeti;	pwd;	$(MAKE) EXPORT_SRC
265	@cd uts/sun4u/starcat;	pwd;	$(MAKE) EXPORT_SRC
266	@cd uts/sun4u/taco;	pwd;	$(MAKE) EXPORT_SRC
267	@cd uts/sun4v/io/ncp;	pwd;	$(MAKE) EXPORT_SRC
268	@cd pkgdefs;	pwd; $(MAKE) EXPORT_SRC
269	$(RM) -r $(XMOD_DELETE_FILES)
270	$(RM) Targetdirs+
271	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
272			< Targetdirs > Targetdirs+
273	$(MV) Targetdirs+ Targetdirs
274	$(CHMOD) 444 Targetdirs
275	$(RM) Makefile+
276	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
277			< Makefile > Makefile+
278	$(MV) Makefile+ Makefile
279	$(CHMOD) 444 Makefile
280	$(RM) Makefile.master+
281	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
282			< Makefile.master > Makefile.master+
283	$(MV) Makefile.master+ Makefile.master
284	$(CHMOD) 444 Makefile.master
285
286CRYPT_SRC:
287	@cd cmd/cmd-inet/usr.lib/in.iked;  pwd; $(MAKE) CRYPT_SRC
288	@cd cmd/cmd-inet/usr.lib/ike-certutils;  pwd; $(MAKE) CRYPT_SRC
289	@cd lib/crypt_modules/bsdbf; pwd ; $(MAKE) CRYPT_SRC
290	@cd lib/gss_mechs/mech_dummy;   pwd; $(MAKE) CRYPT_SRC
291	@cd lib/gss_mechs/mech_dh/backend; pwd; $(MAKE) CRYPT_SRC
292	@cd lib/gss_mechs/mech_krb5; pwd; $(MAKE) CRYPT_SRC
293	@cd lib/gss_mechs/mech_spnego; pwd; $(MAKE) CRYPT_SRC
294	@cd lib/libelfsign;   pwd; $(MAKE) CRYPT_SRC
295	@cd lib/libike;   pwd; $(MAKE) CRYPT_SRC
296	@cd lib/libnsl;	 pwd; $(MAKE) CRYPT_SRC
297	@cd lib/libsasl;	 pwd; $(MAKE) CRYPT_SRC
298	@cd lib/libresolv2;	 pwd; $(MAKE) CRYPT_SRC
299	@cd lib/sasl_plugins; pwd; $(MAKE) CRYPT_SRC
300	@cd lib/pam_modules/krb5;   pwd; $(MAKE) CRYPT_SRC
301	@cd tools/elfsign; pwd; $(MAKE) CRYPT_SRC
302	@cd uts/common/gssapi;    pwd; $(MAKE) CRYPT_SRC
303	@cd uts/common/gssapi/include;    pwd; $(MAKE) CRYPT_SRC
304	@cd uts/common/gssapi/mechs/dummy;        pwd; $(MAKE) CRYPT_SRC
305	@cd uts/common/gssapi/mechs/krb5; pwd; $(MAKE) CRYPT_SRC
306	$(RM) Makefile+
307	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
308			< Makefile > Makefile+
309	$(MV) Makefile+ Makefile
310	$(CHMOD) 444 Makefile
311	$(RM) Makefile.master+
312	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
313			< Makefile.master > Makefile.master+
314	$(MV) Makefile.master+ Makefile.master
315	$(CHMOD) 444 Makefile.master
316
317# EXPORT DELETE END
318
319ONC_PLUS:
320	@cd cmd/login; pwd; $(MAKE) ONC_PLUS
321	@cd uts; pwd; $(MAKE) ONC_PLUS
322
323#
324# Targets for reporting compiler versions; nightly uses these.
325#
326
327cc-version:
328	@if [ -x "$($(MACH)_CC)" ]; then			\
329		$(ECHO) 32-bit compiler;			\
330		$(ECHO) $($(MACH)_CC);				\
331		$($(MACH)_CC) -V 2>&1 | head -1;		\
332	else							\
333		__COMPILER=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
334		if [ -z "$$__COMPILER" ]; then			\
335			$(ECHO) No 32-bit compiler found;	\
336			exit 1;					\
337		else						\
338			$(ECHO) 32-bit compiler;		\
339			$(ECHO) $($(MACH)_CC);			\
340			$(ECHO) $$__COMPILER;			\
341			$($(MACH)_CC) -V 2>&1 | head -1;	\
342		fi;						\
343	fi
344
345cc64-version:
346	@if [ -x "$($(MACH64)_CC)" ]; then			\
347		$(ECHO) 64-bit compiler;			\
348		$(ECHO) $($(MACH64)_CC);			\
349		$($(MACH64)_CC) -V 2>&1 | head -1;		\
350	else							\
351		__COMPILER=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
352		if [ -z "$$__COMPILER" ]; then			\
353			$(ECHO) No 64-bit compiler found;	\
354			exit 1;					\
355		else						\
356			$(ECHO) 64-bit compiler;		\
357			$(ECHO) $($(MACH64)_CC);		\
358			$(ECHO) $$__COMPILER;			\
359			$($(MACH64)_CC) -V 2>&1 | head -1;	\
360		fi;						\
361	fi
362
363java-version:
364	@if [ -x "$(JAVAC)" ]; then			\
365		$(ECHO) $(JAVAC);			\
366		$(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1;	\
367	else						\
368		$(ECHO) No Java compiler found;		\
369		exit 1;					\
370	fi
371