usr/src/lib/unixodbc/Makefile.sfw
author Jon Tibble <meths@btinternet.com>
Mon, 04 May 2015 14:04:39 +0100
branchoi_151a
changeset 254 9c2a4ac793f0
parent 7 f96733ecc878
child 56 5c4fb282c1e7
permissions -rw-r--r--
Bash patch catchup including shellshock

#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)Makefile.sfw	1.2	10/01/22 SMI"
#

VER=unixODBC-2.2.14
VER64=$(VER)-64

include ../Makefile.lib
include ../Makefile.lib.64

SH = /bin/bash
PREFIX=$(ROOT)/usr
SUFFIX_64_sparc = sparcv9
SUFFIX_64_i386 = amd64
SUFFIX_64 = $(SUFFIX_64_$(MACH))
COMPAT_VERSION=5
PICFLAG = -KPIC -DPIC
ARCH_FLAGS_32_sparc = -m32 -xarch=sparcvis
ARCH_FLAGS_64_sparc = -m64 -xarch=sparcvis
ARCH_FLAGS_32_i386 = -m32 -xarch=386
ARCH_FLAGS_64_i386 = -m64 -xarch=generic
CFLAGS_sparc = -xcode=pic32 -xmemalign=8i -xvis=yes -xregs=no%appl -xO4 $(PICFLAG)
CFLAGS_i386 = -xregs=no%frameptr $(PICFLAG) -xO3
CXXFLAGS_sparc = -xcode=pic32 -xmemalign=8i -xvis=yes -xregs=no%appl -xO4 $(PICFLAG)
CXXFLAGS_i386 = -xregs=no%frameptr $(PICFLAG) -xO3
CFLAGS_GENERIC += -xc99=%all -mt -D_REENTRANT -DNDEBUG
CFLAGS_GENERIC += -D__EXTENSIONS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CFLAGS_GENERIC += -D_XPG6 -D_XOPEN_SOURCE=600 -D_POSIX_PTHREAD_SEMANTICS
CFLAGS_GENERIC += $(CFLAGS_$(MACH)) -s
CCFLAGS_GENERIC = -features=anachronisms,except,rtti,export,extensions,nestedaccess,tmplife,tmplrefstatic \
		  -instances=global -template=geninlinefuncs -verbose=template \
		  $(CXXFLAGS_$(MACH)) \
		  -xlang=c99 -xbuiltin=%none -xinline=%auto -xlibmil \
		  -xustr=ascii_utf16_ushort -xlibmopt \
		  -z combreloc -z redlocsym -z ignore -z rescan -z absexec \
		  -xldscope=symbolic -xalias_level=compatible $(PICFLAG) \
		  -xF=%none -xthreadvar=%all -mt -D_REENTRANT -DNDEBUG \
		  -D__EXTENSIONS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
		  -D_XPG5 -D_XOPEN_SOURCE=500 -D_POSIX_PTHREAD_SEMANTICS -s

CPPFLAGS = -I$(PREFIX)/include
LDFLAGS = -lc -lm -lpthread -lposix4 -lrt
LDFLAGS += -z combreloc -z redlocsym -z ignore -z rescan -z absexec
LDFLAGS += -z ignore -s $(PICFLAG)
LDFLAGS_32 = -L$(PREFIX)/lib
LDFLAGS_64 = -L$(PREFIX)/lib/$(SUFFIX_64)
LD_OPTIONS = -z ignore
PKG_CONFIG_PATH_32 = $(PREFIX)/lib/pkgconfig:/usr/lib/pkgconfig
PKG_CONFIG_PATH_64 = $(PREFIX)/lib/$(SUFFIX_64)/pkgconfig:/usr/lib/$(SUFFIX_64)/pkgconfig
CONFIGURE_COMMON_OPTIONS = --enable-shared \
			   --disable-static \
			   --disable-libtool-lock \
			   --disable-gui \
			   --enable-threads \
			   --disable-gnuthreads \
			   --disable-readline \
			   --enable-inicaching \
			   --enable-drivers \
			   --enable-fdb \
			   --enable-odbctrace \
			   --enable-iconv \
			   --enable-stats \
			   --enable-rtldgroup \
			   --disable-ltdllib \
			   --without-pth \
			   --without-pth-test \
			   --with-libiconv-prefix=$(CFGPREFIX) \
			   --disable-ltdl-install \
			   --with-pic

all: all32 all64

$(VER)/config.status: $(VER)/configure
	(cd $(VER) ; env INSTALL="$(GINSTALL) -c" \
	  CC="$(CC)" CXX="$(CCC)" \
	  CFLAGS="$(CPPFLAGS) $(CFLAGS_GENERIC) $(ARCH_FLAGS_32_$(MACH))" \
	  CXXFLAGS="$(CPPFLAGS) $(CCFLAGS_GENERIC) $(ARCH_FLAGS_32_$(MACH))" \
	  LDFLAGS="$(LDFLAGS_32) $(LDFLAGS)" \
	  LD_OPTIONS="$(LD_OPTIONS)" \
	  CXXLINK="$(CCC) $(CCFLAGS_GENERIC) $(ARCH_FLAGS_32_$(MACH)) $(LDFLAGS_32) $(LDFLAGS)" \
	  PKG_CONFIG_PATH="$(PKG_CONFIG_PATH_32)" \
	  MAKE="$(GMAKE)" \
	  ./configure \
	  --prefix="$(CFGPREFIX)" \
	  --includedir="$(CFGPREFIX)/include/odbc" \
	  --localstatedir=/var \
	  --sysconfdir=/etc/odbc \
	  --x-includes="/usr/X11/include" \
	  --x-libraries="/usr/X11/lib" \
	  $(CONFIGURE_COMMON_OPTIONS) ; \
	  cd .. )

$(VER64)/config.status: $(VER64)/configure
	(cd $(VER64); env INSTALL="$(GINSTALL) -c" \
	  CC="$(CC64)" CXX="$(CCC64)" \
	  CFLAGS="$(CPPFLAGS) $(CFLAGS_GENERIC) $(ARCH_FLAGS_64_$(MACH))" \
	  CXXFLAGS="$(CPPFLAGS) $(CCFLAGS_GENERIC) $(ARCH_FLAGS_64_$(MACH))" \
	  LDFLAGS="$(LDFLAGS_64) $(LDFLAGS)" \
	  LD_OPTIONS="$(LD_OPTIONS)" \
	  CXXLINK="$(CCC64) $(CCFLAGS_GENERIC) $(ARCH_FLAGS_64_$(MACH)) $(LDFLAGS_64) $(LDFLAGS)" \
	  PKG_CONFIG_PATH="$(PKG_CONFIG_PATH_64)" \
	  MAKE="$(GMAKE)" \
	  ./configure \
	  --prefix="$(CFGPREFIX)" \
	  --bindir="$(CFGPREFIX)/bin/$(SUFFIX_64)" \
	  --includedir="$(CFGPREFIX)/include/odbc" \
	  --libdir="$(CFGPREFIX)/lib/$(SUFFIX_64)" \
	  --libexecdir="$(CFGPREFIX)/libexec/$(SUFFIX_64)" \
	  --sbindir="$(CFGPREFIX)/sbin/$(SUFFIX_64)" \
	  --localstatedir=/var \
	  --sysconfdir=/etc/odbc \
	  --x-includes="/usr/X11/include" \
	  --x-libraries="/usr/X11/lib/$(SUFFIX_64)" \
	  $(CONFIGURE_COMMON_OPTIONS) ; \
	  cd .. )

all32: $(VER)/config.status
	( cd $(VER) ; \
	    mkdir -p root ; \
	    env LD_LIBRARY_PATH="$(ROOT)/usr/lib" \
	    LD_OPTIONS="$(LD_OPTIONS)" \
	    MAKE="$(GMAKE)" \
	    INSTALL="$(GINSTALL) -c" \
	    $(GMAKE) -e ; \
	  $(GMAKE) -e DESTDIR="$(SRC)/lib/unixodbc/$(VER)/root" install ; )

all64: $(VER64)/config.status
	( cd $(VER64) ; \
	    mkdir -p root ; \
	    env LD_LIBRARY_PATH="$(ROOT)/usr/lib/$(SUFFIX_64)" \
	    LD_OPTIONS="$(LD_OPTIONS)" \
	    MAKE="$(GMAKE)" \
	    INSTALL="$(GINSTALL) -c" \
	  $(GMAKE) -e ; \
	  $(GMAKE) -e DESTDIR="$(SRC)/lib/unixodbc/$(VER64)/root" install ; )

$(VER)/configure $(VER64)/configure: $(VER).tar.gz
	$(MKDIR) -p tmp
	gzip -dc $^ | (cd tmp; $(TAR) xopf -)
	$(MV) tmp/$(VER) $(@D)
	( cd $(@D) ; \
	    gpatch -p0 <../configure.0.diff ; \
	    gpatch -p0 <../cursorlibrary.h.1.diff ; \
	    gpatch -p0 <../Makefile.in.2.diff ; \
	    chmod 0755 configure ; \
	    cd .. )
	/usr/bin/rmdir tmp

install: all
	$(SHELL) ./install-sfw
	MACH64=$(MACH64) $(SHELL) ./install-sfw-64

	# fix the proto area
	$(SRC)/tools/protofix --pkg SUNWunixodbc --perm

clean:
	-rm -rf $(VER) $(VER64)

install_h: 

include ../Makefile.targ