xref: /titanic_44/usr/src/Makefile (revision 30f5cf21f0e4186919b67ac48223d09ca110f8fe)
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
125# librpcsvc has a dependency on headers installed by
126# userheaders, hence the .WAIT before libheaders.
127sgs: rootdirs .WAIT sysheaders userheaders .WAIT \
128	libheaders ucbheaders cmdheaders
129
130#
131# top-level setup target (headers/tools)
132setup: sgs
133	@cd tools; pwd; $(MAKE) install
134
135# /var/mail/:saved is a special case because of the colon in the name.
136#
137rootdirs: $(ROOTDIRS)
138	$(INS) -d -m 775 $(ROOT)/var/mail/:saved
139	$(CH)$(CHOWN) root $(ROOT)/var/mail/:saved
140	$(CH)$(CHGRP) mail $(ROOT)/var/mail/:saved
141
142lint: FRC
143	$(MAKE) -f Makefile.lint
144
145_msgdirs:       $(MSGDIRS)
146
147$(ROOTDIRS) $(MSGDIRS):
148	$(INS.dir)
149
150userheaders: FRC
151	@cd head; pwd; $(MAKE) install_h
152
153libheaders: FRC
154	@cd lib; pwd; $(MAKE) install_h
155
156sysheaders: FRC
157	@cd uts; pwd; $(MAKE) install_h
158
159ucbheaders: FRC
160	@cd ucbhead; pwd; $(MAKE) install_h
161
162cmdheaders: FRC
163	@cd cmd/fm; pwd; $(MAKE) install_h
164	@cd cmd/mdb; pwd; $(MAKE) install_h
165
166# each xmod target depends on a corresponding MACH-specific pseudotarget
167# before doing common xmod work
168#
169all_xmod install_xmod: $$@_$(MACH)
170	@cd uts/common/sys; pwd; $(MAKE) svvs_h
171
172all_xmod_sparc install_xmod_sparc: FRC
173	@cd uts/sparc; pwd; \
174	  $(MAKE) TARGET=$(TARGET) svvs pm wsdrv
175
176all_xmod_i386 install_xmod_i386: FRC
177	@cd uts/i86; pwd; $(MAKE) TARGET=$(TARGET) svvs
178
179check:	$(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS)
180
181#
182# Cross-reference customization: skip all of the subdirectories that
183# don't contain actual source code.
184#
185XRPRUNE = spec pkgdefs prototypes xmod
186XRINCDIRS = uts/common head ucbhead
187
188cscope.out tags: FRC
189	$(XREF) -f -x $@
190
191FRC:
192
193# EXPORT DELETE START
194
195XMOD_DELETE_FILES:sh = cat xmod/xmod_files
196
197EXPORT_SRC:
198	@cd cmd/cmd-inet/usr.lib/in.iked;  pwd; $(MAKE) EXPORT_SRC
199	@cd cmd/cmd-inet/usr.lib/ike-certutils;  pwd; $(MAKE) EXPORT_SRC
200	@cd cmd/cmd-inet/usr.sbin; pwd; $(MAKE) EXPORT_SRC
201	@cd cmd/cmd-crypto/etc; pwd; $(MAKE) EXPORT_SRC
202	@cd cmd/crypt;	  pwd; $(MAKE) EXPORT_SRC
203	@cd cmd/gss/gssd;         pwd; $(MAKE) EXPORT_SRC
204	@cd cmd/krb5/kadmin;  pwd; $(MAKE) EXPORT_SRC
205	@cd cmd/sendmail/src; pwd; $(MAKE) EXPORT_SRC
206	@cd cmd/xntpd;	  pwd; $(MAKE) EXPORT_SRC
207	@cd common/crypto/aes;	  pwd; $(MAKE) EXPORT_SRC
208	@cd common/crypto/arcfour; pwd; $(MAKE) EXPORT_SRC
209	@cd common/crypto/blowfish;	  pwd; $(MAKE) EXPORT_SRC
210	@cd common/crypto/des;	  pwd; $(MAKE) EXPORT_SRC
211	@cd common/crypto/rsa;	  pwd; $(MAKE) EXPORT_SRC
212	@cd lib/crypt_modules/bsdbf; pwd ; $(MAKE) EXPORT_SRC
213	@cd lib/gss_mechs/mech_dummy;   pwd; $(MAKE) EXPORT_SRC
214	@cd lib/gss_mechs/mech_dh/backend;	pwd; $(MAKE) EXPORT_SRC
215	@cd lib/gss_mechs/mech_krb5;		pwd; $(MAKE) EXPORT_SRC
216	@cd lib/gss_mechs/mech_spnego;		pwd; $(MAKE) EXPORT_SRC
217	@cd lib/libcrypt; pwd; $(MAKE) EXPORT_SRC
218	@cd lib/libelfsign;   pwd; $(MAKE) EXPORT_SRC
219	@cd lib/libgss;   pwd; $(MAKE) EXPORT_SRC
220	@cd lib/libike;   pwd; $(MAKE) EXPORT_SRC
221	@cd lib/libnsl;	  pwd; $(MAKE) EXPORT_SRC
222	@cd lib/openssl; pwd; $(MAKE) EXPORT_SRC
223	@cd lib/pkcs11/pkcs11_softtoken/common;  pwd; $(MAKE) EXPORT_SRC
224	@cd lib/pkcs11/libpkcs11;  pwd; $(MAKE) EXPORT_SRC
225	@cd lib/pkcs11;  pwd; $(MAKE) EXPORT_SRC
226	@cd lib/libsldap; pwd; $(MAKE) EXPORT_SRC
227	@cd lib/libsasl; pwd; $(MAKE) EXPORT_SRC
228	@cd lib/sasl_plugins; pwd; $(MAKE) EXPORT_SRC
229	@cd lib/smartcard;	  pwd; $(MAKE) EXPORT_SRC
230	@cd lib/pam_modules/krb5;   pwd; $(MAKE) EXPORT_SRC
231	@cd lib/udapl; pwd; $(MAKE) EXPORT_SRC
232	@cd lib/libresolv2; pwd; $(MAKE) EXPORT_SRC
233	@cd tools/elfsign; pwd; $(MAKE) EXPORT_SRC
234	@cd uts/common/crypto/io; pwd; $(MAKE) EXPORT_SRC
235	@cd uts/common/des; pwd; $(MAKE) EXPORT_SRC
236	@cd uts/common/rpc; pwd; $(MAKE) EXPORT_SRC
237	@cd uts/common/sys; pwd; $(MAKE) EXPORT_SRC
238	@cd uts/common/gssapi/include;		pwd; $(MAKE) EXPORT_SRC
239	@cd uts/common/gssapi;			pwd; $(MAKE) EXPORT_SRC
240	@cd uts/common/gssapi/mechs/dummy;	pwd; $(MAKE) EXPORT_SRC
241	@cd uts/common/gssapi/mechs/krb5;	pwd; $(MAKE) EXPORT_SRC
242	@cd uts/common; pwd; $(MAKE) EXPORT_SRC
243	@cd uts/sparc; pwd; $(MAKE) EXPORT_SRC
244	@cd uts/sun4u/forthdebug; pwd; $(MAKE) EXPORT_SRC
245	@cd uts/intel; pwd; $(MAKE) EXPORT_SRC
246	@cd uts/sun4u; pwd; $(MAKE) EXPORT_SRC
247	@cd uts/sun4u/chalupa;	pwd;	$(MAKE) EXPORT_SRC
248	@cd uts/sun4u/cherrystone;	pwd;	$(MAKE) EXPORT_SRC
249	@cd uts/sun4u/daktari;	pwd;	$(MAKE) EXPORT_SRC
250	@cd uts/sun4u/enchilada;	pwd;	$(MAKE) EXPORT_SRC
251	@cd uts/sun4u/ents;	pwd;	$(MAKE) EXPORT_SRC
252	@cd uts/sun4u/excalibur;	pwd;	$(MAKE) EXPORT_SRC
253	@cd uts/sun4u/chicago;	pwd;	$(MAKE) EXPORT_SRC
254	@cd uts/sun4u/littleneck;	pwd;	$(MAKE) EXPORT_SRC
255	@cd uts/sun4u/lw2plus;	pwd;	$(MAKE) EXPORT_SRC
256	@cd uts/sun4u/lw8;	pwd;	$(MAKE) EXPORT_SRC
257	@cd uts/sun4u/mpxu;	pwd;	$(MAKE) EXPORT_SRC
258	@cd uts/sun4u/serengeti;	pwd;	$(MAKE) EXPORT_SRC
259	@cd uts/sun4u/starcat;	pwd;	$(MAKE) EXPORT_SRC
260	@cd uts/sun4u/taco;	pwd;	$(MAKE) EXPORT_SRC
261	@cd uts/sun4v/io/ncp;	pwd;	$(MAKE) EXPORT_SRC
262	@cd pkgdefs;	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 cmd/cmd-inet/usr.lib/in.iked;  pwd; $(MAKE) CRYPT_SRC
282	@cd cmd/cmd-inet/usr.lib/ike-certutils;  pwd; $(MAKE) CRYPT_SRC
283	@cd lib/crypt_modules/bsdbf; pwd ; $(MAKE) CRYPT_SRC
284	@cd lib/gss_mechs/mech_dummy;   pwd; $(MAKE) CRYPT_SRC
285	@cd lib/gss_mechs/mech_dh/backend; pwd; $(MAKE) CRYPT_SRC
286	@cd lib/gss_mechs/mech_krb5; pwd; $(MAKE) CRYPT_SRC
287	@cd lib/gss_mechs/mech_spnego; pwd; $(MAKE) CRYPT_SRC
288	@cd lib/libelfsign;   pwd; $(MAKE) CRYPT_SRC
289	@cd lib/libike;   pwd; $(MAKE) CRYPT_SRC
290	@cd lib/libnsl;	 pwd; $(MAKE) CRYPT_SRC
291	@cd lib/libsasl;	 pwd; $(MAKE) CRYPT_SRC
292	@cd lib/libresolv2;	 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 tools/elfsign; pwd; $(MAKE) CRYPT_SRC
296	@cd uts/common/gssapi;    pwd; $(MAKE) CRYPT_SRC
297	@cd uts/common/gssapi/include;    pwd; $(MAKE) CRYPT_SRC
298	@cd uts/common/gssapi/mechs/dummy;        pwd; $(MAKE) CRYPT_SRC
299	@cd uts/common/gssapi/mechs/krb5; 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 [ -x "$($(MACH)_CC)" ]; then		\
323		$(ECHO) $($(MACH)_CC);			\
324		$($(MACH)_CC) -V 2>&1 | head -1;	\
325	elif [ -x "$(SPRO_VROOT)/bin/cc" ]; then	\
326		$(ECHO) $(SPRO_VROOT)/bin/cc;		\
327		$(SPRO_VROOT)/bin/cc -V 2>&1 | head -1;	\
328	else						\
329		$(ECHO) No compiler found;		\
330		exit 1;					\
331	fi
332
333cc64-version:
334	@if [ -x "$($(MACH64)_CC)" ]; then		\
335		$(ECHO) 64-bit compiler;		\
336		$(ECHO) $($(MACH64)_CC);		\
337		$($(MACH64)_CC) -V 2>&1 | head -1;	\
338	elif [ -x "$(GNU_ROOT)/bin/gcc" ]; then		\
339		$(ECHO) 64-bit compiler;		\
340		$(ECHO) $(GNU_ROOT)/bin/gcc;		\
341		$(GNU_ROOT)/bin/gcc --version 2>&1 | head -1;	\
342	else						\
343		$(ECHO) No 64-bit compiler found;	\
344	fi
345
346java-version:
347	@if [ -x "$(JAVAC)" ]; then			\
348		$(ECHO) $(JAVAC);			\
349		$(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1;	\
350	else						\
351		$(ECHO) No Java compiler found;		\
352		exit 1;					\
353	fi
354