4
4
# Makefile for Java JDBC interface
5
5
#
6
6
# IDENTIFICATION
7
- # $Id: Makefile,v 1.24 2000/09 /12 04:58:46 momjian Exp $
7
+ # $Id: Makefile,v 1.25 2000/10 /12 08:55:23 peter Exp $
8
8
#
9
9
# -------------------------------------------------------------------------
10
10
11
+ subdir = src/interfaces
12
+ top_builddir = ../../..
13
+ include $(top_builddir ) /src/Makefile.global
14
+
15
+ CP = cp
11
16
FIND = find
12
17
IDL2JAVA = idltojava -fno-cpp -fno-tie
13
18
JAR = jar
@@ -17,6 +22,9 @@ JAVADOC = javadoc
17
22
RM = rm -f
18
23
TOUCH = touch
19
24
25
+ BUILDDRIVER = sh utils/buildDriver
26
+ CHANGELOG = perl utils/changelog.pl
27
+
20
28
# This defines how to compile a java class
21
29
.java.class :
22
30
$(JAVAC ) $<
@@ -28,25 +36,39 @@ TOUCH = touch
28
36
# postgresql to org/postgresql
29
37
PGBASE = org/postgresql
30
38
39
+ # New for 7.1: The jar filename
40
+ JARFILE = postgresql.jar
41
+
42
+ # Yet another attempt to check the version. In theory, any JVM that fails
43
+ # this is breaking the versioning specifications released by Javasoft.
44
+ #
45
+ all : utils/CheckVersion.class
46
+ @$(MAKE ) ` $( JAVA) utils.CheckVersion`
47
+
31
48
# For 6.5.3 and 7.0+, we need to select the correct JDBC API, so prompt
32
49
# for the version.
33
- all :
50
+ huho :
34
51
@echo ------------------------------------------------------------
35
52
@echo Due to problems with some JVMs that dont return a meaningful
36
53
@echo version number, we have had to make the choice of what jdbc
37
54
@echo version is built as a compile time option.
38
55
@echo
39
56
@echo If you are using JDK1.1.x, you will need the JDBC1.2 driver.
40
57
@echo To compile, type:
41
- @echo " make jdbc1 jar "
58
+ @echo " make jdbc1"
42
59
@echo
43
60
@echo " If you are using JDK1.2 (aka Java2) you need the JDBC2."
44
61
@echo To compile, type:
45
- @echo " make jdbc2 jar"
62
+ @echo " make jdbc2"
63
+ @echo
64
+ @echo " If you are using the Java2 Enterprise Edition, you can use"
65
+ @echo " either the standard driver above, or compile the standard"
66
+ @echo " extensions version of the driver. Type:"
67
+ @echo " make enterprise"
46
68
@echo
47
69
@echo Once you have done this, a postgresql.jar file will be
48
70
@echo produced. This file will only work with that particular
49
- @echo JVM .
71
+ @echo version of virtual machine .
50
72
@echo
51
73
@echo ------------------------------------------------------------
52
74
76
98
@echo
77
99
@echo " To make the tests, type:"
78
100
@echo " make tests"
101
+ @echo
102
+ @echo " To build the GUI Shell, type:"
103
+ @echo " make retepsql"
104
+ @echo
79
105
@echo ------------------------------------------------------------
80
106
@echo
81
107
93
119
# the jar file.
94
120
OBJ_COMMON = $(PGBASE ) /Connection.class \
95
121
$(PGBASE ) /Driver.class \
96
- $(PGBASE ) /DriverClass.class \
97
122
$(PGBASE ) /Field.class \
98
123
$(PGBASE ) /PG_Stream.class \
99
124
$(PGBASE ) /ResultSet.class \
@@ -136,53 +161,79 @@ OBJ_JDBC2= $(PGBASE)/jdbc2/ResultSet.class \
136
161
$(PGBASE ) /jdbc2/Statement.class \
137
162
$(PGBASE ) /largeobject/PGblob.class
138
163
164
+ # These files are unique to the JDBC2 Enterprise driver
165
+ OBJ_ENTER = $(OBJ_JDBC2 ) \
166
+ $(PGBASE ) /PostgresqlDataSource.class \
167
+ $(PGBASE ) /xa/ClientConnection.class \
168
+ $(PGBASE ) /xa/TwoPhaseConnection.class \
169
+ $(PGBASE ) /xa/TxConnection.class \
170
+ $(PGBASE ) /xa/XAConnectionImpl.class \
171
+ $(PGBASE ) /xa/XADataSourceImpl.class
172
+
139
173
# This rule builds the JDBC1 compliant driver
140
174
jdbc1 :
141
- (echo " package org.postgresql;" ; \
142
- echo " public class DriverClass {" ; \
143
- echo " public static String connectClass=\" org.postgresql.jdbc1.Connection\" ;" ; \
144
- echo " }" \
145
- ) > $(PGBASE ) /DriverClass.java
175
+ $(BUILDDRIVER ) $(VERSION ) org.postgresql.jdbc1.Connection JDBC1.1 $(PGBASE ) /Driver.java
146
176
-$(RM ) postgresql.jar
147
177
@$(MAKE ) jdbc1real
148
178
149
179
# This rule does the real work for JDBC1.2, however do not call it directly.
150
180
# This is because the JDBC driver relies on the org.postgresql.DriverClass
151
181
# class to determine the driver version.
152
- jdbc1real : $(PGBASE ) /DriverClass.class \
153
- $(OBJ_COMMON ) $(OBJ_JDBC1 ) postgresql.jar msg
182
+ jdbc1real : $(OBJ_COMMON ) $(OBJ_JDBC1 ) $(JARFILE ) msg
154
183
155
184
# This rule builds the JDBC2 compliant driver
156
- jdbc2 :
157
- (echo " package org.postgresql;" ; \
158
- echo " public class DriverClass {" ; \
159
- echo " public static String connectClass=\" org.postgresql.jdbc2.Connection\" ;" ; \
160
- echo " }" \
161
- ) > $(PGBASE ) /DriverClass.java
185
+ jdbc2 :
186
+ @$(MAKE ) jdbc2internal msg
187
+
188
+ # This allows us to build the jdbc2 driver without displaying the msg
189
+ # refer to the retepsql rule to see why.
190
+ jdbc2internal :
191
+ $(BUILDDRIVER ) $(VERSION ) org.postgresql.jdbc2.Connection Java2 $(PGBASE ) /Driver.java
162
192
-$(RM ) postgresql.jar
163
193
@$(MAKE ) jdbc2real
164
194
165
195
# This rule does the real work for JDBC2, however do not call it directly.
166
196
# This is because the JDBC driver relies on the org.postgresql.DriverClass
167
197
# class to determine the driver version.
168
- jdbc2real : $(PGBASE ) /DriverClass.class \
169
- $(OBJ_COMMON ) $(OBJ_JDBC2 ) postgresql.jar msg
198
+ jdbc2real : $(OBJ_COMMON ) $(OBJ_JDBC2 ) $(JARFILE )
199
+
200
+ # This rule builds the enterprise edition of the driver
201
+ enterprise :
202
+ $(BUILDDRIVER ) $(VERSION ) org.postgresql.jdbc2.Connection Enterprise $(PGBASE ) /Driver.java
203
+ -$(RM ) postgresql.jar
204
+ @$(MAKE ) enterprisereal
170
205
171
- # If you have problems with this rule, replace the $( ) with ` ` as some
172
- # shells (mainly sh under Solaris) doesn't recognise $( )
206
+ # This rule does the real work for JDBC2 Enterprise Edition, however do not
207
+ # call it directly. This is because the JDBC driver relies on the
208
+ # org.postgresql.DriverClass class to determine the driver version.
209
+ enterprisereal : $(OBJ_COMMON ) $(OBJ_ENTER ) $(JARFILE )
210
+
211
+ # We use the old `cmd` notation here as some older shells (mainly sh under
212
+ # Solaris) don't recognise the newer $(cmd) syntax.
173
213
#
174
- postgresql.jar : $(OBJ ) $(OBJ_COMMON )
214
+ $( JARFILE ) : $(OBJ ) $(OBJ_COMMON )
175
215
$(JAR ) -c0f $@ ` $( FIND) $( PGBASE) -name " *.class" -print` \
176
216
$(wildcard $(PGBASE ) /* .properties)
177
217
178
218
# This rule removes any temporary and compiled files from the source tree.
219
+ #
179
220
clean :
180
221
$(FIND ) . -name " *~" -exec $(RM ) {} \;
181
222
$(FIND ) . -name " *.class" -exec $(RM ) {} \;
182
- $(FIND ) . -name " *.html" -exec $(RM ) {} \;
183
223
-$(RM ) -rf stock example/corba/stock.built
184
- -$(RM ) postgresql.jar org/postgresql/DriverClass .java
224
+ -$(RM ) postgresql.jar org/postgresql/Driver .java
185
225
-$(RM ) -rf Package-postgresql * output
226
+ -$(RM ) retepsql.jar manifest
227
+
228
+ # New for 7.1
229
+ install : $(JARFILE )
230
+ $(CP ) $(JARFILE ) $(libdir )
231
+
232
+ # This converts CHANGELOG into an html format - used by peter@retep.org.uk
233
+ # to produce an online version
234
+ changelog : changelog.html
235
+ changelog.html : CHANGELOG
236
+ $(CHANGELOG ) $< > $@
186
237
187
238
# ######################################################################
188
239
# This helps make workout what classes are from what source files
@@ -311,3 +362,60 @@ example/corba/stock.built: example/corba/stock.idl
311
362
# tip: we cant use $(wildcard stock/*.java) in the above rule as a race
312
363
# condition occurs, where javac is passed no arguments
313
364
# ######################################################################
365
+ #
366
+ # JPGSql This isn't really an example, but an entire frontend
367
+ # for PostgreSQL via Java & JDBC.
368
+ #
369
+ # Requirements: Java2 platform (JDK1.2.x or 1.3)
370
+ #
371
+ retepsql : jdbc2internal postgresql.jar
372
+ -$(RM ) retepsql.jar
373
+ @$(MAKE ) retepsql.jar
374
+ @echo
375
+ @echo " The retepsql application has now been built. To run, simply"
376
+ @echo " type:"
377
+ @echo
378
+ @echo " java -jar retepsql.jar"
379
+ @echo
380
+ @echo " Note: Some operating systems recognise .jar as an executable,"
381
+ @echo " so on those (and Windows is one of them), you can simply"
382
+ @echo " double click the jar file to start it."
383
+
384
+ # All my classes have this prefix
385
+ RETEP = uk/org/retep
386
+
387
+ # These classes form part of my personal swing library. I have placed these
388
+ # into the public domain, so there are no license issues... enjoy...
389
+ RETEPUTILS = $(RETEP ) /swing/SwingApplication.class \
390
+ $(RETEP ) /swing/SwingApplication.class \
391
+
392
+ # This is my postgresql frontend. As it's never been released before, I've
393
+ # decided not only to publish it under the same licence as the JDBC driver,
394
+ # but also to put it along side the driver. To me it makes sense as it's the
395
+ # best example I have on showing how to use the driver ;-)
396
+ RETEPSQL = $(RETEP ) /sql/DBConnection.class \
397
+ $(RETEP ) /sql/RetepSQL.class \
398
+
399
+ # Some ancilary files which are included in the jar file
400
+ RETEPSQLAUX = $(RETEP ) /icons/ \
401
+
402
+ # The big rule, this builds the jpgsql.jar file which contains the entire
403
+ # application. DONT call this rule directly, but use the retepsql one, as
404
+ # it ensures that jdbc is also compiled first.
405
+ #
406
+ # Note: We include the postgresql.jar contents in this as well. Also the
407
+ # manifest entry MUST be immediately after $@ (note the -m option to jar).
408
+ #
409
+ retepsql.jar : $(RETEPUTILS ) \
410
+ $(RETEPSQL )
411
+ (echo " Manifest-Version: 1.0" ; \
412
+ echo " Created-By: 1.2 (Sun Microsystems Inc.)" ; \
413
+ echo " Main-Class: uk.org.retep.sql.RetepSQL" ; \
414
+ ) > manifest
415
+ $(JAR ) -c0fm $@ manifest \
416
+ ` $( FIND) $( PGBASE) -name " *.class" -print` \
417
+ $(wildcard $(PGBASE ) /* .properties) \
418
+ ` $( FIND) $( RETEP) -name " *.class" -print` \
419
+ $(RETEPSQLAUX )
420
+
421
+ # ######################################################################
0 commit comments