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# Copyright 2014 Garrett D'Amore <garrett@damore.org> 26# Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. 27# Copyright 2016 Toomas Soome <tsoome@me.com> 28# Copyright 2018 Joyent, Inc. 29# Copyright 2019 OmniOS Community Edition (OmniOSce) Association. 30# 31 32# 33# Makefile for system source 34# 35# include global definitions 36include Makefile.master 37# 38# the Targetdirs file is the AT&T target.dirs file in a makefile format. 39# it defines TARGETDIRS and ROOTDIRS. 40include Targetdirs 41 42COMMON_SUBDIRS= data uts lib cmd ucblib ucbcmd man test 43sparc_SUBDIRS= psm stand 44i386_SUBDIRS= grub boot 45 46# 47# sparc needs to build stand before psm 48# 49$(SPARC_BLD)psm: stand 50 51SUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS) 52 53HDRSUBDIRS= uts head lib cmd 54 55# UCB headers are bug-for-bug compatible and not checkable against the header 56# standards. 57# 58CHKHDRSUBDIRS= head uts lib 59 60# 61# Headers that can be built in parallel 62# 63PARALLEL_HEADERS = sysheaders userheaders libheaders cmdheaders 64 65# 66# Directories that can be built in parallel 67# 68PARALLEL_DIRS = data uts lib man 69 70# The check target also causes smf(7) service manifests to be validated. 71CHKMFSTSUBDIRS= cmd 72 73# And man page formats 74CHKMANSUBDIRS = man 75 76MSGSUBDIRS= cmd ucbcmd lib data 77 78all := TARGET= all 79install := TARGET= install 80install1 := TARGET= install 81install2 := TARGET= install 82install_h := TARGET= install_h 83clean := TARGET= clean 84clobber := TARGET= clobber 85check := TARGET= check 86 87.KEEP_STATE: 88 89# 90# Note: install does not cause a build in pkg. To build packages, 91# cd pkg and do a 'make install' 92# 93 94all: mapfiles closedbins sgs .WAIT $(SUBDIRS) pkg 95 96# 97# The _msg build is a two-step process. First, the _msg dependency 98# causes recursive makes in $(MSGSUBDIRS), which stages raw message 99# files in $(ROOT)/catalog. Second, the action from the install 100# target rule causes those messages to be post-processed from where 101# they were staged in $(ROOT)/catalog, and the results placed into the 102# proto area. 103# 104# The stage-licenses target causes the license files needed for 105# packaging to be pulled from $(SRC) and $(CLOSED) and staged in 106# $(ROOT)/licenses. 107# 108install: install1 install2 _msg stage-licenses 109 @cd msg; pwd; $(MAKE) _msg 110 @rm -rf "$(ROOT)/catalog" 111 112stage-licenses: install2 113 @cd pkg; pwd; $(MAKE) stage-licenses 114 115install1: mapfiles closedbins sgs 116 117install2: install1 .WAIT $(SUBDIRS) 118 119_msg: rootdirs FRC 120 @for m in $(MSGSUBDIRS); do \ 121 cd $$m; pwd; $(MAKE) _msg; cd ..; \ 122 done 123 124mapfiles: bldtools 125 @cd common/mapfiles; pwd; $(MAKE) install 126 127clean: $(SUBDIRS) head pkg 128clobber: $(SUBDIRS) head pkg clobber_local 129clobber_local: 130 @cd tools; pwd; $(MAKE) clobber 131 @cd common/mapfiles; pwd; $(MAKE) clobber 132 @cd msg; pwd; $(MAKE) clobber 133 134# If the tarballs are included inside ON_CLOSED_BINS, use those to extract and 135# preserve the permissions (in case a distro ships them). 136 137closedbins: bldtools $(ROOTDIRS) FRC 138 @CLOSED_ROOT="$$ON_CLOSED_BINS/root_$(MACH)$${RELEASE_BUILD+-nd}"; \ 139 if [ -f "$$ON_CLOSED_BINS/on-closed-bins$${RELEASE_BUILD+-nd}.$(MACH).tar.bz2" ]; then \ 140 $(ECHO) "Extracting tarball $$ON_CLOSED_BINS/on-closed-bins$${RELEASE_BUILD+-nd}.$(MACH).tar.bz2"; \ 141 (cd $(CODEMGR_WS); \ 142 $(TAR) xjpf $$ON_CLOSED_BINS/on-closed-bins$${RELEASE_BUILD+-nd}.$(MACH).tar.bz2); \ 143 CLOSED_ROOT="$(CODEMGR_WS)/closed/root_$(MACH)$${RELEASE_BUILD+-nd}"; \ 144 fi; \ 145 if [ ! -d "$$CLOSED_ROOT" ]; then \ 146 $(ECHO) "Error: ON_CLOSED_BINS must point to closed" \ 147 "binaries."; \ 148 $(ECHO) "root_$(MACH)$${RELEASE_BUILD+-nd} is not" \ 149 "present in $$ON_CLOSED_BINS."; \ 150 exit 1; \ 151 fi; \ 152 $(ECHO) "Copying closed binaries from $$CLOSED_ROOT"; \ 153 (cd $$CLOSED_ROOT; \ 154 $(TAR) cfX - $(CODEMGR_WS)/exception_lists/closed-bins .) | \ 155 (cd $(ROOT); $(TAR) xBpf -); \ 156 $(CHMOD) 0400 $(ROOT)/etc/security/tsol/label_encodings; \ 157 ( cd $(ROOT); $(CTFSTRIP) $$(cd $$CLOSED_ROOT; $(FIND) \ 158 ./kernel ./usr/kernel ./platform/*/kernel -type f -a -perm -u+x | \ 159 $(EGREP) -vf $(CODEMGR_WS)/exception_lists/closed-bins) ) 160 161# 162# Declare what parts can be built in parallel 163# DUMMY at the end is used in case macro expansion produces an empty string to 164# prevent everything going in parallel 165# 166.PARALLEL: $(PARALLEL_HEADERS) DUMMY 167.PARALLEL: $(PARALLEL_DIRS) DUMMY 168 169$(SUBDIRS) head pkg: FRC 170 @cd $@; pwd; $(MAKE) $(TARGET) 171 172# librpcsvc has a dependency on headers installed by 173# userheaders, hence the .WAIT before libheaders. 174sgs: rootdirs .WAIT sysheaders userheaders .WAIT \ 175 libheaders cmdheaders 176 177# 178# Top-level setup target to setup the development environment that includes 179# headers, tools and generated mapfiles. For open-only builds (i.e.: source 180# trees w/o usr/closed), this also depends on the closedbins target (above) 181# in order to properly seed the proto area. Note, although the tools are 182# dependent on a number of constant mapfiles, the tools themselves are 183# required to build the generated mapfiles. 184# 185setup: closedbins bldtools sgs mapfiles 186 187# 188# Always build tools as non-DEBUG. 189# When nightly launches a build it first builds non-DEBUG tools and then 190# configures the environment so that these tools are used for building 191# subsequently. If a recursive build from usr/src then builds DEBUG tools, 192# the tools will be rebuilt using themselves resulting in a race condition 193# that can cause the build to fail - see https://www.illumos.org/issues/10462 194# for more details. 195# A manual build in usr/src/tools in a DEBUG bldenv will still do a DEBUG 196# tools build. 197# 198bldtools: 199 @cd tools; pwd; $(MAKE) RELEASE_BUILD= install 200 201# /var/mail/:saved is a special case because of the colon in the name. 202# 203rootdirs: $(ROOTDIRS) 204 $(INS) -d -m 775 $(ROOT)/var/mail/:saved 205 206$(ROOTDIRS): 207 $(INS.dir) 208 209userheaders: FRC 210 @cd head; pwd; $(MAKE) install_h 211 212libheaders: bldtools 213 @cd lib; pwd; $(MAKE) install_h 214 215sysheaders: FRC 216 @cd uts; pwd; $(MAKE) install_h 217 218cmdheaders: FRC 219 @cd cmd/devfsadm; pwd; $(MAKE) install_h 220 @cd cmd/fm; pwd; $(MAKE) install_h 221 @cd cmd/mdb; pwd; $(MAKE) install_h 222 223check: $(CHKHDRSUBDIRS) $(CHKMFSTSUBDIRS) $(CHKMANSUBDIRS) 224 225# 226# Cross-reference customization: skip all of the subdirectories that 227# don't contain actual source code. 228# 229XRPRUNE = pkg prototypes 230XRINCDIRS = uts/common head ucbhead 231 232cscope.out tags: FRC 233 $(XREF) -f -x $@ 234 235FRC: 236 237# used by nightly 238cc-version: 239 @$(CW) --versions $(CW_CC_COMPILERS) 2>&1 240 241# for older nightlies 242cc64-version: 243 244java-version: 245 @if [ -x "$(JAVAC)" ]; then \ 246 $(ECHO) $(JAVAC); \ 247 $(JAVA_ROOT)/bin/java -fullversion 2>&1 | head -1; \ 248 else \ 249 $(ECHO) No Java compiler found; \ 250 exit 1; \ 251 fi 252 253openssl-version: 254 @if [ -x "$(OPENSSL)" ]; then \ 255 $(ECHO) $(OPENSSL); \ 256 $(OPENSSL) version; \ 257 $(OPENSSL) version -f | \ 258 $(SED) -n '/_API/{s/.*_API/ API/;s/ -.*//;p;}'; \ 259 else \ 260 $(ECHO) No OpenSSL utility found; \ 261 fi 262