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 2008 Sun Microsystems, Inc.  All rights reserved.
     23 # Use is subject to license terms.
     24 #
     25 #pragma ident	"@(#)Makefile	1.11	08/05/15 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 COMMON_SUBDIRS=	lib cmd
     37 
     38 SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
     39 
     40 HDRSUBDIRS=	lib cmd
     41 
     42 all :=		TARGET= all
     43 install :=	TARGET= install
     44 install_h :=	TARGET= install_h
     45 clean :=	TARGET= clean
     46 clobber :=	TARGET= clobber
     47 
     48 #
     49 # Note: install only builds the all target for the pkgdefs
     50 #       directory.  We are not yet ready to have an install
     51 #	build create 'packages' also.  To build packages
     52 #	cd pkgdefs and do a 'make install'
     53 #
     54 all: headers .WAIT tools .WAIT $(SUBDIRS) pkg_all
     55 
     56 install: build_check .WAIT headers .WAIT tools .WAIT $(SUBDIRS) pkg_all
     57 
     58 clean clobber: $(SUBDIRS) pkgdefs
     59 
     60 pkg_all:
     61 	@cd pkgdefs; pwd; $(MAKE) all
     62 
     63 headers: rootdirs .WAIT libheaders
     64 
     65 common_files:	$(ROOTDIRS)
     66 	cd common; pwd; $(MAKE) install
     67 
     68 rootdirs: $(ROOTDIRS) common_files
     69 
     70 $(ROOTDIRS):
     71 	$(INS.dir)
     72 
     73 libheaders: FRC
     74 	@cd lib; pwd; $(MAKE) install_h
     75 
     76 $(SUBDIRS) pkgdefs: FRC
     77 	@cd $@; pwd; $(MAKE) $(TARGET)
     78 
     79 tools: FRC
     80 	@cd $@; pwd; $(MAKE) $(TARGET)
     81 
     82 # top-level setup target to setup the development environment
     83 # this includes headers and tools.  
     84 setup: build_check .WAIT headers .WAIT tools
     85 
     86 # build_check - try to identify things known to (possibly)
     87 # cause trouble so the mail message and log from nightly
     88 # can point them out.
     89 SFW_DANGER_DIRS= \
     90 	/opt/sfw/bin \
     91 	/opt/sfw/lib \
     92 	/opt/sfw/include \
     93 	/usr/local/bin \
     94 	/usr/local/lib \
     95 	/usr/local/include
     96 
     97 build_check: FRC
     98 	@found=0 ; \
     99 	for dir in $(SFW_DANGER_DIRS) ; do \
    100 		if [ -d $$dir ]; then \
    101 			if [ $$found == 0 ]; then \
    102 				echo "Things that may affect the build." ; \
    103 				found=1; \
    104 			fi ; \
    105 			echo "\t$$dir"; \
    106 		fi \
    107 	done ; \
    108 	if [ $$found == 1 ]; then \
    109 		echo ; \
    110 	fi
    111 
    112 cscope.out tags: FRC
    113 	$(XREF) -f -x $@
    114 
    115 #
    116 # Targets for reporting compiler versions; nightly uses these.
    117 #
    118 
    119 cc-version: build_check
    120 	@if [ -x "$($(MACH)_CC)" ]; then			\
    121 		$(ECHO) 32-bit compiler;			\
    122 		$(ECHO) $($(MACH)_CC);				\
    123 		$($(MACH)_CC) -V 2>&1 | head -1;		\
    124 	else							\
    125 		__COMPILER=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
    126 		if [ -z "$$__COMPILER" ]; then			\
    127 			$(ECHO) No 32-bit compiler found;	\
    128 			exit 1;					\
    129 		else						\
    130 			$(ECHO) 32-bit compiler;		\
    131 			$(ECHO) $($(MACH)_CC);			\
    132 			$(ECHO) $$__COMPILER;			\
    133 			$($(MACH)_CC) -V 2>&1 | head -1;	\
    134 		fi;						\
    135 	fi
    136 
    137 cc64-version:
    138 	@if [ -x "$($(MACH64)_CC)" ]; then			\
    139 		$(ECHO) 64-bit compiler;			\
    140 		$(ECHO) $($(MACH64)_CC);			\
    141 		$($(MACH64)_CC) -V 2>&1 | head -1;		\
    142 	else							\
    143 		__COMPILER=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\
    144 		if [ -z "$$__COMPILER" ]; then			\
    145 			$(ECHO) No 64-bit compiler found;	\
    146 			exit 1;					\
    147 		else						\
    148 			$(ECHO) 64-bit compiler;		\
    149 			$(ECHO) $($(MACH64)_CC);		\
    150 			$(ECHO) $$__COMPILER;			\
    151 			$($(MACH64)_CC) -V 2>&1 | head -1;	\
    152 		fi;						\
    153 	fi
    154 
    155 java-version:
    156 	@if [ -x "$(JAVAC)" ]; then			\
    157 		$(ECHO) $(JAVAC);			\
    158 		$(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1;	\
    159 	else						\
    160 		$(ECHO) No Java compiler found;		\
    161 		exit 1;					\
    162 	fi
    163 
    164 FRC:
    165