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 (c) 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         codereview \
  54         codesign \
  55         cscope-fast \
  56         env \
  57         findunref \
  58         lintdump \
  59         make \
  60         makesoftcore \
  61         ndrgen \
  62         onbld \
  63         protocmp \
  64         protolist \
  65         scripts
  66 
  67 #
  68 #  special versions of commands for use only in build
  69 #
  70 UNSHIPPED_SUBDIRS = \
  71         localedef \
  72         mandoc \
  73         tic \
  74         vtfontcvt \
  75         zic
  76 
  77 sparc_SUBDIRS= \
  78         chk4ubin \
  79         stabs \
  80         tokenize
  81 
  82 i386_SUBDIRS=           \
  83         aw              \
  84         cpcgen          \
  85         elfextract      \
  86         mbh_patch       \
  87         btxld
  88 
  89 SUBDIRS= \
  90         $($(MACH)_SUBDIRS) \
  91         $(COMMON_SUBDIRS) \
  92         $(UNSHIPPED_SUBDIRS)
  93 
  94 include Makefile.tools
  95 
  96 ROOTDIRS= \
  97         $(ROOTOPT) \
  98         $(ROOTONBLD) \
  99         $(ROOTONBLD)/bin \
 100         $(ROOTONBLD)/bin/$(MACH) \
 101         $(ROOTONBLD)/lib \
 102         $(ROOTONBLD)/lib/$(MACH) \
 103         $(ROOTONBLD)/lib/$(MACH)/64 \
 104         $(ROOTONBLD)/lib/perl \
 105         $(ROOTONBLD)/env \
 106         $(ROOTONBLD)/etc \
 107         $(ROOTONBLD)/etc/exception_lists \
 108         $(ROOTONBLD)/share \
 109         $(ROOTONBLD)/man \
 110         $(ROOTONBLD)/man/man1onbld
 111 
 112 $(BUILDPY2TOOLS)ROOTDIRS += \
 113         $(ROOTONBLD)/lib/python$(PYTHON_VERSION) \
 114         $(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld \
 115         $(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Checks \
 116         $(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Scm
 117 
 118 $(BUILDPY3TOOLS)ROOTDIRS += \
 119         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION) \
 120         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld \
 121         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/__pycache__ \
 122         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks \
 123         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks/__pycache__ \
 124         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm \
 125         $(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm/__pycache__
 126 
 127 all :=          TARGET= install
 128 install :=      TARGET= install
 129 clean :=        TARGET= clean
 130 clobber :=      TARGET= clobber
 131 _msg :=         TARGET= _msg
 132 
 133 .KEEP_STATE:
 134 
 135 #
 136 # Only create directories in the tools proto area when doing an actual
 137 # build, not a clean or clobber.
 138 #
 139 DOROOTDIRS= $(ROOTDIRS)
 140 clobber:= DOROOTDIRS=
 141 clean:= DOROOTDIRS=
 142 
 143 $(BUILDPY2TOOLS)DOROOTONBLDLIBPY= $(ROOTONBLDLIBPY)
 144 clobber:= DOROOTONBLDLIBPY=
 145 clean:= DOROOTONBLDLIBPY=
 146 
 147 all install: $(SUBDIRS)
 148 
 149 clean: $(SUBDIRS)
 150 
 151 clobber: $(SUBDIRS)
 152         $(RM) -rf $(TOOLS_PROTO)
 153 
 154 bootstrap: $(BOOT_SUBDIRS)
 155 
 156 _msg: $(MSGSUBDIRS)
 157 
 158 .PARALLEL: $(SUBDIRS) $(CLOSED_SUBDIRS)
 159 
 160 $(SUBDIRS) $(CLOSED_SUBDIRS): $(BOOT_SUBDIRS)
 161 
 162 $(BOOT_SUBDIRS) $(SUBDIRS): $$(DOROOTDIRS) $$(DOROOTONBLDLIBPY) FRC
 163         @cd $@; pwd; $(MAKE) $(TARGET)
 164 
 165 # Assume we don't have the install.bin available yet
 166 $(ROOTDIRS):
 167         $(MKDIR) -p -m $(DIRMODE) $@
 168 
 169 $(ROOTONBLDLIBPY): $(ROOTDIRS)
 170         $(RM) -r $@; $(SYMLINK) python$(PYTHON_VERSION) $@
 171 
 172 FRC: