|
1 | 1 | #-------------------------------------------------------------------------
|
2 | 2 | #
|
3 |
| -# Makefile.inc-- |
4 |
| -# Makefile for src/bin (utility programs) |
5 |
| -# |
6 |
| -# Copyright (c) 1994, Regents of the University of California |
7 |
| -# |
| 3 | +# Makefile |
| 4 | +# Makefile for Java JDBC interface |
8 | 5 | #
|
9 | 6 | # IDENTIFICATION
|
10 |
| -# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.36 2000/04/23 04:26:31 tgl Exp $ |
| 7 | +# $Id:Makefile,v 1.37 2000/04/26 05:50:18 peter Exp $ |
11 | 8 | #
|
12 | 9 | #-------------------------------------------------------------------------
|
13 | 10 |
|
14 |
| -SRCDIR= .. |
15 |
| -include$(SRCDIR)/Makefile.global |
16 |
| - |
17 |
| - |
18 |
| -# Note: the klugery for perl5 is to ensure that the perl5 shared lib |
19 |
| -# gets built with the correct path to the installed location of libpq |
20 |
| -# during "make install", but is built against the local tree during |
21 |
| -# ordinary building and testing. During install, we must also guard |
22 |
| -# against the likelihood that we don't have permissions to install into |
23 |
| -# the Perl module library. |
24 |
| - |
25 |
| -.DEFAULTallinstallcleandepdependdistclean: |
26 |
| -$(MAKE) -C libpq$@ |
27 |
| -$(MAKE) -C ecpg$@ |
28 |
| -ifeq ($(HAVE_Cplusplus), true) |
29 |
| -$(MAKE) -C libpq++ $@ |
30 |
| -else |
31 |
| -echo $(HAVE_Cplusplus): No C++ |
32 |
| -endif |
33 |
| -$(MAKE) -C libpgeasy $@ |
34 |
| -ifeq ($(USE_TCL), true) |
35 |
| -$(MAKE) -C libpgtcl $@ |
36 |
| -endif |
37 |
| -ifeq ($(USE_PERL), true) |
38 |
| -if [ "$@" = "install" ]; then \ |
39 |
| -$(MAKE) $(MFLAGS) install-perl5; \ |
40 |
| -else \ |
41 |
| -$(MAKE) $(MFLAGS) perl5/Makefile; \ |
42 |
| -$(MAKE) $(MFLAGS) -C perl5 $@; \ |
43 |
| -fi |
44 |
| -endif |
45 |
| -ifeq ($(USE_ODBC), true) |
46 |
| -$(MAKE) -C odbc $@ |
47 |
| -endif |
48 |
| - |
49 |
| -perl5/Makefile: perl5/Makefile.PL |
50 |
| -cd perl5&&$(PERL) Makefile.PL POLLUTE=1 |
51 |
| - |
52 |
| -install-perl5: perl5/Makefile |
53 |
| -$(MAKE) -C perl5 clean |
54 |
| -cd perl5&& POSTGRES_HOME="$(POSTGRESDIR)"$(PERL) Makefile.PL POLLUTE=1 |
55 |
| -$(MAKE) -C perl5 all |
56 |
| --@if [-w`$(MAKE) --quiet -C perl5 echo-installdir` ];then\ |
57 |
| -$(MAKE)$(MFLAGS) -C perl5 install;\ |
58 |
| -rm -f perl5/Makefile;\ |
59 |
| -else\ |
60 |
| -echo"Skipping install of Perl module for lack of permissions.";\ |
61 |
| -echo"To install it, cd into interfaces/perl5, su to become the";\ |
62 |
| -echo"appropriate user, and do '$(MAKE) install'.";\ |
63 |
| -fi |
64 |
| - |
65 |
| -.PHONY: install-perl5 |
| 11 | +FIND= find |
| 12 | +IDL2JAVA= idltojava -fno-cpp -fno-tie |
| 13 | +JAR= jar |
| 14 | +JAVA= java |
| 15 | +JAVAC= javac -g |
| 16 | +JAVADOC= javadoc |
| 17 | +RM= rm -f |
| 18 | +TOUCH= touch |
| 19 | + |
| 20 | +# This defines how to compile a java class |
| 21 | +.java.class: |
| 22 | +$(JAVAC)$< |
| 23 | + |
| 24 | +.SUFFIXES:.class .java |
| 25 | +.PHONY:all clean doc examples msg |
| 26 | + |
| 27 | +# This is the base directory of the driver. In 7.0, this changed from |
| 28 | +# postgresql to org/postgresql |
| 29 | +PGBASE= org/postgresql |
| 30 | + |
| 31 | +# In 6.5, the all rule builds the makeVersion class which then calls make using |
| 32 | +# the jdbc1 or jdbc2 rules |
| 33 | +all: |
| 34 | +@echo ------------------------------------------------------------ |
| 35 | +@echo Due to problems with some JVMs that dontreturn a meaningful |
| 36 | +@echo version number, we have had to make the choice of what jdbc |
| 37 | +@echo version is built as a compiletime option. |
| 38 | +@echo |
| 39 | +@echo If you are using JDK1.1.x, you will need the JDBC1.2 driver. |
| 40 | +@echo To compile, type: |
| 41 | +@echo" make jdbc1 jar" |
| 42 | +@echo |
| 43 | +@echo"If you are using JDK1.2 (aka Java2) you need the JDBC2." |
| 44 | +@echo To compile, type: |
| 45 | +@echo" make jdbc2 jar" |
| 46 | +@echo |
| 47 | +@echo Once you havedone this, a postgresql.jar file will be |
| 48 | +@echo produced. This file will only work with that particular |
| 49 | +@echo JVM. |
| 50 | +@echo |
| 51 | +@echo ------------------------------------------------------------ |
| 52 | + |
| 53 | +msg: |
| 54 | +@echo ------------------------------------------------------------ |
| 55 | +@echo The JDBC driver has now been built. To make it available to |
| 56 | +@echo other applications, copy the postgresql.jar file to a public |
| 57 | +@echo"place (under unix this could be /usr/local/lib) and add it" |
| 58 | +@echo to the class path. |
| 59 | +@echo |
| 60 | +@echo Then either add -Djdbc.drivers=postgresql.Driver to the |
| 61 | +@echo commandline when running your application, or edit the |
| 62 | +@echo"properties file for your application (~/.hotjava/properties" |
| 63 | +@echo"under unix for HotJava), and add a line containing" |
| 64 | +@echo jdbc.drivers=postgresql.Driver |
| 65 | +@echo |
| 66 | +@echo More details arein the README file andin the main postgresql |
| 67 | +@echo documentation. |
| 68 | +@echo |
| 69 | +@echo ------------------------------------------------------------ |
| 70 | +@echo To build the examples, type: |
| 71 | +@echo" make examples" |
| 72 | +@echo |
| 73 | +@echo"To build the CORBA example (requires Java2):" |
| 74 | +@echo" make corba" |
| 75 | +@echo ------------------------------------------------------------ |
| 76 | +@echo |
| 77 | + |
| 78 | +depdepend: |
| 79 | + |
| 80 | +# This rule builds the javadoc documentation |
| 81 | +doc: |
| 82 | +export CLASSPATH=.;\ |
| 83 | +$(JAVADOC) -public\ |
| 84 | +org.postgresql\ |
| 85 | +org.postgresql.fastpath\ |
| 86 | +org.postgresql.largeobject |
| 87 | + |
| 88 | +# These classes form the driver. These, and only these are placed into |
| 89 | +# the jar file. |
| 90 | +OBJ_COMMON=$(PGBASE)/Connection.class\ |
| 91 | +$(PGBASE)/Driver.class\ |
| 92 | +$(PGBASE)/Field.class\ |
| 93 | +$(PGBASE)/PG_Stream.class\ |
| 94 | +$(PGBASE)/ResultSet.class\ |
| 95 | +$(PGBASE)/errors.properties\ |
| 96 | +$(PGBASE)/errors_fr.properties\ |
| 97 | +$(PGBASE)/fastpath/Fastpath.class\ |
| 98 | +$(PGBASE)/fastpath/FastpathArg.class\ |
| 99 | +$(PGBASE)/geometric/PGbox.class\ |
| 100 | +$(PGBASE)/geometric/PGcircle.class\ |
| 101 | +$(PGBASE)/geometric/PGline.class\ |
| 102 | +$(PGBASE)/geometric/PGlseg.class\ |
| 103 | +$(PGBASE)/geometric/PGpath.class\ |
| 104 | +$(PGBASE)/geometric/PGpoint.class\ |
| 105 | +$(PGBASE)/geometric/PGpolygon.class\ |
| 106 | +$(PGBASE)/largeobject/LargeObject.class\ |
| 107 | +$(PGBASE)/largeobject/LargeObjectManager.class\ |
| 108 | +$(PGBASE)/util/PGmoney.class\ |
| 109 | +$(PGBASE)/util/PGobject.class\ |
| 110 | +$(PGBASE)/util/PGtokenizer.class\ |
| 111 | +$(PGBASE)/util/PSQLException.class\ |
| 112 | +$(PGBASE)/util/Serialize.class\ |
| 113 | +$(PGBASE)/util/UnixCrypt.class |
| 114 | + |
| 115 | +# These files are unique to the JDBC 1 (JDK 1.1) driver |
| 116 | +OBJ_JDBC1=$(PGBASE)/jdbc1/CallableStatement.class\ |
| 117 | +$(PGBASE)/jdbc1/Connection.class\ |
| 118 | +$(PGBASE)/jdbc1/DatabaseMetaData.class\ |
| 119 | +$(PGBASE)/jdbc1/PreparedStatement.class\ |
| 120 | +$(PGBASE)/jdbc1/ResultSet.class\ |
| 121 | +$(PGBASE)/jdbc1/ResultSetMetaData.class\ |
| 122 | +$(PGBASE)/jdbc1/Statement.class |
| 123 | + |
| 124 | +# These files are unique to the JDBC 2 (JDK 2 nee 1.2) driver |
| 125 | +OBJ_JDBC2=$(PGBASE)/jdbc2/ResultSet.class\ |
| 126 | +$(PGBASE)/jdbc2/PreparedStatement.class\ |
| 127 | +$(PGBASE)/jdbc2/CallableStatement.class\ |
| 128 | +$(PGBASE)/jdbc2/Connection.class\ |
| 129 | +$(PGBASE)/jdbc2/DatabaseMetaData.class\ |
| 130 | +$(PGBASE)/jdbc2/ResultSetMetaData.class\ |
| 131 | +$(PGBASE)/jdbc2/Statement.class\ |
| 132 | +$(PGBASE)/largeobject/PGblob.class |
| 133 | + |
| 134 | +# This rule builds the JDBC1 compliant driver |
| 135 | +jdbc1: |
| 136 | +(echo"package org.postgresql;";\ |
| 137 | +echo"public class DriverClass {";\ |
| 138 | +echo"public static String connectClass=\"org.postgresql.jdbc1.Connection\";";\ |
| 139 | +echo"}"\ |
| 140 | +)>$(PGBASE)/DriverClass.java |
| 141 | +@$(MAKE) jdbc1real |
| 142 | + |
| 143 | +jdbc1real:$(PGBASE)/DriverClass.class\ |
| 144 | +$(OBJ_COMMON)$(OBJ_JDBC1) postgresql.jar msg |
| 145 | + |
| 146 | +# This rule builds the JDBC2 compliant driver |
| 147 | +jdbc2: |
| 148 | +(echo"package org.postgresql;";\ |
| 149 | +echo"public class DriverClass {";\ |
| 150 | +echo"public static String connectClass=\"org.postgresql.jdbc2.Connection\";";\ |
| 151 | +echo"}"\ |
| 152 | +)>$(PGBASE)/DriverClass.java |
| 153 | +@$(MAKE) jdbc2real |
| 154 | + |
| 155 | +jdbc2real:$(PGBASE)/DriverClass.class\ |
| 156 | +$(OBJ_COMMON)$(OBJ_JDBC2) postgresql.jar msg |
| 157 | + |
| 158 | +# If you have problems with this rule, replace the $( ) with ` ` as some |
| 159 | +# shells (mainly sh under Solaris) doesn't recognise $( ) |
| 160 | +# |
| 161 | +# Note:This works by storing all compiled classes under the $(PGBASE) |
| 162 | +#directory. We use this later for compiling the dual-mode driver. |
| 163 | +# |
| 164 | +postgresql.jar:$(OBJ)$(OBJ_COMMON) |
| 165 | +$(JAR) -c0f$@`$(FIND)$(PGBASE) -name"*.class" -print`\ |
| 166 | +$(wildcard$(PGBASE)/*.properties) |
| 167 | + |
| 168 | +# This rule removes any temporary and compiled files from the source tree. |
| 169 | +clean: |
| 170 | +$(FIND). -name"*~" -exec$(RM) {}\; |
| 171 | +$(FIND). -name"*.class" -exec$(RM) {}\; |
| 172 | +$(FIND). -name"*.html" -exec$(RM) {}\; |
| 173 | +-$(RM) -rf stock example/corba/stock.built |
| 174 | +-$(RM) postgresql.jar |
| 175 | +-$(RM) -rf Package-postgresql*output |
| 176 | + |
| 177 | +####################################################################### |
| 178 | +# This helps make workout what classes are from what source files |
| 179 | +# |
| 180 | +# Java is unlike C in that one source file can generate several |
| 181 | +# _Different_ file names |
| 182 | +# |
| 183 | +$(PGBASE)/Connection.class:$(PGBASE)/Connection.java |
| 184 | +$(PGBASE)/DatabaseMetaData.class:$(PGBASE)/DatabaseMetaData.java |
| 185 | +$(PGBASE)/Driver.class:$(PGBASE)/Driver.java |
| 186 | +$(PGBASE)/Field.class:$(PGBASE)/Field.java |
| 187 | +$(PGBASE)/PG_Stream.class:$(PGBASE)/PG_Stream.java |
| 188 | +$(PGBASE)/PreparedStatement.class:$(PGBASE)/PreparedStatement.java |
| 189 | +$(PGBASE)/ResultSet.class:$(PGBASE)/ResultSet.java |
| 190 | +$(PGBASE)/ResultSetMetaData.class:$(PGBASE)/ResultSetMetaData.java |
| 191 | +$(PGBASE)/Statement.class:$(PGBASE)/Statement.java |
| 192 | +$(PGBASE)/fastpath/Fastpath.class:$(PGBASE)/fastpath/Fastpath.java |
| 193 | +$(PGBASE)/fastpath/FastpathArg.class:$(PGBASE)/fastpath/FastpathArg.java |
| 194 | +$(PGBASE)/geometric/PGbox.class:$(PGBASE)/geometric/PGbox.java |
| 195 | +$(PGBASE)/geometric/PGcircle.class:$(PGBASE)/geometric/PGcircle.java |
| 196 | +$(PGBASE)/geometric/PGlseg.class:$(PGBASE)/geometric/PGlseg.java |
| 197 | +$(PGBASE)/geometric/PGpath.class:$(PGBASE)/geometric/PGpath.java |
| 198 | +$(PGBASE)/geometric/PGpoint.class:$(PGBASE)/geometric/PGpoint.java |
| 199 | +$(PGBASE)/geometric/PGpolygon.class:$(PGBASE)/geometric/PGpolygon.java |
| 200 | +$(PGBASE)/largeobject/LargeObject.class:$(PGBASE)/largeobject/LargeObject.java |
| 201 | +$(PGBASE)/largeobject/LargeObjectManager.class:$(PGBASE)/largeobject/LargeObjectManager.java |
| 202 | +$(PGBASE)/util/PGmoney.class:$(PGBASE)/util/PGmoney.java |
| 203 | +$(PGBASE)/util/PGobject.class:$(PGBASE)/util/PGobject.java |
| 204 | +$(PGBASE)/util/PGtokenizer.class:$(PGBASE)/util/PGtokenizer.java |
| 205 | +$(PGBASE)/util/Serialize.class:$(PGBASE)/util/Serialize.java |
| 206 | +$(PGBASE)/util/UnixCrypt.class:$(PGBASE)/util/UnixCrypt.java |
| 207 | + |
| 208 | +####################################################################### |
| 209 | +# These classes are in the example directory, and form the examples |
| 210 | +EX=example/basic.class\ |
| 211 | +example/blobtest.class\ |
| 212 | +example/datestyle.class\ |
| 213 | +example/psql.class\ |
| 214 | +example/ImageViewer.class\ |
| 215 | +example/metadata.class\ |
| 216 | +example/threadsafe.class |
| 217 | +#example/Objects.class |
| 218 | + |
| 219 | +# This rule builds the examples |
| 220 | +examples:postgresql.jar$(EX) |
| 221 | +@echo ------------------------------------------------------------ |
| 222 | +@echo The examples have been built. |
| 223 | +@echo |
| 224 | +@echo For instructions on how to use them, simply run them. For example: |
| 225 | +@echo |
| 226 | +@echo" java example.blobtest" |
| 227 | +@echo |
| 228 | +@echo This would display instructions on how to run the example. |
| 229 | +@echo ------------------------------------------------------------ |
| 230 | +@echo Available examples: |
| 231 | +@echo |
| 232 | +@echo" example.basic Basic JDBC useage" |
| 233 | +@echo" example.blobtest Binary Large Object tests" |
| 234 | +@echo" example.datestyle Shows how datestyles are handled" |
| 235 | +@echo" example.ImageViewer Example application storing images" |
| 236 | +@echo" example.psql Simple java implementation of psql" |
| 237 | +@echo" example.Objects Demonstrates Object Serialisation" |
| 238 | +@echo"" |
| 239 | +@echo These are not really examples, but tests various parts of the driver |
| 240 | +@echo" example.metadata Tests various metadata methods" |
| 241 | +@echo" example.threadsafe Tests the driver's thread safety" |
| 242 | +@echo ------------------------------------------------------------ |
| 243 | +@echo |
| 244 | + |
| 245 | +example/basic.class:example/basic.java |
| 246 | +example/blobtest.class:example/blobtest.java |
| 247 | +example/datestyle.class:example/datestyle.java |
| 248 | +example/psql.class:example/psql.java |
| 249 | +example/ImageViewer.class:example/ImageViewer.java |
| 250 | +example/threadsafe.class:example/threadsafe.java |
| 251 | +example/metadata.class:example/metadata.java |
| 252 | + |
| 253 | +####################################################################### |
| 254 | +# |
| 255 | +# CORBAThis extensive example shows how to integrate PostgreSQL |
| 256 | +#JDBC & CORBA. |
| 257 | + |
| 258 | +CORBASRC =$(wildcard example/corba/*.java) |
| 259 | +CORBAOBJ =$(subst .java,.class,$(CORBASRC)) |
| 260 | + |
| 261 | +corba: jdbc2 example/corba/stock.built$(CORBAOBJ) |
| 262 | +@echo ------------------------------------------------------- |
| 263 | +@echo The corba example has been built. Before running, you |
| 264 | +@echo will need toread the example/corba/readme file on how |
| 265 | +@echo to run the example. |
| 266 | +@echo |
| 267 | + |
| 268 | +# |
| 269 | +# This compiles our idl file and the stubs |
| 270 | +# |
| 271 | +# Note: The idl file is in example/corba, but it builds a directory under |
| 272 | +# the current one. For safety, we delete that directory before running |
| 273 | +# idltojava |
| 274 | +# |
| 275 | +example/corba/stock.built: example/corba/stock.idl |
| 276 | +-rm -rf stock |
| 277 | +$(IDL2JAVA)$< |
| 278 | +$(JAVAC) stock/*.java |
| 279 | +$(TOUCH)$@ |
| 280 | + |
| 281 | +# tip: we cant use $(wildcard stock/*.java) in the above rule as a race |
| 282 | +# condition occurs, where javac is passed no arguments |
| 283 | +####################################################################### |