Home | History | Annotate | Download | only in src
      1 #
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the "License").
      7 # You may not use this file except in compliance 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 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     23 # Use is subject to license terms.
     24 #
     25 #pragma ident	"@(#)Makefile	1.14	09/05/07 SMI"
     26 #
     27 # Makefile for sfw source
     28 #
     29 # include global definitions
     30 include Makefile.master
     31 #
     32 # the Targetdirs file is the AT&T target.dirs file in a makefile format.
     33 # it defines TARGETDIRS and ROOTDIRS.
     34 include Targetdirs
     35 
     36 # We don't have a ROOTDIRS equivalent for creating empty plain files,
     37 # because there aren't enough of them to be worth generalizing.
     38 # ROOTFILES_555 is a list of files that are created in the proto with
     39 # mode 555 as placeholders for packaging purposes, but which are not
     40 # delivered as final product.
     41 #
     42 #	usr/lib/isaexec
     43 #		Placeholder stub for applications that want to
     44 #		use a hard link to /usr/lib/isaexec.
     45 #
     46 ROOTFILES_555=	$(ROOT)/usr/lib/isaexec
     47 
     48 COMMON_SUBDIRS=	lib cmd
     49 
     50 SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
     51 
     52 HDRSUBDIRS=	lib cmd
     53 
     54 all :=		TARGET= all
     55 install :=	TARGET= install
     56 install_h :=	TARGET= install_h
     57 clean :=	TARGET= clean
     58 clobber :=	TARGET= clobber
     59 meta-check :=	TARGET= meta-check
     60 component-hook :=	TARGET= component-hook
     61 
     62 #
     63 # Note: install only builds the all target for the pkgdefs
     64 #       directory.  We are not yet ready to have an install
     65 #	build create 'packages' also.  To build packages
     66 #	cd pkgdefs and do a 'make install'
     67 #
     68 all: headers .WAIT tools .WAIT $(SUBDIRS) pkg_all
     69 
     70 install: build_check .WAIT headers .WAIT tools .WAIT $(SUBDIRS) pkg_all
     71 
     72 clean clobber: $(SUBDIRS) pkgdefs
     73 
     74 meta-check component-hook: $(SUBDIRS)
     75 
     76 # this is here only for findunref (for now)
     77 lint:
     78 
     79 pkg_all:
     80 	@cd pkgdefs; pwd; $(MAKE) all
     81 
     82 headers: rootdirs .WAIT libheaders
     83 
     84 common_files:	$(ROOTDIRS) $(ROOTFILES_555)
     85 	cd common; pwd; $(MAKE) install
     86 
     87 rootdirs: $(ROOTDIRS) common_files
     88 
     89 $(ROOTDIRS):
     90 	$(INS.dir)
     91 
     92 $(ROOTFILES_555) : $(ROOTDIRS)
     93 	touch $@
     94 	chmod 0555 $@
     95 
     96 libheaders: FRC
     97 	@cd lib; pwd; $(MAKE) install_h
     98 
     99 $(SUBDIRS) pkgdefs tools: FRC
    100 	@cd $@; echo "$(TARGET) \c"; pwd; $(MAKE) $(TARGET)
    101 
    102 # top-level setup target to setup the development environment
    103 # this includes headers and tools.  
    104 setup: build_check .WAIT headers .WAIT tools
    105 
    106 # build_check - try to identify things known to (possibly)
    107 # cause trouble so the mail message and log from nightly
    108 # can point them out.
    109 SFW_DANGER_DIRS= \
    110 	/opt/sfw/bin \
    111 	/opt/sfw/lib \
    112 	/opt/sfw/include \
    113 	/usr/local/bin \
    114 	/usr/local/lib \
    115 	/usr/local/include
    116 
    117 build_check: FRC
    118 	@found=0 ; \
    119 	for dir in $(SFW_DANGER_DIRS) ; do \
    120 		if [ -d $$dir ]; then \
    121 			if [ $$found == 0 ]; then \
    122 				echo "Things that may affect the build." ; \
    123 				found=1; \
    124 			fi ; \
    125 			echo "\t$$dir"; \
    126 		fi \
    127 	done ; \
    128 	if [ $$found == 1 ]; then \
    129 		echo ; \
    130 	fi
    131 
    132 cscope.out tags: FRC
    133 	$(XREF) -f -x $@
    134 
    135 #
    136 # Targets for reporting compiler versions; nightly uses these.
    137 #
    138 
    139 cc-version: build_check
    140 	@if [ -x "$($(MACH)_CC)" ]; then			\
    141 		$(ECHO) 32-bit compiler;			\
    142 		$(ECHO) $($(MACH)_CC);				\
    143 		$($(MACH)_CC) -V 2>&1 | head -1;		\
    144 	else							\
    145 		__COMPILER=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
    146 		if [ -z "$$__COMPILER" ]; then			\
    147 			$(ECHO) No 32-bit compiler found;	\
    148 			exit 1;					\
    149 		else						\
    150 			$(ECHO) 32-bit compiler;		\
    151 			$(ECHO) $($(MACH)_CC);			\
    152 			$(ECHO) $$__COMPILER;			\
    153 			$($(MACH)_CC) -V 2>&1 | head -1;	\
    154 		fi;						\
    155 	fi
    156 
    157 cc64-version:
    158 	@if [ -x "$($(MACH64)_CC)" ]; then			\
    159 		$(ECHO) 64-bit compiler;			\
    160 		$(ECHO) $($(MACH64)_CC);			\
    161 		$($(MACH64)_CC) -V 2>&1 | head -1;		\
    162 	else							\
    163 		__COMPILER=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
    164 		if [ -z "$$__COMPILER" ]; then			\
    165 			$(ECHO) No 64-bit compiler found;	\
    166 			exit 1;					\
    167 		else						\
    168 			$(ECHO) 64-bit compiler;		\
    169 			$(ECHO) $($(MACH64)_CC);		\
    170 			$(ECHO) $$__COMPILER;			\
    171 			$($(MACH64)_CC) -V 2>&1 | head -1;	\
    172 		fi;						\
    173 	fi
    174 
    175 java-version:
    176 	@if [ -x "$(JAVAC)" ]; then			\
    177 		$(ECHO) $(JAVAC);			\
    178 		$(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1;	\
    179 	else						\
    180 		$(ECHO) No Java compiler found;		\
    181 		exit 1;					\
    182 	fi
    183 
    184 FRC:
    185