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, Version 1.0 only
   6 # (the "License").  You may not use this file except in compliance
   7 # with the License.
   8 #
   9 # You can obtain a copy of the license at COPYING
  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 COPYING.
  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 # Copyright (c) 2014, Joyent, Inc.
  22 #
  23 
  24 BASE =          $(PWD)
  25 DESTDIR =       $(BASE)/../proto
  26 VER.32 =        $(VER)-32$(STRAP)
  27 VER.64 =        $(VER)-64$(STRAP)
  28 OBJ.32 =        $(VER.32)$(SEPARATE_BUILD:yes=.build)
  29 OBJ.64 =        $(VER.64)$(SEPARATE_BUILD:yes=.build)
  30 CTF.32 =        ctfobjects-32$(STRAP)
  31 CTF.64 =        ctfobjects-64$(STRAP)
  32 
  33 ifeq ($(STRAP),strap)
  34 STRAPPROTO =    $(DESTDIR)
  35 else
  36 STRAPPROTO =    $(DESTDIR:proto=proto.strap)
  37 endif
  38 
  39 PATH =          $(STRAPPROTO)/usr/bin:/usr/bin:/usr/sbin:/sbin:/opt/local/bin
  40 
  41 MAKE =          gmake
  42 PARALLEL =      -j128
  43 MAKE_VERBOSE =  V=1
  44 GCC =           $(DESTDIR)/usr/bin/gcc
  45 GXX =           $(DESTDIR)/usr/bin/g++
  46 GCC.64 =        $(GCC) -m64
  47 GXX.64 =        $(GXX) -m64
  48 
  49 GCC.host =      /opt/local/bin/gcc
  50 GXX.host =      /opt/local/bin/g++
  51 GCC.host.64 =   $(GCC.host) -m64
  52 GXX.host.64 =   $(GXX.host) -m64
  53 
  54 LEX =           /opt/local/bin/lex
  55 YACC =          /opt/local/bin/yacc
  56 GPATCH =        /opt/local/bin/gpatch
  57 
  58 SYSINCDIRS =    /usr/include
  59 SYSLIBDIRS =    /usr/lib /lib
  60 
  61 BUILD32 =       yes
  62 BUILD64 =
  63 SEPARATE_BUILD =
  64 
  65 CPPFLAGS =      $(SYSINCDIRS:%=-isystem $(DESTDIR)/%)
  66 
  67 #
  68 # We ship platform-private perl modules (e.g. from ntp) in this directory,
  69 # and using this perl interpeter:
  70 #
  71 PATH_PERL =     /usr/perl5/bin/perl
  72 PERLLIBDIR =    /usr/perl5/5.12/lib
  73 
  74 #
  75 # These are all definitions that relate to Sun Make. There are basically two
  76 # different sets that we care about. The first is the boostrap make. This is
  77 # used to build the strap make. Once we have the strap make, it is used for all
  78 # other makes. Beacuse MAKE is used extensively to mean GNU make in these
  79 # makefiles, we instead use SUN_MAKE and SUM_MAKE_STRAP.
  80 #
  81 SUN_MAKE_STRAP=/opt/local/bin/dmake
  82 SUN_MAKE=$(STRAPPROTO)/usr/bin/dmake
  83 
  84 #
  85 # Because of bugs in ntp, we need to be able to refer to the target specific
  86 # flags as well as the generic flags later on.
  87 #
  88 ifneq ($(STRAP),strap)
  89         GENLDFLAGS = -Wl,-zassert-deflib -Wl,-zfatal-warnings
  90 endif
  91 T32_LDFLAGS =   $(SYSLIBDIRS:%=-L$(DESTDIR)/%)
  92 T64_LDFLAGS =   $(SYSLIBDIRS:%=-L$(DESTDIR)/%/64)
  93 LDFLAGS =       $(T32_LDFLAGS) $(GENLDFLAGS)
  94 LDFLAGS.64 =    $(T64_LDFLAGS) $(GENLDFLAGS)
  95 
  96 AUTOCONF_CC =           CC="$(GCC)"
  97 AUTOCONF_CXX =          CXX="$(GXX)"
  98 AUTOCONF_CC.64 =        CC="$(GCC.64)"
  99 AUTOCONF_CXX.64 =       CXX="$(GXX.64)"
 100 AUTOCONF_CPPFLAGS =     CPPFLAGS="$(CPPFLAGS)"
 101 AUTOCONF_CFLAGS =       CFLAGS="$(CFLAGS)"
 102 AUTOCONF_CFLAGS.64 =    CFLAGS="$(CFLAGS.64)"
 103 AUTOCONF_LDFLAGS =      LDFLAGS="$(LDFLAGS)"
 104 AUTOCONF_LDFLAGS.64 =   LDFLAGS="$(LDFLAGS.64)"
 105 AUTOCONF_LIBS =         LIBS="$(LIBS)"
 106 AUTOCONF_LIBS.64 =      LIBS="$(LIBS.64)"
 107 
 108 AUTOCONF_OUT =          config.status
 109 AUTOCONF_OUT.32 =       $(OBJ.32)/$(AUTOCONF_OUT)
 110 AUTOCONF_OUT.64 =       $(OBJ.64)/$(AUTOCONF_OUT)
 111 
 112 AUTOCONF_PREFIX =       /usr
 113 
 114 AUTOCONF_ENV = \
 115         PKG_CONFIG_LIBDIR="" \
 116         $(AUTOCONF_CC) \
 117         $(AUTOCONF_CXX) \
 118         $(AUTOCONF_CPPFLAGS) \
 119         $(AUTOCONF_CFLAGS) \
 120         $(AUTOCONF_LDFLAGS) \
 121         $(AUTOCONF_LIBS)
 122 
 123 AUTOCONF_ENV.64 = \
 124         PKG_CONFIG_LIBDIR="" \
 125         $(AUTOCONF_CC.64) \
 126         $(AUTOCONF_CXX.64) \
 127         $(AUTOCONF_CPPFLAGS) \
 128         $(AUTOCONF_CFLAGS.64) \
 129         $(AUTOCONF_LDFLAGS.64) \
 130         $(AUTOCONF_LIBS.64)
 131 
 132 AUTOCONF_OPTS = \
 133         --prefix=$(AUTOCONF_PREFIX)
 134 
 135 AUTOCONF_OPTS.32 = \
 136         $(AUTOCONF_OPTS)
 137 
 138 AUTOCONF_OPTS.64 = \
 139         $(AUTOCONF_OPTS)
 140 
 141 ALL_TGT =
 142 OVERRIDES =     $(MAKE_VERBOSE)
 143 
 144 TARBALL =               $(VER).tar.gz
 145 TARBALL_COMPRESS =      -z
 146 
 147 UNPACK_SENTINEL =       configure
 148 FROB_SENTINEL.32 =      chmod 755 $(VER.32)/$(UNPACK_SENTINEL)
 149 FROB_SENTINEL.64 =      chmod 755 $(VER.64)/$(UNPACK_SENTINEL)
 150 
 151 PATCHSTRIP =    1
 152 
 153 APPLY_PATCHES.32 = \
 154         for p in $(PATCHES); do \
 155             echo "Applying $$p"; \
 156             $(GPATCH) -d .unpack32/$(VER) -p$(PATCHSTRIP) < "$$p" || exit 1; \
 157             done
 158 
 159 APPLY_PATCHES.64 = \
 160         for p in $(PATCHES); do \
 161             echo "Applying $$p"; \
 162             $(GPATCH) -d .unpack64/$(VER) -p$(PATCHSTRIP) < "$$p" || exit 1; \
 163             done
 164 
 165 MAKE_CTF =              $(BASE)/../tools/make-ctf
 166 MAKE_CTF.32 =           $(MAKE_CTF) $(OBJ.32) $(CTF.32) $(VER)
 167 MAKE_CTF.64 =           $(MAKE_CTF) $(OBJ.64) $(CTF.64) $(VER)
 168 
 169 .DEFAULT_GOAL =         all