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