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 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  23 # Copyright 2020 Joyent, Inc.
  24 #
  25 # Definitions common to tool source.
  26 #
  27 include $(SRC)/Makefile.master
  28 
  29 FILEMODE=       0555
  30 
  31 TOOLS=                  $(SRC)/tools
  32 TOOLS_PROTO=            $(TOOLS)/proto/root_$(MACH)-nd
  33 ROOTOPT=                $(TOOLS_PROTO)/opt
  34 ROOTONBLD=              $(ROOTOPT)/onbld
  35 ROOTONBLDBIN=           $(ROOTONBLD)/bin
  36 ROOTONBLDBINMACH=       $(ROOTONBLD)/bin/$(MACH)
  37 ROOTONBLDETC=           $(ROOTONBLD)/etc
  38 ROOTONBLDLIB=           $(ROOTONBLD)/lib
  39 ROOTONBLDLIBMACH=       $(ROOTONBLD)/lib/$(MACH)
  40 ROOTONBLDLIBMACH64=     $(ROOTONBLD)/lib/$(MACH)/64
  41 ROOTONBLDLIBPERL=       $(ROOTONBLD)/lib/perl
  42 ROOTONBLDLIBPY=         $(ROOTONBLD)/lib/python
  43 ROOTONBLDENV=           $(ROOTONBLD)/env
  44 ROOTONBLDMAN=           $(ROOTONBLD)/man
  45 ROOTONBLDMAN1ONBLD=     $(ROOTONBLD)/man/man1onbld
  46 ROOTONBLDETCABI=        $(ROOTONBLD)/etc/abi
  47 ROOTONBLDETCEXCEPT=     $(ROOTONBLD)/etc/exception_lists
  48 ROOTONBLDSHARE=         $(ROOTONBLD)/share
  49 
  50 CC =                    $(NATIVECC)
  51 CCC =                   $(NATIVECCC)
  52 CFLAGS =                $(NATIVE_CFLAGS)
  53 CPPFLAGS=               -D_TS_ERRNO
  54 ELFSIGN_O=              $(TRUE)
  55 LDLIBS=
  56 LDFLAGS=                $(MAPFILE.NES:%=-M%) $(MAPFILE.NED:%=-M%) \
  57                             $(MAPFILE.PGA:%=-M%)
  58 
  59 # Unset CW_LINKER so we run the default.  We don't set LD here to avoid taking
  60 # the journey through LD_ALTEXEC unnecessarily.
  61 CW_LINKER=
  62 
  63 ROOTONBLDPROG=          $(PROG:%=$(ROOTONBLDBIN)/%)
  64 ROOTONBLDSCRIPTS=       $(SCRIPTS:%=$(ROOTONBLDBIN)/%)
  65 ROOTONBLDMACHPROG=      $(PROG:%=$(ROOTONBLDBINMACH)/%)
  66 ROOTONBLDSHFILES=       $(SHFILES:%=$(ROOTONBLDBIN)/%)
  67 ROOTONBLDMAKEFILES=     $(MAKEFILES:%=$(ROOTONBLDBIN)/%)
  68 ROOTONBLDMACHSHFILES=   $(SHFILES:%=$(ROOTONBLDBINMACH)/%)
  69 ROOTONBLDMACHBINARIES=  $(BINARIES:%=$(ROOTONBLDBINMACH)/%)
  70 ROOTONBLDETCFILES=      $(ETCFILES:%=$(ROOTONBLDETC)/%)
  71 ROOTONBLDENVFILES=      $(ENVFILES:%=$(ROOTONBLDENV)/%)
  72 ROOTONBLDPERLFILES=     $(PERLFILES:%=$(ROOTONBLDBIN)/%)
  73 ROOTONBLDPERLMODULES=   $(PERLMODULES:%=$(ROOTONBLDLIBPERL)/%)
  74 ROOTONBLDPYFILES=       $(PYFILES:%=$(ROOTONBLDBIN)/%)
  75 ROOTONBLDMAN1ONBLDFILES=$(MAN1ONBLDFILES:%=$(ROOTONBLDMAN1ONBLD)/%)
  76 ROOTONBLDABIAUDITFILES= $(ABI_AUDITFILES:%=$(ROOTONBLDETCABI)/%)
  77 ROOTONBLDEXCEPTFILES=   $(EXCEPTFILES:%=$(ROOTONBLDETCEXCEPT)/%)
  78 
  79 # Break a chicken-and-egg dependency cycle for the tools build
  80 SCCSCHECK=@echo would sccscheck
  81 
  82 $(ROOTONBLDETCABI)/%: %
  83         $(INS.file)
  84 
  85 $(ROOTONBLDETCEXCEPT)/%: $(CODEMGR_WS)/exception_lists/%
  86         $(INS.file)
  87 
  88 $(ROOTONBLDBIN)/%: %
  89         $(INS.file)
  90 
  91 $(ROOTONBLDBINMACH)/%: %
  92         $(INS.file)
  93 
  94 $(ROOTONBLDETC)/%: %
  95         $(INS.file)
  96 
  97 $(ROOTONBLDLIBPERL)/%: %
  98         $(INS.file)
  99 
 100 $(ROOTONBLDMAN1ONBLD)/%: %
 101         $(INS.file)
 102 
 103 $(ROOTONBLDENV)/%: %
 104         $(INS.file)