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