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 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  22 # Use is subject to license terms.
  23 # Copyright (c) 2012, Joyent, Inc.  All rights reserved.
  24 #
  25 
  26 VER =   zlib-1.2.3
  27 
  28 include ../Makefile.defs
  29 
  30 AUTOCONF_OPTS += \
  31         --shared
  32 
  33 #
  34 # zlib's configure isn't a real autoconf, and it breaks horribly if this
  35 # stuff is set.
  36 #
  37 AUTOCONF_CFLAGS =
  38 AUTOCONF_CFLAGS.64 =
  39 AUTOCONF_LDFLAGS =
  40 AUTOCONF_LDFLAGS.64 =
  41 
  42 AUTOCONF_CC =           CC="$(GCC) $(CPPFLAGS)"
  43 AUTOCONF_CC.64 =        CC="$(GCC.64) $(CPPFLAGS)"
  44 
  45 #
  46 # LDFLAGS is used by zlib's build system to build programs, not the library
  47 # itself.  For that, it accepts only a combined linker+flags+libs command
  48 # line via the LDSHARED variable.
  49 #
  50 LDSHARED_FLAGS = \
  51         -shared \
  52         -Wl,-h,libz.so.1 \
  53         -Wl,-zdefs \
  54         -Wl,-ztext \
  55         -Wl,-zcombreloc \
  56         -Wl,-M,../mapfile
  57 
  58 ifneq ($(STRAP),strap)
  59         LDSHARED_FLAGS += $(GENLDFLAGS)
  60 endif
  61 
  62 LDSHARED_FLAGS.32 =     $(LDSHARED_FLAGS) $(SYSLIBDIRS:%=-L$(DESTDIR)/%)
  63 LDSHARED_FLAGS.64 =     $(LDSHARED_FLAGS) $(SYSLIBDIRS:%=-L$(DESTDIR)/%/64)
  64 LDSHARED_LIBS =         -lc
  65 
  66 ifeq ($(STRAP),strap)
  67         LDSHARED_FLAGS.32 += $(SYSLIBDIRS:%=-R$(DESTDIR)/%)
  68         LDSHARED_FLAGS.64 += $(SYSLIBDIRS:%=-R$(DESTDIR)/%/64)
  69 endif
  70 
  71 LDFLAGS +=      -L. -lz -lc
  72 LDFLAGS.64 +=   -L. -lz -lc
  73 
  74 OVERRIDES = \
  75         LDSHARED="$(GCC) $(LDSHARED_FLAGS.32) $(LDSHARED_LIBS)" \
  76         LDFLAGS="$(LDFLAGS)"
  77 
  78 OVERRIDES.64 = \
  79         LDSHARED="$(GCC.64) $(LDSHARED_FLAGS.64) $(LDSHARED_LIBS)" \
  80         LDFLAGS="$(LDFLAGS.64)"
  81 
  82 BUILD32 =       yes
  83 BUILD64 =       yes
  84 
  85 include ../Makefile.targ
  86 
  87 all: all_autoconf
  88 
  89 install: all
  90         BASE=$(BASE) DESTDIR=$(DESTDIR) VERS=$(VER.32) ksh93 ./install-zlib
  91         BASE=$(BASE) DESTDIR=$(DESTDIR) VERS=$(VER.64) MACH64=amd64 \
  92             ksh93 ./install-zlib-64