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