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