xref: /titanic_50/usr/src/Makefile (revision 6fec3791b5a9a5621db93bfef3a6514bc0511b5d)
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/littleneck;	pwd;	$(MAKE) EXPORT_SRC
259	@cd uts/sun4u/lw2plus;	pwd;	$(MAKE) EXPORT_SRC
260	@cd uts/sun4u/lw8;	pwd;	$(MAKE) EXPORT_SRC
261	@cd uts/sun4u/mpxu;	pwd;	$(MAKE) EXPORT_SRC
262	@cd uts/sun4u/serengeti;	pwd;	$(MAKE) EXPORT_SRC
263	@cd uts/sun4u/starcat;	pwd;	$(MAKE) EXPORT_SRC
264	@cd uts/sun4u/taco;	pwd;	$(MAKE) EXPORT_SRC
265	@cd uts/sun4v/io/ncp;	pwd;	$(MAKE) EXPORT_SRC
266	@cd pkgdefs;	pwd; $(MAKE) EXPORT_SRC
267	$(RM) -r $(XMOD_DELETE_FILES)
268	$(RM) Targetdirs+
269	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
270			< Targetdirs > Targetdirs+
271	$(MV) Targetdirs+ Targetdirs
272	$(CHMOD) 444 Targetdirs
273	$(RM) Makefile+
274	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
275			< Makefile > Makefile+
276	$(MV) Makefile+ Makefile
277	$(CHMOD) 444 Makefile
278	$(RM) Makefile.master+
279	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
280			< Makefile.master > Makefile.master+
281	$(MV) Makefile.master+ Makefile.master
282	$(CHMOD) 444 Makefile.master
283
284CRYPT_SRC:
285	@cd cmd/cmd-inet/usr.lib/in.iked;  pwd; $(MAKE) CRYPT_SRC
286	@cd cmd/cmd-inet/usr.lib/ike-certutils;  pwd; $(MAKE) CRYPT_SRC
287	@cd lib/crypt_modules/bsdbf; pwd ; $(MAKE) CRYPT_SRC
288	@cd lib/gss_mechs/mech_dummy;   pwd; $(MAKE) CRYPT_SRC
289	@cd lib/gss_mechs/mech_dh/backend; pwd; $(MAKE) CRYPT_SRC
290	@cd lib/gss_mechs/mech_krb5; pwd; $(MAKE) CRYPT_SRC
291	@cd lib/gss_mechs/mech_spnego; pwd; $(MAKE) CRYPT_SRC
292	@cd lib/libelfsign;   pwd; $(MAKE) CRYPT_SRC
293	@cd lib/libike;   pwd; $(MAKE) CRYPT_SRC
294	@cd lib/libnsl;	 pwd; $(MAKE) CRYPT_SRC
295	@cd lib/libsasl;	 pwd; $(MAKE) CRYPT_SRC
296	@cd lib/libresolv2;	 pwd; $(MAKE) CRYPT_SRC
297	@cd lib/sasl_plugins; pwd; $(MAKE) CRYPT_SRC
298	@cd lib/pam_modules/krb5;   pwd; $(MAKE) CRYPT_SRC
299	@cd tools/elfsign; pwd; $(MAKE) CRYPT_SRC
300	@cd uts/common/gssapi;    pwd; $(MAKE) CRYPT_SRC
301	@cd uts/common/gssapi/include;    pwd; $(MAKE) CRYPT_SRC
302	@cd uts/common/gssapi/mechs/dummy;        pwd; $(MAKE) CRYPT_SRC
303	@cd uts/common/gssapi/mechs/krb5; pwd; $(MAKE) CRYPT_SRC
304	$(RM) Makefile+
305	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
306			< Makefile > Makefile+
307	$(MV) Makefile+ Makefile
308	$(CHMOD) 444 Makefile
309	$(RM) Makefile.master+
310	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
311			< Makefile.master > Makefile.master+
312	$(MV) Makefile.master+ Makefile.master
313	$(CHMOD) 444 Makefile.master
314
315# EXPORT DELETE END
316
317ONC_PLUS:
318	@cd cmd/login; pwd; $(MAKE) ONC_PLUS
319	@cd uts; pwd; $(MAKE) ONC_PLUS
320
321#
322# Targets for reporting compiler versions; nightly uses these.
323#
324
325cc-version:
326	@if [ -x "$($(MACH)_CC)" ]; then			\
327		$(ECHO) 32-bit compiler;			\
328		$(ECHO) $($(MACH)_CC);				\
329		$($(MACH)_CC) -V 2>&1 | head -1;		\
330	else							\
331		__COMPILER=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
332		if [ -z "$$__COMPILER" ]; then			\
333			$(ECHO) No 32-bit compiler found;	\
334			exit 1;					\
335		else						\
336			$(ECHO) 32-bit compiler;		\
337			$(ECHO) $($(MACH)_CC);			\
338			$(ECHO) $$__COMPILER;			\
339			$($(MACH)_CC) -V 2>&1 | head -1;	\
340		fi;						\
341	fi
342
343cc64-version:
344	@if [ -x "$($(MACH64)_CC)" ]; then			\
345		$(ECHO) 64-bit compiler;			\
346		$(ECHO) $($(MACH64)_CC);			\
347		$($(MACH64)_CC) -V 2>&1 | head -1;		\
348	else							\
349		__COMPILER=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
350		if [ -z "$$__COMPILER" ]; then			\
351			$(ECHO) No 64-bit compiler found;	\
352			exit 1;					\
353		else						\
354			$(ECHO) 64-bit compiler;		\
355			$(ECHO) $($(MACH64)_CC);		\
356			$(ECHO) $$__COMPILER;			\
357			$($(MACH64)_CC) -V 2>&1 | head -1;	\
358		fi;						\
359	fi
360
361java-version:
362	@if [ -x "$(JAVAC)" ]; then			\
363		$(ECHO) $(JAVAC);			\
364		$(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1;	\
365	else						\
366		$(ECHO) No Java compiler found;		\
367		exit 1;					\
368	fi
369