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