stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 1 | # |
| 2 | # CDDL HEADER START |
| 3 | # |
| 4 | # The contents of this file are subject to the terms of the |
kupfer | fb9f9b9 | 2005-12-21 19:47:57 -0800 | [diff] [blame] | 5 | # Common Development and Distribution License (the "License"). |
| 6 | # You may not use this file except in compliance with the License. |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 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 | # |
John Wren Kennedy | d583b39 | 2012-12-05 22:04:50 -0500 | [diff] [blame] | 21 | |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 22 | # |
jmcp | 78add22 | 2010-07-06 17:14:19 -0700 | [diff] [blame] | 23 | # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. |
John Wren Kennedy | d583b39 | 2012-12-05 22:04:50 -0500 | [diff] [blame] | 24 | # Copyright (c) 2012 by Delphix. All rights reserved. |
Garrett D'Amore | 95c635e | 2014-07-14 20:10:37 -0700 | [diff] [blame] | 25 | # Copyright 2014 Garrett D'Amore <garrett@damore.org> |
jmcp | 78add22 | 2010-07-06 17:14:19 -0700 | [diff] [blame] | 26 | # |
John Wren Kennedy | d583b39 | 2012-12-05 22:04:50 -0500 | [diff] [blame] | 27 | |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 28 | # |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 29 | # Makefile for system source |
| 30 | # |
| 31 | # include global definitions |
| 32 | include Makefile.master |
| 33 | # |
| 34 | # the Targetdirs file is the AT&T target.dirs file in a makefile format. |
| 35 | # it defines TARGETDIRS and ROOTDIRS. |
| 36 | include Targetdirs |
| 37 | |
John Wren Kennedy | d583b39 | 2012-12-05 22:04:50 -0500 | [diff] [blame] | 38 | COMMON_SUBDIRS= uts lib cmd ucblib ucbcmd psm man test |
Mark J. Nelson | e3c7c8f | 2010-07-16 13:18:12 -0600 | [diff] [blame] | 39 | sparc_SUBDIRS= stand |
| 40 | i386_SUBDIRS= grub |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 41 | |
| 42 | # |
Mark J. Nelson | e3c7c8f | 2010-07-16 13:18:12 -0600 | [diff] [blame] | 43 | # sparc needs to build stand before psm |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 44 | # |
Mark J. Nelson | e3c7c8f | 2010-07-16 13:18:12 -0600 | [diff] [blame] | 45 | $(SPARC_BLD)psm: stand |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 46 | |
| 47 | SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS) |
| 48 | |
Garrett D'Amore | 5bbb4db | 2009-10-09 17:01:12 -0700 | [diff] [blame] | 49 | HDRSUBDIRS= uts head lib cmd |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 50 | |
| 51 | # UCB headers are bug-for-bug compatible and not checkable against the header |
| 52 | # standards. |
| 53 | # |
| 54 | CHKHDRSUBDIRS= head uts lib |
| 55 | |
akolb | 98157a7 | 2008-02-27 15:35:58 -0800 | [diff] [blame] | 56 | # |
| 57 | # Headers that can be built in parallel |
| 58 | # |
Garrett D'Amore | 5bbb4db | 2009-10-09 17:01:12 -0700 | [diff] [blame] | 59 | PARALLEL_HEADERS = sysheaders userheaders libheaders cmdheaders |
akolb | 98157a7 | 2008-02-27 15:35:58 -0800 | [diff] [blame] | 60 | |
| 61 | # |
| 62 | # Directories that can be built in parallel |
| 63 | # |
Richard Lowe | c10c16d | 2011-03-14 14:05:30 -0400 | [diff] [blame] | 64 | PARALLEL_DIRS = uts lib man |
akolb | 98157a7 | 2008-02-27 15:35:58 -0800 | [diff] [blame] | 65 | |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 66 | # The check target also causes smf(5) service manifests to be validated. |
| 67 | CHKMFSTSUBDIRS= cmd |
| 68 | |
Garrett D'Amore | 95c635e | 2014-07-14 20:10:37 -0700 | [diff] [blame] | 69 | # And man page formats |
| 70 | CHKMANSUBDIRS = man |
| 71 | |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 72 | MSGSUBDIRS= cmd ucbcmd lib |
| 73 | DOMAINS= \ |
| 74 | SUNW_OST_ADMIN \ |
| 75 | SUNW_OST_NETRPC \ |
| 76 | SUNW_OST_OSCMD \ |
| 77 | SUNW_OST_OSLIB \ |
| 78 | SUNW_OST_UCBCMD \ |
| 79 | SUNW_OST_ZONEINFO |
| 80 | |
| 81 | MSGDDIRS= $(DOMAINS:%=$(MSGROOT)/%) |
| 82 | MSGDIRS= $(MSGROOT) $(MSGDDIRS) $(MSGROOT)/LC_TIME |
| 83 | |
Josef 'Jeff' Sipek | 694c35f | 2013-07-29 16:16:59 -0400 | [diff] [blame] | 84 | all := TARGET= all |
| 85 | install := TARGET= install |
Mark J. Nelson | e3c7c8f | 2010-07-16 13:18:12 -0600 | [diff] [blame] | 86 | install1 := TARGET= install |
| 87 | install2 := TARGET= install |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 88 | install_h := TARGET= install_h |
| 89 | clean := TARGET= clean |
| 90 | clobber := TARGET= clobber |
| 91 | check := TARGET= check |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 92 | |
| 93 | .KEEP_STATE: |
| 94 | |
| 95 | # |
Mark J. Nelson | e3c7c8f | 2010-07-16 13:18:12 -0600 | [diff] [blame] | 96 | # Note: install does not cause a build in pkg. To build packages, |
Liane Praza | ead1f93 | 2010-03-02 19:29:26 -0700 | [diff] [blame] | 97 | # cd pkg and do a 'make install' |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 98 | # |
Mark J. Nelson | e3c7c8f | 2010-07-16 13:18:12 -0600 | [diff] [blame] | 99 | |
| 100 | all: mapfiles closedbins sgs .WAIT $(SUBDIRS) pkg |
| 101 | |
Mark J. Nelson | 5084e75 | 2010-08-02 16:37:22 -0600 | [diff] [blame] | 102 | # |
| 103 | # The _msg build is a two-step process. First, the _msg dependency |
| 104 | # causes recursive makes in $(MSGSUBDIRS), which stages raw message |
| 105 | # files in $(ROOT)/catalog. Second, the action from the install |
| 106 | # target rule causes those messages to be post-processed from where |
| 107 | # they were staged in $(ROOT)/catalog, and the results placed into the |
| 108 | # proto area. |
| 109 | # |
| 110 | # The stage-licenses target causes the license files needed for |
| 111 | # packaging to be pulled from $(SRC) and $(CLOSED) and staged in |
| 112 | # $(ROOT)/licenses. |
| 113 | # |
| 114 | install: install1 install2 _msg stage-licenses |
Mark J. Nelson | 581cede | 2009-08-31 16:44:41 -0600 | [diff] [blame] | 115 | @cd msg; pwd; $(MAKE) _msg |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 116 | @rm -rf "$(ROOT)/catalog" |
| 117 | |
Mark J. Nelson | 5084e75 | 2010-08-02 16:37:22 -0600 | [diff] [blame] | 118 | stage-licenses: install2 |
| 119 | @cd pkg; pwd; $(MAKE) stage-licenses |
| 120 | |
Mark J. Nelson | e3c7c8f | 2010-07-16 13:18:12 -0600 | [diff] [blame] | 121 | install1: mapfiles closedbins sgs |
| 122 | |
| 123 | install2: install1 $(SUBDIRS) |
| 124 | |
Gordon Ross | b6805bf | 2013-08-23 18:31:03 -0400 | [diff] [blame] | 125 | _msg: _msgdirs rootdirs FRC |
Mark J. Nelson | e3c7c8f | 2010-07-16 13:18:12 -0600 | [diff] [blame] | 126 | @for m in $(MSGSUBDIRS); do \ |
| 127 | cd $$m; pwd; $(MAKE) _msg; cd ..; \ |
| 128 | done |
| 129 | |
rie | 232c663 | 2007-06-12 11:39:43 -0700 | [diff] [blame] | 130 | mapfiles: bldtools |
rie | 24da5b3 | 2007-05-17 16:27:31 -0700 | [diff] [blame] | 131 | @cd common/mapfiles; pwd; $(MAKE) install |
| 132 | |
Gordon Ross | b6805bf | 2013-08-23 18:31:03 -0400 | [diff] [blame] | 133 | clean: $(SUBDIRS) head pkg |
| 134 | clobber: $(SUBDIRS) head pkg clobber_local |
| 135 | clobber_local: |
| 136 | @cd tools; pwd; $(MAKE) clobber |
| 137 | @cd common/mapfiles; pwd; $(MAKE) clobber |
| 138 | @cd msg; pwd; $(MAKE) clobber |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 139 | |
Jason King | a0ed503 | 2012-09-14 12:26:23 -0400 | [diff] [blame] | 140 | closedbins: bldtools $(ROOTDIRS) FRC |
ah89892 | 5b43ca4 | 2006-11-27 21:56:37 -0800 | [diff] [blame] | 141 | @CLOSED_ROOT="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \ |
Josef 'Jeff' Sipek | c0e7977 | 2013-10-15 00:21:04 -0400 | [diff] [blame] | 142 | if [ ! -d "$$CLOSED_ROOT" ]; then \ |
| 143 | $(ECHO) "Error: ON_CLOSED_BINS must point to closed" \ |
| 144 | "binaries."; \ |
| 145 | $(ECHO) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \ |
| 146 | "present in $$ON_CLOSED_BINS."; \ |
| 147 | exit 1; \ |
| 148 | fi; \ |
| 149 | $(ECHO) "Copying closed binaries from $$CLOSED_ROOT"; \ |
| 150 | (cd $$CLOSED_ROOT; \ |
| 151 | $(TAR) cfX - $(CODEMGR_WS)/exception_lists/closed-bins .) | \ |
| 152 | (cd $(ROOT); $(TAR) xBpf -); \ |
| 153 | ( cd $(ROOT); $(CTFSTRIP) $$(cd $$CLOSED_ROOT; $(FIND) \ |
| 154 | ./kernel ./usr/kernel ./platform/*/kernel -type f -a -perm -u+x | \ |
| 155 | $(EGREP) -vf $(CODEMGR_WS)/exception_lists/closed-bins) ) |
kupfer | fb9f9b9 | 2005-12-21 19:47:57 -0800 | [diff] [blame] | 156 | |
akolb | 98157a7 | 2008-02-27 15:35:58 -0800 | [diff] [blame] | 157 | # |
Mark J. Nelson | e3c7c8f | 2010-07-16 13:18:12 -0600 | [diff] [blame] | 158 | # Declare what parts can be built in parallel |
akolb | 98157a7 | 2008-02-27 15:35:58 -0800 | [diff] [blame] | 159 | # DUMMY at the end is used in case macro expansion produces an empty string to |
| 160 | # prevent everything going in parallel |
| 161 | # |
| 162 | .PARALLEL: $(PARALLEL_HEADERS) DUMMY |
| 163 | .PARALLEL: $(PARALLEL_DIRS) DUMMY |
| 164 | |
Liane Praza | ead1f93 | 2010-03-02 19:29:26 -0700 | [diff] [blame] | 165 | $(SUBDIRS) head pkg: FRC |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 166 | @cd $@; pwd; $(MAKE) $(TARGET) |
| 167 | |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 168 | # librpcsvc has a dependency on headers installed by |
| 169 | # userheaders, hence the .WAIT before libheaders. |
| 170 | sgs: rootdirs .WAIT sysheaders userheaders .WAIT \ |
Garrett D'Amore | 5bbb4db | 2009-10-09 17:01:12 -0700 | [diff] [blame] | 171 | libheaders cmdheaders |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 172 | |
| 173 | # |
rie | 232c663 | 2007-06-12 11:39:43 -0700 | [diff] [blame] | 174 | # Top-level setup target to setup the development environment that includes |
| 175 | # headers, tools and generated mapfiles. For open-only builds (i.e.: source |
| 176 | # trees w/o usr/closed), this also depends on the closedbins target (above) |
| 177 | # in order to properly seed the proto area. Note, although the tools are |
| 178 | # dependent on a number of constant mapfiles, the tools themselves are |
| 179 | # required to build the generated mapfiles. |
stevel | 7345d6c | 2006-05-12 15:47:12 -0700 | [diff] [blame] | 180 | # |
jmcp | 78add22 | 2010-07-06 17:14:19 -0700 | [diff] [blame] | 181 | setup: closedbins bldtools sgs mapfiles |
rie | 232c663 | 2007-06-12 11:39:43 -0700 | [diff] [blame] | 182 | |
jmcp | 78add22 | 2010-07-06 17:14:19 -0700 | [diff] [blame] | 183 | bldtools: |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 184 | @cd tools; pwd; $(MAKE) install |
| 185 | |
| 186 | # /var/mail/:saved is a special case because of the colon in the name. |
| 187 | # |
| 188 | rootdirs: $(ROOTDIRS) |
| 189 | $(INS) -d -m 775 $(ROOT)/var/mail/:saved |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 190 | |
| 191 | lint: FRC |
| 192 | $(MAKE) -f Makefile.lint |
| 193 | |
| 194 | _msgdirs: $(MSGDIRS) |
| 195 | |
| 196 | $(ROOTDIRS) $(MSGDIRS): |
| 197 | $(INS.dir) |
| 198 | |
| 199 | userheaders: FRC |
| 200 | @cd head; pwd; $(MAKE) install_h |
| 201 | |
jmcp | 78add22 | 2010-07-06 17:14:19 -0700 | [diff] [blame] | 202 | libheaders: bldtools |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 203 | @cd lib; pwd; $(MAKE) install_h |
| 204 | |
| 205 | sysheaders: FRC |
| 206 | @cd uts; pwd; $(MAKE) install_h |
| 207 | |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 208 | cmdheaders: FRC |
| 209 | @cd cmd/fm; pwd; $(MAKE) install_h |
| 210 | @cd cmd/mdb; pwd; $(MAKE) install_h |
| 211 | |
Garrett D'Amore | 95c635e | 2014-07-14 20:10:37 -0700 | [diff] [blame] | 212 | check: $(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS) $(CHKMANSUBDIRS) |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 213 | |
| 214 | # |
| 215 | # Cross-reference customization: skip all of the subdirectories that |
| 216 | # don't contain actual source code. |
| 217 | # |
Josef 'Jeff' Sipek | 694c35f | 2013-07-29 16:16:59 -0400 | [diff] [blame] | 218 | XRPRUNE = pkg prototypes |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 219 | XRINCDIRS = uts/common head ucbhead |
| 220 | |
| 221 | cscope.out tags: FRC |
| 222 | $(XREF) -f -x $@ |
| 223 | |
| 224 | FRC: |
| 225 | |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 226 | # |
| 227 | # Targets for reporting compiler versions; nightly uses these. |
| 228 | # |
| 229 | |
| 230 | cc-version: |
wesolows | 1912d2c | 2006-04-11 13:06:32 -0700 | [diff] [blame] | 231 | @if $($(MACH)_CC) -_versions >/dev/null 2>/dev/null; then \ |
wesolows | 010b217 | 2005-08-24 11:01:45 -0700 | [diff] [blame] | 232 | $(ECHO) 32-bit compiler; \ |
wesolows | bf40377 | 2005-07-22 18:40:14 -0700 | [diff] [blame] | 233 | $(ECHO) $($(MACH)_CC); \ |
wesolows | 1912d2c | 2006-04-11 13:06:32 -0700 | [diff] [blame] | 234 | $($(MACH)_CC) -_versions 2>&1 | \ |
| 235 | $(EGREP) '^(cw|cc|gcc|primary|shadow)'; \ |
wesolows | bf40377 | 2005-07-22 18:40:14 -0700 | [diff] [blame] | 236 | else \ |
| 237 | __COMPILER=`$($(MACH)_CC) -_compiler 2>/dev/null || $(TRUE)`;\ |
| 238 | if [ -z "$$__COMPILER" ]; then \ |
wesolows | 010b217 | 2005-08-24 11:01:45 -0700 | [diff] [blame] | 239 | $(ECHO) No 32-bit compiler found; \ |
wesolows | bf40377 | 2005-07-22 18:40:14 -0700 | [diff] [blame] | 240 | exit 1; \ |
| 241 | else \ |
wesolows | 010b217 | 2005-08-24 11:01:45 -0700 | [diff] [blame] | 242 | $(ECHO) 32-bit compiler; \ |
wesolows | bf40377 | 2005-07-22 18:40:14 -0700 | [diff] [blame] | 243 | $(ECHO) $($(MACH)_CC); \ |
| 244 | $(ECHO) $$__COMPILER; \ |
| 245 | $($(MACH)_CC) -V 2>&1 | head -1; \ |
| 246 | fi; \ |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 247 | fi |
| 248 | |
| 249 | cc64-version: |
wesolows | 1912d2c | 2006-04-11 13:06:32 -0700 | [diff] [blame] | 250 | @if $($(MACH64)_CC) -_versions >/dev/null 2>/dev/null; then \ |
wesolows | 010b217 | 2005-08-24 11:01:45 -0700 | [diff] [blame] | 251 | $(ECHO) 64-bit compiler; \ |
wesolows | bf40377 | 2005-07-22 18:40:14 -0700 | [diff] [blame] | 252 | $(ECHO) $($(MACH64)_CC); \ |
wesolows | 1912d2c | 2006-04-11 13:06:32 -0700 | [diff] [blame] | 253 | $($(MACH64)_CC) -_versions 2>&1 | \ |
| 254 | $(EGREP) '^(cw|cc|gcc|primary|shadow)'; \ |
wesolows | bf40377 | 2005-07-22 18:40:14 -0700 | [diff] [blame] | 255 | else \ |
| 256 | __COMPILER=`$($(MACH64)_CC) -_compiler 2>/dev/null || $(TRUE)`;\ |
| 257 | if [ -z "$$__COMPILER" ]; then \ |
| 258 | $(ECHO) No 64-bit compiler found; \ |
| 259 | exit 1; \ |
| 260 | else \ |
wesolows | 010b217 | 2005-08-24 11:01:45 -0700 | [diff] [blame] | 261 | $(ECHO) 64-bit compiler; \ |
wesolows | bf40377 | 2005-07-22 18:40:14 -0700 | [diff] [blame] | 262 | $(ECHO) $($(MACH64)_CC); \ |
| 263 | $(ECHO) $$__COMPILER; \ |
| 264 | $($(MACH64)_CC) -V 2>&1 | head -1; \ |
| 265 | fi; \ |
stevel@tonic-gate | 7c478bd | 2005-06-14 00:00:00 -0700 | [diff] [blame] | 266 | fi |
| 267 | |
| 268 | java-version: |
| 269 | @if [ -x "$(JAVAC)" ]; then \ |
| 270 | $(ECHO) $(JAVAC); \ |
| 271 | $(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1; \ |
| 272 | else \ |
| 273 | $(ECHO) No Java compiler found; \ |
| 274 | exit 1; \ |
| 275 | fi |