2
+ − 1
#
+ − 2
# Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ − 3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ − 4
#
+ − 5
# This code is free software; you can redistribute it and/or modify it
+ − 6
# under the terms of the GNU General Public License version 2 only, as
+ − 7
# published by the Free Software Foundation. Sun designates this
+ − 8
# particular file as subject to the "Classpath" exception as provided
+ − 9
# by Sun in the LICENSE file that accompanied this code.
+ − 10
#
+ − 11
# This code is distributed in the hope that it will be useful, but WITHOUT
+ − 12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ − 13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ − 14
# version 2 for more details (a copy is included in the LICENSE file that
+ − 15
# accompanied this code).
+ − 16
#
+ − 17
# You should have received a copy of the GNU General Public License version
+ − 18
# 2 along with this work; if not, write to the Free Software Foundation,
+ − 19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ − 20
#
+ − 21
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ − 22
# CA 95054 USA or visit www.sun.com if you need additional information or
+ − 23
# have any questions.
+ − 24
#
+ − 25
+ − 26
#
+ − 27
# Makefile for JDBC-ODBC Bridge Driver
+ − 28
#
+ − 29
# Note - the native library for the bridge may be linked with the
+ − 30
# shared library for the ODBC driver manager. Or dummy libraries
+ − 31
# may be used to just create libJdbcOdbc.so with a dependency on
+ − 32
# libodbc.so and libodbcinst.so.
+ − 33
#
+ − 34
+ − 35
BUILDDIR = ../..
+ − 36
PACKAGE = sun.jdbc.odbc
+ − 37
LIBRARY = JdbcOdbc
+ − 38
PRODUCT = sun
+ − 39
include $(BUILDDIR)/common/Defs.gmk
+ − 40
+ − 41
#
+ − 42
# Files
+ − 43
#
+ − 44
+ − 45
AUTO_FILES_JAVA_DIRS = sun/jdbc/odbc
+ − 46
+ − 47
FILES_c = \
+ − 48
JdbcOdbc.c
+ − 49
+ − 50
FILES_export = \
+ − 51
sun/jdbc/odbc/JdbcOdbc.java
+ − 52
+ − 53
# Use fake libraries on Solaris and Linux just so the library we create has
+ − 54
# a dependency on these two library names. (which are not part of the jdk)
+ − 55
ifneq ($(PLATFORM), windows)
+ − 56
# In jdk5 and jdk6, and on Solaris 32bit, we would have required that
+ − 57
# these two libraries exist at: $(ALT_ODBCDIR)/ISLIodbc/2.11/lib
+ − 58
# In jdk7, we just fake them out like we did on Linux in jdk5 and jdk6.
+ − 59
#
+ − 60
# If you wanted to use the real odbc libraries, change the value of
+ − 61
# ODBC_LIBRARY_LOCATION, and delete the variable assignments below.
+ − 62
#
+ − 63
# Tell linker to ignore missing externals when building this shared library.
+ − 64
LDFLAGS_DEFS_OPTION = -z nodefs
+ − 65
# Define a place to create the fake libraries and their names.
+ − 66
ODBC_LIBRARY_LOCATION = $(TEMPDIR)
+ − 67
ODBC_FAKE_LIBRARIES = $(ODBC_LIBRARY_LOCATION)/libodbcinst.so $(ODBC_LIBRARY_LOCATION)/libodbc.so
+ − 68
# Make sure they get created early.
+ − 69
INIT += $(ODBC_FAKE_LIBRARIES)
+ − 70
endif
+ − 71
+ − 72
#
+ − 73
# Rules
+ − 74
#
+ − 75
include $(BUILDDIR)/common/Library.gmk
+ − 76
+ − 77
#
+ − 78
# The UNIX define specifies conditional compilation for UNIX
+ − 79
#
+ − 80
ifeq ($(PLATFORM), windows)
+ − 81
LDLIBS += odbc32.lib odbccp32.lib
+ − 82
else
+ − 83
CFLAGS += -DUNIX
+ − 84
LDFLAGS += -L$(ODBC_LIBRARY_LOCATION) -lodbcinst -lodbc
+ − 85
endif
+ − 86
+ − 87
#
+ − 88
# The native code for the bridge uses conditional compilation to
+ − 89
# support Solaris, Win95 and Mac PPC. This is the path to the shared C files
+ − 90
# (which unfortunately are in the same directory as shared Java files).
+ − 91
#
+ − 92
vpath %.c $(CLOSED_SHARE_SRC)/classes/sun/jdbc/odbc
+ − 93
+ − 94
#
+ − 95
# Rules to generate fake libraries
+ − 96
#
+ − 97
+ − 98
ifdef ODBC_FAKE_LIBRARIES
+ − 99
$(TEMPDIR)/dummyodbc.c:
+ − 100
@$(prep-target)
+ − 101
$(ECHO) "void dummyOdbc(void){}" >> $@
+ − 102
$(TEMPDIR)/dummyodbc.o: $(TEMPDIR)/dummyodbc.c
+ − 103
@$(prep-target)
+ − 104
$(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $<
+ − 105
$(ODBC_FAKE_LIBRARIES): $(TEMPDIR)/dummyodbc.o
+ − 106
@$(prep-target)
+ − 107
$(CC) $(SHARED_LIBRARY_FLAG) $(LDFLAGS_COMMON) -o $@ $< $(EXTRA_LIBS)
+ − 108
clean::
+ − 109
$(RM) -f $(ODBC_FAKE_LIBRARIES)
+ − 110
$(RM) -f $(TEMPDIR)/dummyodbc.c
+ − 111
$(RM) -f $(TEMPDIR)/dummyodbc.o
+ − 112
endif
+ − 113
+ − 114
#
+ − 115
# Files that need to be copied
+ − 116
#
+ − 117
SERVICEDIR = $(CLASSBINDIR)/META-INF/services
+ − 118
+ − 119
FILES_copy = \
+ − 120
$(SERVICEDIR)/java.sql.Driver
+ − 121
+ − 122
+ − 123
FILES_mkdirs = \
+ − 124
$(CLASSBINDIR)/META-INF \
+ − 125
$(CLASSBINDIR)/META-INF/services
+ − 126
+ − 127
FILES_copydirs = \
+ − 128
$(CLASSBINDIR) \
+ − 129
$(FILES_mkdirs)
+ − 130
+ − 131
build: copy-files
+ − 132
+ − 133
copy-files: $(FILES_copy)
+ − 134
+ − 135
$(SERVICEDIR)/%: $(CLOSED_SHARE_SRC)/classes/sun/jdbc/odbc/META-INF/services/%
+ − 136
$(install-file)
+ − 137
+ − 138
clean clobber::
+ − 139
$(RM) $(FILES_copy)
+ − 140
+ − 141
.PHONY: copy-files
+ − 142