annotate make/sun/jdbc/Makefile @ 3767:54d8193f177b

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