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 # 23 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 24 # Copyright (c) 2012 by Delphix. All rights reserved. 25 # 26 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 psm man test 38 sparc_SUBDIRS= stand 39 i386_SUBDIRS= grub 40 41 # 42 # sparc needs to build stand before psm 43 # 44 $(SPARC_BLD)psm: stand 45 46 SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS) 47 48 HDRSUBDIRS= uts head lib cmd 49 50 # UCB headers are bug-for-bug compatible and not checkable against the header 51 # standards. 52 # 53 CHKHDRSUBDIRS= head uts lib 54 55 # 56 # Headers that can be built in parallel 57 # 58 PARALLEL_HEADERS = sysheaders userheaders libheaders cmdheaders 59 60 # 61 # Directories that can be built in parallel 62 # 63 PARALLEL_DIRS = uts lib man 64 65 # The check target also causes smf(5) service manifests to be validated. 66 CHKMFSTSUBDIRS= cmd 67 68 MSGSUBDIRS= cmd ucbcmd lib 69 DOMAINS= \ 70 SUNW_OST_ADMIN \ 71 SUNW_OST_NETRPC \ 72 SUNW_OST_OSCMD \ 73 SUNW_OST_OSLIB \ 74 SUNW_OST_UCBCMD \ 75 SUNW_OST_ZONEINFO 76 77 MSGDDIRS= $(DOMAINS:%=$(MSGROOT)/%) 78 MSGDIRS= $(MSGROOT) $(MSGDDIRS) $(MSGROOT)/LC_TIME 79 80 all := TARGET= all 81 install := TARGET= install 82 install1 := TARGET= install 83 install2 := TARGET= install 84 install_h := TARGET= install_h 85 clean := TARGET= clean 86 clobber := TARGET= clobber 87 check := TARGET= check 88 89 .KEEP_STATE: 90 91 # 92 # Note: install does not cause a build in pkg. To build packages, 93 # cd pkg and do a 'make install' 94 # 95 96 all: mapfiles closedbins sgs .WAIT $(SUBDIRS) pkg 97 98 # 99 # The _msg build is a two-step process. First, the _msg dependency 100 # causes recursive makes in $(MSGSUBDIRS), which stages raw message 101 # files in $(ROOT)/catalog. Second, the action from the install 102 # target rule causes those messages to be post-processed from where 103 # they were staged in $(ROOT)/catalog, and the results placed into the 104 # proto area. 105 # 106 # The stage-licenses target causes the license files needed for 107 # packaging to be pulled from $(SRC) and $(CLOSED) and staged in 108 # $(ROOT)/licenses. 109 # 110 install: install1 install2 _msg stage-licenses 111 @cd msg; pwd; $(MAKE) _msg 112 @rm -rf "$(ROOT)/catalog" 113 114 stage-licenses: install2 115 @cd pkg; pwd; $(MAKE) stage-licenses 116 117 install1: mapfiles closedbins sgs 118 119 install2: install1 $(SUBDIRS) 120 121 _msg: _msgdirs rootdirs install2 FRC 122 @for m in $(MSGSUBDIRS); do \ 123 cd $$m; pwd; $(MAKE) _msg; cd ..; \ 124 done 125 126 mapfiles: bldtools 127 @cd common/mapfiles; pwd; $(MAKE) install 128 129 clean clobber: $(SUBDIRS) head pkg 130 131 closedbins: bldtools $(ROOTDIRS) FRC 132 @CLOSED_ROOT="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \ 133 if [ ! -d "$$CLOSED_ROOT" ]; then \ 134 $(ECHO) "Error: ON_CLOSED_BINS must point to closed" \ 135 "binaries."; \ 136 $(ECHO) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \ 137 "present in $$ON_CLOSED_BINS."; \ 138 exit 1; \ 139 fi; \ 140 $(ECHO) "Copying closed binaries from $$CLOSED_ROOT"; \ 141 (cd $$CLOSED_ROOT; \ 142 $(TAR) cfX - $(CODEMGR_WS)/exception_lists/closed-bins .) | \ 143 (cd $(ROOT); $(TAR) xBpf -); \ 144 ( cd $(ROOT); $(CTFSTRIP) $$(cd $$CLOSED_ROOT; $(FIND) \ 145 ./kernel ./usr/kernel ./platform/*/kernel -type f -a -perm -u+x | \ 146 $(EGREP) -vf $(CODEMGR_WS)/exception_lists/closed-bins) ) 147 148 # 149 # Declare what parts can be built in parallel 150 # DUMMY at the end is used in case macro expansion produces an empty string to 151 # prevent everything going in parallel 152 # 153 .PARALLEL: $(PARALLEL_HEADERS) DUMMY 154 .PARALLEL: $(PARALLEL_DIRS) DUMMY 155 156 $(SUBDIRS) head pkg: FRC 157 @cd $@; pwd; $(MAKE) $(TARGET) 158 159 # librpcsvc has a dependency on headers installed by 160 # userheaders, hence the .WAIT before libheaders. 161 sgs: rootdirs .WAIT sysheaders userheaders .WAIT \ 162 libheaders cmdheaders 163 164 # 165 # Top-level setup target to setup the development environment that includes 166 # headers, tools and generated mapfiles. For open-only builds (i.e.: source 167 # trees w/o usr/closed), this also depends on the closedbins target (above) 168 # in order to properly seed the proto area. Note, although the tools are 169 # dependent on a number of constant mapfiles, the tools themselves are 170 # required to build the generated mapfiles. 171 # 172 setup: closedbins bldtools sgs mapfiles 173 174 bldtools: 175 @cd tools; pwd; $(MAKE) install 176 177 # /var/mail/:saved is a special case because of the colon in the name. 178 # 179 rootdirs: $(ROOTDIRS) 180 $(INS) -d -m 775 $(ROOT)/var/mail/:saved 181 182 lint: FRC 183 $(MAKE) -f Makefile.lint 184 185 _msgdirs: $(MSGDIRS) 186 187 $(ROOTDIRS) $(MSGDIRS): 188 $(INS.dir) 189 190 userheaders: FRC 191 @cd head; pwd; $(MAKE) install_h 192 193 libheaders: bldtools 194 @cd lib; pwd; $(MAKE) install_h 195 196 sysheaders: FRC 197 @cd uts; pwd; $(MAKE) install_h 198 199 cmdheaders: FRC 200 @cd cmd/fm; pwd; $(MAKE) install_h 201 @cd cmd/mdb; pwd; $(MAKE) install_h 202 203 check: $(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS) 204 205 # 206 # Cross-reference customization: skip all of the subdirectories that 207 # don't contain actual source code. 208 # 209 XRPRUNE = pkg prototypes 210 XRINCDIRS = uts/common head ucbhead 211 212 cscope.out tags: FRC 213 $(XREF) -f -x $@ 214 215 FRC: 216 217 # 218 # Targets for reporting compiler versions; nightly uses these. 219 # 220 221 cc-version: 222 @if $($(MACH)_CC) -_versions >/dev/null 2>/dev/null; then \ 223 $(ECHO) 32-bit compiler; \ 224 $(ECHO) $($(MACH)_CC); \ 225 $($(MACH)_CC) -_versions 2>&1 | \ 226 $(EGREP) '^(cw|cc|gcc|primary|shadow)'; \ 227 else \ 228 __COMPILER=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\ 229 if [ -z "$$__COMPILER" ]; then \ 230 $(ECHO) No 32-bit compiler found; \ 231 exit 1; \ 232 else \ 233 $(ECHO) 32-bit compiler; \ 234 $(ECHO) $($(MACH)_CC); \ 235 $(ECHO) $$__COMPILER; \ 236 $($(MACH)_CC) -V 2>&1 | head -1; \ 237 fi; \ 238 fi 239 240 cc64-version: 241 @if $($(MACH64)_CC) -_versions >/dev/null 2>/dev/null; then \ 242 $(ECHO) 64-bit compiler; \ 243 $(ECHO) $($(MACH64)_CC); \ 244 $($(MACH64)_CC) -_versions 2>&1 | \ 245 $(EGREP) '^(cw|cc|gcc|primary|shadow)'; \ 246 else \ 247 __COMPILER=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\ 248 if [ -z "$$__COMPILER" ]; then \ 249 $(ECHO) No 64-bit compiler found; \ 250 exit 1; \ 251 else \ 252 $(ECHO) 64-bit compiler; \ 253 $(ECHO) $($(MACH64)_CC); \ 254 $(ECHO) $$__COMPILER; \ 255 $($(MACH64)_CC) -V 2>&1 | head -1; \ 256 fi; \ 257 fi 258 259 java-version: 260 @if [ -x "$(JAVAC)" ]; then \ 261 $(ECHO) $(JAVAC); \ 262 $(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1; \ 263 else \ 264 $(ECHO) No Java compiler found; \ 265 exit 1; \ 266 fi