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 (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  22 # Copyright (c) 2012-2013, Joyent, Inc.  All rights reserved.
  23 #
  24 
  25 VER = openssl-1.0.1d
  26 LIBVER =        1.0.0
  27 
  28 include ../Makefile.defs
  29 
  30 SHELL =         /bin/bash
  31 BUILD64 =       yes
  32 UNPACK_SENTINEL =       Configure
  33 AUTOCONF_OUT =  crypto/opensslconf.h
  34 
  35 MT_CPPFLAGS =   -D_REENTRANT
  36 SHARED_CFLAGS = -fPIC -DPIC
  37 SHARED_LDFLAGS =        -fPIC -shared
  38 
  39 PKCS11_SRCS = \
  40         hw_pk11_err.c \
  41         hw_pk11_err.h \
  42         hw_pk11_pub.c \
  43         hw_pk11_uri.c \
  44         hw_pk11_uri.h \
  45         hw_pk11.c \
  46         hw_pk11.h
  47 
  48 PKCS11_DST.32 = $(VER.32)/crypto/engine
  49 PKCS11_DST.64 = $(VER.64)/crypto/engine
  50 
  51 PKCS11.32 =     $(PKCS11_SRCS:%=$(PKCS11_DST.32)/%)
  52 PKCS11.64 =     $(PKCS11_SRCS:%=$(PKCS11_DST.64)/%)
  53 
  54 CHECK_LIBS = \
  55         $(VER.32)/libsunw_crypto.so.$(LIBVER) \
  56         $(VER.32)/libsunw_ssl.so.$(LIBVER) \
  57         $(VER.64)/libsunw_crypto.so.$(LIBVER) \
  58         $(VER.64)/libsunw_ssl.so.$(LIBVER)
  59 
  60 #
  61 # There are races between the building of assembly language sources and
  62 # the assembly of those files.  Disable parallel build.
  63 #
  64 PARALLEL =
  65 
  66 CPPFLAGS += \
  67         -DSOLARIS_OPENSSL \
  68         -DNO_WINDOWS_BRAINDEATH \
  69         -include openssl/sunw_prefix.h
  70 
  71 CFLAGS += \
  72         -O3 \
  73         -march=pentium \
  74         -Wall \
  75         -Werror \
  76         -DPK11_LIB_LOCATION=\\"/usr/lib/libpkcs11.so.1\\"
  77 
  78 CFLAGS.64 += \
  79         -O3 \
  80         -Wall \
  81         -Werror \
  82         -DPK11_LIB_LOCATION=\\"/usr/lib/64/libpkcs11.so.1\\"
  83 
  84 LIBS += -lsocket -lnsl
  85 
  86 PATCHES =       Patches/*
  87 
  88 AUTOCONF_ENV =
  89 AUTOCONF_OPTS += \
  90         --openssldir=/etc/openssl \
  91         --install_prefix=$(DESTDIR) \
  92         no-ec \
  93         no-ecdh \
  94         no-ecdsa \
  95         no-rc3 \
  96         no-rc5 \
  97         no-mdc2 \
  98         no-idea \
  99         no-hw_4758_cca \
 100         no-hw_aep \
 101         no-hw_atalla \
 102         no-hw_chil \
 103         no-hw_gmp \
 104         no-hw_ncipher \
 105         no-hw_nuron \
 106         no-hw_padlock \
 107         no-hw_sureware \
 108         no-hw_ubsec \
 109         no-hw_cswift \
 110         enable-md2 \
 111         threads \
 112         shared
 113 
 114 AUTOCONF_OPTS.32 += \
 115         smartos-x86-gcc
 116 
 117 AUTOCONF_OPTS.64 += \
 118         smartos64-x86_64-gcc
 119 
 120 $(PKCS11_DST.32)/%: engine_pkcs11/%
 121         cp $< $@
 122 
 123 $(PKCS11_DST.64)/%: engine_pkcs11/%
 124         cp $< $@
 125 
 126 $(VER.32)/%: %
 127         cp $< $@
 128 
 129 $(VER.64)/%: %
 130         cp $< $@
 131 
 132 $(VER.32)/configure: $(VER.32)/Configure Makefile $(PKCS11.32) \
 133     $(VER.32)/sunw_prefix.h
 134         sed -e 's#@@CC@@#$(GCC)#g' \
 135             -e 's#@@CPPFLAGS@@#$(CPPFLAGS)#g' \
 136             -e 's#@@CFLAGS@@#$(CFLAGS)#g' \
 137             -e 's#@@MT_CPPFLAGS@@#$(MT_CPPFLAGS)#g' \
 138             -e 's#@@LDFLAGS@@#$(LDFLAGS)#g' \
 139             -e 's#@@LIBS@@#$(LIBS)#g' \
 140             -e 's#@@SHARED_CFLAGS@@#$(SHARED_CFLAGS)#g' \
 141             -e 's#@@SHARED_LDFLAGS@@#$(SHARED_LDFLAGS)#g' < $< > $@
 142         chmod +x $@
 143 
 144 $(VER.64)/configure: $(VER.64)/Configure Makefile $(PKCS11.64) \
 145     $(VER.64)/sunw_prefix.h
 146         sed -e 's#@@CC@@#$(GCC.64)#g' \
 147             -e 's#@@CPPFLAGS@@#$(CPPFLAGS)#g' \
 148             -e 's#@@CFLAGS@@#$(CFLAGS.64)#g' \
 149             -e 's#@@MT_CPPFLAGS@@#$(MT_CPPFLAGS)#g' \
 150             -e 's#@@LDFLAGS@@#$(LDFLAGS.64)#g' \
 151             -e 's#@@LIBS@@#$(LIBS)#g' \
 152             -e 's#@@SHARED_CFLAGS@@#$(SHARED_CFLAGS)#g' \
 153             -e 's#@@SHARED_LDFLAGS@@#$(SHARED_LDFLAGS)#g' < $< > $@
 154         chmod +x $@
 155 
 156 all: all_autoconf
 157 
 158 check: $(CHECK_LIBS:%=%.check)
 159 
 160 %.check: %
 161         syms="$$(/usr/bin/nm -ph $< | \
 162             awk '$$2 == T && $$3 != _init && $$3 != _fini { print $$3 }' | \
 163             grep -v ^sunw_)"; \
 164         if [[ -n "$$syms" ]]; then \
 165                 echo "Unprefixed symbols found in $<: $$syms"; \
 166                 exit 1; \
 167         else \
 168                 touch $@; \
 169         fi
 170 
 171 $(CHECK_LIBS): all
 172 
 173 install_32: all check
 174         DESTDIR=$(DESTDIR) VERDIR=$(VER.32) LIBVER=$(LIBVER) \
 175             ksh93 ./install-sfw
 176 
 177 install_64: all check
 178         DESTDIR=$(DESTDIR) VERDIR=$(VER.64) LIBVER=$(LIBVER) \
 179             ksh93 ./install-sfw-64
 180 
 181 install: install_32 install_64
 182 
 183 include ../Makefile.targ