1# 2# Makefile.mac 3# 4# The iODBC driver manager. 5# 6# Copyright (C) 1996-2021 OpenLink Software <iodbc@openlinksw.com> 7# All Rights Reserved. 8# 9# This software is released under the terms of either of the following 10# licenses: 11# 12# - GNU Library General Public License (see LICENSE.LGPL) 13# - The BSD License (see LICENSE.BSD). 14# 15# Note that the only valid version of the LGPL license as far as this 16# project is concerned is the original GNU Library General Public License 17# Version 2, dated June 1991. 18# 19# While not mandated by the BSD license, any patches you make to the 20# iODBC source code may be contributed back into the iODBC project 21# at your discretion. Contributions will benefit the Open Source and 22# Data Access community as a whole. Submissions may be made at: 23# 24# http://www.iodbc.org 25# 26# 27# GNU Library Generic Public License Version 2 28# ============================================ 29# This library is free software; you can redistribute it and/or 30# modify it under the terms of the GNU Library General Public 31# License as published by the Free Software Foundation; only 32# Version 2 of the License dated June 1991. 33# 34# This library is distributed in the hope that it will be useful, 35# but WITHOUT ANY WARRANTY; without even the implied warranty of 36# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 37# Library General Public License for more details. 38# 39# You should have received a copy of the GNU Library General Public 40# License along with this library; if not, write to the Free 41# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 42# 43# 44# The BSD License 45# =============== 46# Redistribution and use in source and binary forms, with or without 47# modification, are permitted provided that the following conditions 48# are met: 49# 50# 1. Redistributions of source code must retain the above copyright 51# notice, this list of conditions and the following disclaimer. 52# 2. Redistributions in binary form must reproduce the above copyright 53# notice, this list of conditions and the following disclaimer in 54# the documentation and/or other materials provided with the 55# distribution. 56# 3. Neither the name of OpenLink Software Inc. nor the names of its 57# contributors may be used to endorse or promote products derived 58# from this software without specific prior written permission. 59# 60# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 61# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 62# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 63# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR 64# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 65# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 66# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 67# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 68# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 69# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 70# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 71# 72 73# 74# iODBC VERSION 75# 76IODBC_VERSION=3.52.15 77 78 79# 80# Determine build model (Deployment/Development) 81# 82ifeq (,$(MODEL)) 83MODEL := Deployment 84endif 85 86 87# 88# Determine which version of macOS we are running 89# 90macos_version := $(shell sw_vers -productVersion) 91macos_major := $(shell sw_vers -productVersion | cut -d . -f 1 ) 92 93 94# 95# Determine major version of the Xcode tool 96# 97xcodebuild_version := $(shell xcodebuild -version | grep -i Xcode | cut -d " " -f 2 | cut -d. -f1) 98 99 100# 101# Common build settings 102# 103PROJBUILD := /usr/bin/xcodebuild -configuration $(MODEL) 104IODBC_32BIT = "i386" 105 106 107# 108# macOS 10.15 (Catalina) does not have 32bit support 109# 110ifeq (10.15, $(findstring 10.15, $(macos_version))) 111IODBC_32BIT := "x86_64" 112endif 113 114 115# 116# macOS 11.x (BigSur)does not have 32bit support 117# 118ifeq (11, $(findstring 11, $(macos_major))) 119IODBC_32BIT := "x86_64" 120endif 121 122 123# 124# Pass settings to xcodebuild 125# 126export IODBC_VERSION IODBC_32BIT 127 128 129# 130# Build the libraries 131# 132all: check_supported include 133 @echo "Building on macOS $(macos_version)" 134 @echo "Projbuild is [$(PROJBUILD)]" 135 cd iODBCinst; $(PROJBUILD) build 136 cd iODBC; $(PROJBUILD) build 137 cd iODBCtest; $(PROJBUILD) build 138 cd iODBCtestw; $(PROJBUILD) build 139 cd iODBCdrvproxy; $(PROJBUILD) build 140 cd iODBCadm; $(PROJBUILD) build 141 cd iODBCadministrator; $(PROJBUILD) build 142 cd iODBCadministrator64; $(PROJBUILD) build 143 cd iODBCdemo/DemoAnsi; $(PROJBUILD) build 144 cd iODBCdemo/DemoUnicode; $(PROJBUILD) build 145 146 147# 148# Make sure the version of Xcode is 8.x or newer 149# 150check_supported: 151 @if test 0$(xcodebuild_version) -lt 8 ; then \ 152 echo "You are using Xcode $(xcodebuild_version) on macOS $(macos_version)"; \ 153 echo ""; \ 154 echo "ERROR: iODBC requires a Xcode version 8.x or newer"; \ 155 echo ""; \ 156 exit 1; \ 157 fi 158 159# 160# Generate iODBC framework style include files 161# 162include: framework-include.sh ../include/sql.h ../include/sqlext.h ../include/sqltypes.h ../include/iodbcext.h ../include/iodbcunix.h ../include/odbcinst.h 163 sh framework-include.sh 164 165 166# 167# Install libraries in /Library/Frameworks 168# 169install: 170 # 171 # Install Frameworks 172 # 173 -rm $(DESTDIR)/Library/Frameworks/iODBC.framework/Versions/Current 174 -rm $(DESTDIR)/Library/Frameworks/iODBCinst.framework/Versions/Current 175 cd iODBCinst; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ 176 cd iODBC; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ 177 # 178 # Install /usr/local/iODBC 179 # 180 sh link-inclibs.sh 181 # 182 # Install iODBC Administrator 183 # 184 cd iODBCadministrator; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ 185 cd iODBCadministrator64; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ 186 # Next ones are a bit special as they need to be installed twice 187 cd iODBCadm; $(PROJBUILD) install DSTROOT=$(DESTDIR)/Library/Frameworks/iODBC.framework/Resources/ 188 cd iODBCadm; $(PROJBUILD) install DSTROOT=$(DESTDIR)/Library/Frameworks/iODBCinst.framework/Resources/ 189 cd iODBCdrvproxy; $(PROJBUILD) install DSTROOT=$(DESTDIR)/Library/Frameworks/iODBC.framework/Resources/ 190 cd iODBCdrvproxy; $(PROJBUILD) install DSTROOT=$(DESTDIR)/Library/Frameworks/iODBCinst.framework/Resources/ 191 # 192 # Install application 193 # 194 cd iODBCdemo/DemoAnsi; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ 195 cd iODBCdemo/DemoUnicode; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ 196 cd iODBCtest; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ 197 cd iODBCtestw; $(PROJBUILD) install DSTROOT=$(DESTDIR)/ 198 199 200# 201# Clean out the targets 202# 203clean: 204 rm -rf include 205 cd iODBC; $(PROJBUILD) clean 206 cd iODBCinst; $(PROJBUILD) clean 207 cd iODBCtest; $(PROJBUILD) clean 208 cd iODBCtestw; $(PROJBUILD) clean 209 cd iODBCdrvproxy; $(PROJBUILD) clean 210 cd iODBCadm; $(PROJBUILD) clean 211 cd iODBCadministrator; $(PROJBUILD) clean 212 cd iODBCadministrator64; $(PROJBUILD) clean 213 cd iODBCdemo/DemoAnsi; $(PROJBUILD) clean 214 cd iODBCdemo/DemoUnicode; $(PROJBUILD) clean 215 216 217realclean: clean 218 rm -rf iODBC/build 219 rm -rf iODBCadm/build 220 rm -rf iODBCadministrator/build 221 rm -rf iODBCadministrator64/build 222 rm -rf iODBCdemo/DemoAnsi/build 223 rm -rf iODBCdemo/DemoUnicode/build 224 rm -rf iODBCdrvproxy/build 225 rm -rf iODBCinst/build 226 rm -rf iODBCtest/build 227 rm -rf iODBCtestw/build 228