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