| 1 | #
|
|---|
| 2 | # Copyright (c) 1996, 2007, Oracle and/or its affiliates. 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. Oracle designates this
|
|---|
| 8 | # particular file as subject to the "Classpath" exception as provided
|
|---|
| 9 | # by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|---|
| 22 | # or visit www.oracle.com if you need additional information or have any
|
|---|
| 23 | # 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 ($(filter-out windows os2, $(PLATFORM)),)
|
|---|
| 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 | ifeq ($(PLATFORM),windows)
|
|---|
| 73 | # Files built here do not compile with warning level 3 if warnings are fatal
|
|---|
| 74 | COMPILER_WARNINGS_FATAL=false
|
|---|
| 75 | endif
|
|---|
| 76 |
|
|---|
| 77 | #
|
|---|
| 78 | # Rules
|
|---|
| 79 | #
|
|---|
| 80 | include $(BUILDDIR)/common/Library.gmk
|
|---|
| 81 |
|
|---|
| 82 | #
|
|---|
| 83 | # The UNIX define specifies conditional compilation for UNIX
|
|---|
| 84 | #
|
|---|
| 85 | ifeq ($(filter-out windows os2, $(PLATFORM)),)
|
|---|
| 86 | LDLIBS += odbc32.lib odbccp32.lib
|
|---|
| 87 | else
|
|---|
| 88 | CFLAGS += -DUNIX
|
|---|
| 89 | LDFLAGS += -L$(ODBC_LIBRARY_LOCATION) -lodbcinst -lodbc
|
|---|
| 90 | endif
|
|---|
| 91 |
|
|---|
| 92 | #
|
|---|
| 93 | # The native code for the bridge uses conditional compilation to
|
|---|
| 94 | # support Solaris, Win95 and Mac PPC. This is the path to the shared C files
|
|---|
| 95 | # (which unfortunately are in the same directory as shared Java files).
|
|---|
| 96 | #
|
|---|
| 97 | vpath %.c $(CLOSED_SHARE_SRC)/classes/sun/jdbc/odbc
|
|---|
| 98 |
|
|---|
| 99 | #
|
|---|
| 100 | # Rules to generate fake libraries
|
|---|
| 101 | #
|
|---|
| 102 |
|
|---|
| 103 | ifdef ODBC_FAKE_LIBRARIES
|
|---|
| 104 | $(TEMPDIR)/dummyodbc.c:
|
|---|
| 105 | @$(prep-target)
|
|---|
| 106 | $(ECHO) "void dummyOdbc(void){}" >> $@
|
|---|
| 107 | $(TEMPDIR)/dummyodbc.o: $(TEMPDIR)/dummyodbc.c
|
|---|
| 108 | @$(prep-target)
|
|---|
| 109 | $(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $<
|
|---|
| 110 | $(ODBC_FAKE_LIBRARIES): $(TEMPDIR)/dummyodbc.o
|
|---|
| 111 | @$(prep-target)
|
|---|
| 112 | $(CC) $(SHARED_LIBRARY_FLAG) $(LDFLAGS_COMMON) -o $@ $< $(EXTRA_LIBS)
|
|---|
| 113 | clean::
|
|---|
| 114 | $(RM) -f $(ODBC_FAKE_LIBRARIES)
|
|---|
| 115 | $(RM) -f $(TEMPDIR)/dummyodbc.c
|
|---|
| 116 | $(RM) -f $(TEMPDIR)/dummyodbc.o
|
|---|
| 117 | endif
|
|---|
| 118 |
|
|---|
| 119 | #
|
|---|
| 120 | # Files that need to be copied
|
|---|
| 121 | #
|
|---|
| 122 | SERVICEDIR = $(CLASSBINDIR)/META-INF/services
|
|---|
| 123 |
|
|---|
| 124 | FILES_copy = \
|
|---|
| 125 | $(SERVICEDIR)/java.sql.Driver
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 | FILES_mkdirs = \
|
|---|
| 129 | $(CLASSBINDIR)/META-INF \
|
|---|
| 130 | $(CLASSBINDIR)/META-INF/services
|
|---|
| 131 |
|
|---|
| 132 | FILES_copydirs = \
|
|---|
| 133 | $(CLASSBINDIR) \
|
|---|
| 134 | $(FILES_mkdirs)
|
|---|
| 135 |
|
|---|
| 136 | build: copy-files
|
|---|
| 137 |
|
|---|
| 138 | copy-files: $(FILES_copy)
|
|---|
| 139 |
|
|---|
| 140 | $(SERVICEDIR)/%: $(CLOSED_SHARE_SRC)/classes/sun/jdbc/odbc/META-INF/services/%
|
|---|
| 141 | $(install-file)
|
|---|
| 142 |
|
|---|
| 143 | clean clobber::
|
|---|
| 144 | $(RM) $(FILES_copy)
|
|---|
| 145 |
|
|---|
| 146 | .PHONY: copy-files
|
|---|
| 147 |
|
|---|