forked from tada/pljava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (78 loc) · 2.63 KB
/
Copy pathMakefile
File metadata and controls
91 lines (78 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#-------------------------------------------------------------------------
# Copyright (c) 2004, 2005 TADA AB - Taby Sweden
# Distributed under the terms shown in the file COPYRIGHT
# found in the root folder of this project or at
# http://eng.tada.se/osprojects/COPYRIGHT.html
#
# @author Thomas Hallgren
#-------------------------------------------------------------------------
NAME := pljava
JAVADOCTITLE := 'PL/Java v$(PLJAVA_MAJOR_VER).$(PLJAVA_MINOR_VER) API Specification'
include $(MODULEROOT)/Makefile.global
SRCDIR_USC := $(subst .,^,$(SRCDIR))
mkclsrc = $(subst ^,.,$(subst .,/,$(1:%=$(SRCDIR_USC)/%^java)))
JAVAH := javah
INTPKG := org.postgresql.pljava.internal
JDBCPKG := org.postgresql.pljava.jdbc
JNI_CLASSES := \
$(INTPKG).Backend \
$(INTPKG).SPI \
$(INTPKG).AclId \
$(INTPKG).ErrorData \
$(INTPKG).Oid \
$(INTPKG).ExecutionPlan \
$(INTPKG).JavaWrapper \
$(INTPKG).LargeObject \
$(INTPKG).PgSavepoint \
$(INTPKG).Portal \
$(INTPKG).Relation \
$(INTPKG).Session \
$(INTPKG).SubXactListener \
$(INTPKG).TriggerData \
$(INTPKG).Tuple \
$(INTPKG).TupleDesc \
$(INTPKG).XactListener \
$(JDBCPKG).Invocation \
$(JDBCPKG).SingleRowReader \
$(JDBCPKG).SQLInputFromChunk \
$(JDBCPKG).SQLOutputToChunk \
$(JDBCPKG).SQLInputFromTuple \
$(JDBCPKG).SQLOutputToTuple
JNISRCS := $(call mkclsrc,$(JNI_CLASSES))
ifdef USE_GCJ
# We include both the pljava_jar.o and the pjlava.jar here although
# pljava doesn't need the latter. Most java compilers will need it
# in order to compile triggers and functions later.
#
JNIHDRS = $(patsubst %,$(JNIDIR)/%.h,$(subst .,_,$(JNI_CLASSES)))
mkcname = $(subst _,.,$(1:$(JNIDIR)/%.h=%))
all: $(OBJDIR)/$(NAME)_jar.o $(JARFILE) $(JNIDIR)/.timestamp
$(OBJDIR)/$(NAME)_jar.o: .timestamp
@-mkdir -p $(@D)
@echo $(GCJ) -c -fpic -fjni -o $@ '<java sources>'
@$(GCJ) -c -fpic -fjni -o $@ $(SRCS)
# gcjh fails to clear its function name cache between files (see
# gcc bugzilla #17575) so we must do each file separately to
# avoid name ambiguities that causes names to be generated with
# parameter type info.
#
$(JNIHDRS): $(JNISRCS)
@-mkdir -p $(@D)
@gcjh -jni --classpath=. -d $(@D) $(call mkcname,$@)
# gcjh generated headers don't define final constants (see gcc
# bugzilla #16843) so we must copy our own version of java.sql.Types.
#
$(JNIDIR)/.timestamp: $(JNIHDRS)
@-mkdir -p $(@D)
@cp $(PROJDIR)/fixes/gcj/java_sql_Types.h $(@D)
@touch $@
else
all: $(JARFILE) $(JNIDIR)/.timestamp
$(JNIDIR)/.timestamp: $(JNISRCS)
@-mkdir -p $(@D)
@echo javah -classpath . -d $(@D) '<jni classes>'
@javah -classpath . -d $(@D) $(JNI_CLASSES) java.sql.Types
@touch $@
endif
$(JARFILE): .timestamp
$(JAR) cf $@ .