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/CDDL.txt
      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/CDDL.txt.
     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 #
     23 #ident	"@(#)Makefile	1.38	08/08/26 SMI"
     24 #
     25 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     26 # Use is subject to license terms.
     27 #
     28 # Makefile
     29 #
     30 # Makefile for system source
     31 #
     32 # include global definitions
     33 include Makefile.master
     34 #
     35 # the Targetdirs file defines TARGETDIRS and ROOTDIRS.
     36 include Targetdirs
     37 
     38 $(SUNOS)COMMON_SUBDIRS=	common uts lib cmd java uts/adb
     39 $(EUROPA)$(LINUX)COMMON_SUBDIRS=	common lib cmd
     40 $(SUNOS)$(NOT_RELEASE_BUILD)COMMON_SUBDIRS += tests
     41 $(EUROPA)$(LINUX)COMMON_SUBDIRS += linux
     42 
     43 SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
     44 
     45 HDRSUBDIRS=	uts head lib cmd
     46 
     47 CHKHDRSUBDIRS=	head sys common uts lib cmd
     48 $(INCLUDE_MACROS)CHKHDRSUBDIRS += uts/adb
     49 $(NOT_RELEASE_BUILD)CHKHDRSUBDIRS += tests
     50 
     51 MSGSUBDIRS=     cmd     lib
     52 
     53 DOMAINS=SUNW_SC_CMD 	\
     54 	SUNW_SC_LIB	\
     55 	SUNW_SC_CCON_LIB	\
     56 	SUNW_SC_INSTALL	\
     57 	SUNW_SC_UCMCMD	\
     58 	SUNW_SC_SALCMD	\
     59 	SUNW_SC_SALLIB
     60 
     61 MSGDDIRS=       $(DOMAINS:%=$(MSGROOT)/%)
     62 MSGDIRS=        $(MSGROOT) $(MSGDDIRS)
     63 
     64 all :=		TARGET= all
     65 install :=	TARGET= install
     66 install_h :=	TARGET= install_h
     67 clean :=	TARGET= clean
     68 clobber :=	TARGET= clobber
     69 check :=	TARGET= check
     70 lint :=		TARGET= lint
     71 _msg :=		TARGET= _msg
     72 
     73 .KEEP_STATE:
     74 
     75 #
     76 # Note: install only builds the all target for the pkgdefs
     77 #       directory.  We are not yet ready to have an install
     78 #	build create 'packages' also.  To build packages
     79 #	cd pkgdefs and do a 'make install'
     80 #
     81 all: closedbins install_h .WAIT $(SUBDIRS) pkg_all
     82 $(EUROPA)$(LINUX)install: install_h .WAIT $(SUBDIRS) pkg_all
     83 $(SUNOS)install: closedbins install_h .WAIT $(SUBDIRS) pkg_all .WAIT _msg
     84 $(SUNOS)	@cd pkgdefs/SUNW0sc; pwd; $(MAKE) _msg
     85 
     86 clean clobber: $(SUBDIRS) head pkgdefs clean_scmsgs .WAIT rm_build
     87 _msg: _msgdirs rootdirs _msgheaders $(MSGSUBDIRS)
     88 
     89 pkg_all:
     90 	@cd pkgdefs; pwd; $(MAKE) all
     91 
     92 $(SUBDIRS) head pkgdefs: FRC
     93 	@cd $@; pwd; $(MAKE) $(TARGET)
     94 
     95 rm_build: FRC
     96 	@-$(RM) $(SRC)/.build.last_OS
     97 
     98 .PARALLEL:	sysheaders userheaders libheaders
     99 
    100 # Copy any prebuilt closed source binaries
    101 closedbins: FRC
    102 	@CLOSED_VROOT="$(SC_CLOSED_BINS)/$(TARGET_ROOT)"; \
    103 	if [ -n "$(CLOSED_BUILD)" ]; then \
    104 		if [ ! -d "$$CLOSED_VROOT" ]; then \
    105 			$(ECHO) "Error: if closed sources are not present," \
    106 			    "SC_CLOSED_BINS must point to closed binaries."; \
    107 			$(ECHO) "$(TARGET_ROOT) is not" \
    108 			    "present in $(SC_CLOSED_BINS)."; \
    109 			exit 1; \
    110 		fi; \
    111 		$(ECHO) "Copying closed binaries from $$CLOSED_VROOT"; \
    112 		mkdir -p $(VROOT); \
    113 		(cd $$CLOSED_VROOT && tar cf - .) | \
    114 		    (cd $(VROOT) && tar xBpf -); \
    115 	fi
    116 
    117 install_h: rootdirs .WAIT sysheaders userheaders .WAIT libheaders
    118 
    119 rootdirs: $(ROOTDIRS)
    120 	-$(CHMOD) $(DIRMODE) $(VROOT)
    121 	-$(CHMOD) $(DIRMODE) `dirname $(VROOT)`
    122 
    123 lint: $(SUBDIRS)
    124 
    125 _msgdirs:       $(MSGDIRS)
    126 
    127 $(ROOTDIRS) $(MSGDIRS):
    128 	$(INS.dir)
    129 
    130 _msgheaders: userheaders sysheaders
    131 
    132 userheaders: FRC
    133 	@cd head; pwd; $(MAKE) install_h
    134 	@cd sys; pwd; $(MAKE) install_h
    135 
    136 libheaders: FRC
    137 	@cd lib; pwd; $(MAKE) install_h
    138 
    139 sysheaders: FRC
    140 	@cd uts; pwd; $(MAKE) install_h
    141 
    142 check:	$(CHKHDRSUBDIRS)
    143 
    144 # scmsgs check
    145 scmsgs: FRC
    146 	$(SCMSGS_BIN)/scmsgs_toplevel . \
    147 		cmd $(CLOSED)/cmd \
    148 		common $(CLOSED)/common \
    149 		lib $(CLOSED)/lib \
    150 		uts $(CLOSED)/uts
    151 
    152 clean_scmsgs:
    153 	$(RM) scmsgs-* nothing_to_remove
    154 
    155 # cscope
    156 $(CLOSED_BUILD)XRDIRS += ../closed
    157 XRADD = *.hh *.idl *.java *.ksh *.pl *.sh
    158 
    159 cscope.out tags: FRC
    160 	$(XREF) -f -x $@
    161 
    162 patch_build:
    163 	@cd pkgdefs; pwd; $(MAKE) patch_build
    164 
    165 FRC:
    166