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