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) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  24 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
  25 # Copyright 2016 Toomas Soome <tsoome@me.com>
  26 # Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
  27 # Copyright 2019 Joyent, Inc.
  28 # Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
  29 #
  30 
  31 include ../Makefile.master
  32 
  33 # Bootstrap problem: some utilities are pre-requisites for building everything
  34 # else:
  35 #    - smatch - as it is a shadow compiler
  36 #    - cw - as it is used to drive builds
  37 #    - install.bin - being the 'install' target dependency
  38 #    - ctf - being used to generate CTF data
  39 #
  40 # Anything built before 'install.bin' is present must override binary
  41 # installation rules in their makefiles. This includes the Makefile for
  42 # 'install.bin' itself.
  43 BOOT_SUBDIRS= \
  44         smatch \
  45         .WAIT \
  46         cw \
  47         .WAIT \
  48         install.bin \
  49         .WAIT \
  50         ctf
  51 
  52 COMMON_SUBDIRS= \
  53         codesign \
  54         cscope-fast \
  55         env \
  56         findunref \
  57         lintdump \
  58         make \
  59         makesoftcore \
  60         ndrgen \
  61         onbld \
  62         protocmp \
  63         protolist \
  64         scripts
  65 
  66 #
  67 #  special versions of commands for use only in build
  68 #
  69 UNSHIPPED_SUBDIRS = \
  70         localedef \
  71         mandoc \
  72         tic \
  73         vtfontcvt \
  74         zic
  75 
  76 sparc_SUBDIRS= \
  77         chk4ubin \
  78         stabs \
  79         tokenize
  80 
  81 i386_SUBDIRS=           \
  82         aw              \
  83         cpcgen          \
  84         elfextract      \
  85         mbh_patch       \
  86         btxld
  87 
  88 SUBDIRS= \
  89         $($(MACH)_SUBDIRS) \
  90         $(COMMON_SUBDIRS) \
  91         $(UNSHIPPED_SUBDIRS)
  92 
  93 include Makefile.tools
  94 
  95 ROOTDIRS= \
  96         $(ROOTOPT) \
  97         $(ROOTONBLD) \
  98         $(ROOTONBLD)/bin \
  99         $(ROOTONBLD)/bin/$(MACH) \
 100         $(ROOTONBLD)/lib \
 101         $(ROOTONBLD)/lib/$(MACH) \
 102         $(ROOTONBLD)/lib/$(MACH)/64 \
 103         $(ROOTONBLD)/lib/perl \
 104         $(ROOTONBLD)/env \
 105         $(ROOTONBLD)/etc \
 106         $(ROOTONBLD)/etc/exception_lists \
 107         $(ROOTONBLD)/share \
 108         $(ROOTONBLD)/man \
 109         $(ROOTONBLD)/man/man1onbld
 110 
 111 $(BUILDPY2TOOLS)ROOTDIRS += \
 112         $(ROOTONBLD)/lib/python$(PYTHON_VERSION) \
 113         $(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld \
 114         $(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Checks \
 115         $(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Scm
 116 
 117 $(BUILDPY3TOOLS)ROOTDIRS += \
 118         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION) \
 119         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld \
 120         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/__pycache__ \
 121         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks \
 122         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks/__pycache__ \
 123         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm \
 124         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm/__pycache__
 125 
 126 all :=          TARGET= install
 127 install :=      TARGET= install
 128 clean :=        TARGET= clean
 129 clobber :=      TARGET= clobber
 130 _msg :=         TARGET= _msg
 131 
 132 .KEEP_STATE:
 133 
 134 #
 135 # Only create directories in the tools proto area when doing an actual
 136 # build, not a clean or clobber.
 137 #
 138 DOROOTDIRS= $(ROOTDIRS)
 139 clobber:= DOROOTDIRS=
 140 clean:= DOROOTDIRS=
 141 
 142 $(BUILDPY2TOOLS)DOROOTONBLDLIBPY= $(ROOTONBLDLIBPY)
 143 clobber:= DOROOTONBLDLIBPY=
 144 clean:= DOROOTONBLDLIBPY=
 145 
 146 all install: $(SUBDIRS)
 147 
 148 clean: $(SUBDIRS)
 149 
 150 clobber: $(SUBDIRS)
 151         $(RM) -rf $(TOOLS_PROTO)
 152 
 153 bootstrap: $(BOOT_SUBDIRS)
 154 
 155 _msg: $(MSGSUBDIRS)
 156 
 157 .PARALLEL: $(SUBDIRS) $(CLOSED_SUBDIRS)
 158 
 159 $(SUBDIRS) $(CLOSED_SUBDIRS): $(BOOT_SUBDIRS)
 160 
 161 $(BOOT_SUBDIRS) $(SUBDIRS): $$(DOROOTDIRS) $$(DOROOTONBLDLIBPY) FRC
 162         @cd $@; pwd; $(MAKE) $(TARGET)
 163 
 164 # Assume we don't have the install.bin available yet
 165 $(ROOTDIRS):
 166         $(MKDIR) -p -m $(DIRMODE) $@
 167 
 168 $(ROOTONBLDLIBPY): $(ROOTDIRS)
 169         $(RM) -r $@; $(SYMLINK) python$(PYTHON_VERSION) $@
 170 
 171 FRC: