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