1#
2#  Makefile.mac
3#
4#  The iODBC driver manager.
5#
6#  Copyright (C) 1996-2006 by 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#
75#  Determine build model (Deployment/Development)
76#
77ifeq (,$(MODEL))
78MODEL	:= Deployment
79endif
80
81
82#
83#  Determine which version of Mac OS X we are running
84#
85macosx_version	:= $(shell sw_vers -productVersion)
86
87#
88#  Mac OS X 10.2
89#
90ifeq (10.2, $(findstring 10.2, $(macosx_version)))
91    PROJBUILD := /usr/bin/pbxbuild -buildstyle $(MODEL)
92endif
93
94#
95#  Mac OS X 10.3
96#
97ifeq (10.3, $(findstring 10.3, $(macosx_version)))
98    PROJBUILD := /usr/bin/xcodebuild -buildstyle $(MODEL)
99endif
100
101#
102#  Mac OS X 10.4
103#
104ifeq (10.4, $(findstring 10.4, $(macosx_version)))
105    PROJBUILD := /usr/bin/xcodebuild -configuration $(MODEL)
106endif
107
108
109#
110#  Build the libraries
111#
112all: include
113	@echo "Building on Mac OS X $(macosx_version)"
114	@echo "Projbuild is [$(PROJBUILD)]"
115	cd iODBCinst;	$(PROJBUILD) build
116	cd iODBC;	$(PROJBUILD) build
117	cd iODBCtest;	$(PROJBUILD) build
118	cd iODBCtestw;	$(PROJBUILD) build
119
120
121#
122#  Generate iODBC framework style include files
123#
124include: framework-include.sh ../include/sql.h ../include/sqlext.h ../include/sqltypes.h ../include/iodbcext.h ../include/iodbcunix.h ../include/odbcinst.h
125	sh framework-include.sh
126	touch include
127
128
129#
130#  Install libraries in /Library/Frameworks
131#
132install:
133	-sudo rm /Library/Frameworks/iODBC.framework/Versions/Current
134	-sudo rm /Library/Frameworks/iODBCinst.framework/Versions/Current
135	cd iODBCinst;	sudo $(PROJBUILD) install DSTROOT=/
136	cd iODBC;	sudo $(PROJBUILD) install DSTROOT=/
137	cd iODBCtest;	sudo $(PROJBUILD) install DSTROOT=/
138	cd iODBCtestw;	sudo $(PROJBUILD) install DSTROOT=/
139	sudo sh link-inclibs.sh
140
141
142#
143#  Clean out the targets
144#
145clean:
146	rm -rf include
147	cd iODBC;	$(PROJBUILD) clean
148	cd iODBCinst;	$(PROJBUILD) clean
149	cd iODBCtest;	$(PROJBUILD) clean
150	cd iODBCtestw;	$(PROJBUILD) clean
151
152realclean: clean
153	rm -rf iODBC/build iODBCinst/build iODBCtest/build iODBCtestw/build
154