summaryrefslogtreecommitdiffstats
path: root/ure/source/uretest/Makefile.pln
blob: 37025d7acb39429ab7ee6beb4ad5145b493454df (plain)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
#   Licensed to the Apache Software Foundation (ASF) under one or more
#   contributor license agreements. See the NOTICE file distributed
#   with this work for additional information regarding copyright
#   ownership. The ASF licenses this file to you under the Apache
#   License, Version 2.0 (the "License"); you may not use this file
#   except in compliance with the License. You may obtain a copy of
#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
#

# The following variable must be set (see README):
#SDK_HOME := /opt/libreoffice/basis3.1/sdk

# The following variables can be set, if necessary (see README):
#URE_HOME := /opt/libreoffice
#GCCS_COMPAT := LD_PRELOAD=/lib/libgcc_s.so.1


URE_HOME ?= /opt/libreoffice

.DELETE_ON_ERROR:


.PHONY: check
check: test-cpptest test-javatest test-javanative test-clientserver

.PHONY: test-cpptest
test-cpptest: out.pln/cppmain.uno.so out.pln/types.rdb out.pln/services.rdb
	$(GCCS_COMPAT) $(URE_HOME)/program/uno \
            -c test.cpp.cppmain.Component -l file://$(PWD)/$< \
            -env:URE_MORE_TYPES=file://$(PWD)/out.pln/types.rdb \
            -env:URE_MORE_SERVICES=file://$(PWD)/out.pln/services.rdb

.PHONY: test-javatest
test-javatest: out.pln/javamain.uno.jar out.pln/types.rdb out.pln/services.rdb
	$(GCCS_COMPAT) $(URE_HOME)/program/uno \
            -c test.java.javamain.Component -l file://$(PWD)/$< \
            -env:URE_MORE_TYPES=file://$(PWD)/out.pln/types.rdb \
            -env:URE_MORE_SERVICES=file://$(PWD)/out.pln/services.rdb

.PHONY: test-javanative
test-javanative: out.pln/runner.jar out.pln/javanative.jar \
            out.pln/types.rdb out.pln/services.rdb
	URE_MORE_TYPES=file://$(PWD)/out.pln/types.rdb \
            URE_MORE_SERVICES=file://$(PWD)/out.pln/services.rdb \
            $(GCCS_COMPAT) LD_LIBRARY_PATH=$(URE_HOME)/program java \
            -jar out.pln/runner.jar file://$(URE_HOME)/program/classes/ \
            file://$(PWD)/out.pln/javanative.jar

.PHONY: test-clientserver
test-clientserver: out.pln/cppserver.uno.so out.pln/types.rdb \
            out.pln/services.rdb out.pln/runner.jar out.pln/javaclient.jar
	$(GCCS_COMPAT) $(URE_HOME)/program/uno -c test.cpp.cppserver.Component \
            -l file://$(PWD)/out.pln/cppserver.uno.so \
            -env:URE_MORE_TYPES=file://$(PWD)/out.pln/types.rdb \
            -env:URE_MORE_SERVICES=file://$(PWD)/out.pln/services.rdb \
            -u 'uno:pipe,name=ure_test;urp;server' --singleaccept &
	sleep 5 && \
            java -jar out.pln/runner.jar file://$(URE_HOME)/program/classes/ \
            file://$(PWD)/out.pln/javaclient.jar \
            'uno:pipe,name=ure_test;urp;server'


.PHONY: clean
clean:
	rm -rf out.pln


out.pln/cppmain.uno.so: out.pln/cppmain.o | out.pln out.pln/lib/libuno_cppu.so \
            out.pln/lib/libuno_cppuhelpergcc3.so out.pln/lib/libuno_sal.so \
            out.pln/lib/libuno_salhelpergcc3.so
	g++ -shared -o $@ -Wl,-z,defs -Wl,--fatal-warnings $< -Lout.pln/lib \
            -luno_cppu -luno_cppuhelpergcc3 -luno_sal -luno_salhelpergcc3

out.pln/cppmain.o: cppmain.cc out.pln/cpputypes.cppumaker.flag \
            out.pln/types.cppumaker.flag | out.pln
	g++ -c -o $@ -fpic -fvisibility=hidden -Wall -Wno-ctor-dtor-privacy \
            -I $(SDK_HOME)/include -I out.pln/include/cpputypes \
            -I out.pln/include/types -DCPPU_ENV=gcc3 -DLINUX -DUNX $<


out.pln/cpptest.uno.so: out.pln/cpptest.o | out.pln out.pln/lib/libuno_cppu.so \
            out.pln/lib/libuno_cppuhelpergcc3.so out.pln/lib/libuno_sal.so
	g++ -shared -o $@ -Wl,-z,defs -Wl,--fatal-warnings $< -Lout.pln/lib \
            -luno_cppu -luno_cppuhelpergcc3 -luno_sal

out.pln/cpptest.o: cpptest.cc out.pln/cpputypes.cppumaker.flag \
            out.pln/types.cppumaker.flag | out.pln
	g++ -c -o $@ -fpic -fvisibility=hidden -Wall -Wno-ctor-dtor-privacy \
            -I $(SDK_HOME)/include -I out.pln/include/cpputypes \
            -I out.pln/include/types -DCPPU_ENV=gcc3 -DLINUX -DUNX $<


out.pln/cppserver.uno.so: out.pln/cppserver.o | out.pln \
            out.pln/lib/libuno_cppu.so out.pln/lib/libuno_cppuhelpergcc3.so \
            out.pln/lib/libuno_sal.so
	g++ -shared -o $@ -Wl,-z,defs -Wl,--fatal-warnings $< -Lout.pln/lib \
            -luno_cppu -luno_cppuhelpergcc3 -luno_sal

out.pln/cppserver.o: cppserver.cc out.pln/cpputypes.cppumaker.flag \
            out.pln/types.cppumaker.flag | out.pln
	g++ -c -o $@ -fpic -fvisibility=hidden -Wall -Wno-ctor-dtor-privacy \
            -I $(SDK_HOME)/include -I out.pln/include/cpputypes \
            -I out.pln/include/types -DCPPU_ENV=gcc3 -DLINUX -DUNX $<


out.pln/cpputypes.cppumaker.flag: | out.pln
	LD_LIBRARY_PATH=$(URE_HOME)/program $(SDK_HOME)/bin/cppumaker \
            -O./out.pln/include/cpputypes \
            '-Tcom.sun.star.beans.Introspection;com.sun.star.beans.theIntrospection;com.sun.star.bridge.BridgeFactory;com.sun.star.bridge.UnoUrlResolver;com.sun.star.connection.Acceptor;com.sun.star.connection.Connector;com.sun.star.io.Pipe;com.sun.star.io.TextInputStream;com.sun.star.io.TextOutputStream;com.sun.star.java.JavaVirtualMachine;com.sun.star.lang.DisposedException;com.sun.star.lang.EventObject;com.sun.star.lang.XMain;com.sun.star.lang.XMultiComponentFactory;com.sun.star.lang.XMultiServiceFactory;com.sun.star.lang.XSingleComponentFactory;com.sun.star.lang.XSingleServiceFactory;com.sun.star.lang.XTypeProvider;com.sun.star.loader.Java;com.sun.star.loader.SharedLibrary;com.sun.star.reflection.ProxyFactory;com.sun.star.registry.ImplementationRegistration;com.sun.star.registry.SimpleRegistry;com.sun.star.registry.XRegistryKey;com.sun.star.script.Converter;com.sun.star.script.Invocation;com.sun.star.security.AccessController;com.sun.star.security.Policy;com.sun.star.uno.DeploymentException;com.sun.star.uno.Exception;com.sun.star.uno.NamingService;com.sun.star.uno.RuntimeException;com.sun.star.uno.XAggregation;com.sun.star.uno.XComponentContext;com.sun.star.uno.XCurrentContext;com.sun.star.uno.XInterface;com.sun.star.uno.XWeak;com.sun.star.uri.ExternalUriReferenceTranslator;com.sun.star.uri.UriReferenceFactory;com.sun.star.uri.VndSunStarPkgUrlReferenceFactory;com.sun.star.util.theMacroExpander' \
            $(URE_HOME)/program/types.rdb
	touch $@

out.pln/types.cppumaker.flag: out.pln/types.rdb | out.pln
	LD_LIBRARY_PATH=$(URE_HOME)/program $(SDK_HOME)/bin/cppumaker \
            -O./out.pln/include/types ./$< -X$(URE_HOME)/program/types.rdb
	touch $@


out.pln/javamain.uno.jar: \
            out.pln/class/javamain/test/java/javamain/JavaMain.class \
            out.pln/javamain.mf | out.pln
	jar cfm $@ out.pln/javamain.mf -C out.pln/class/javamain test

out.pln/javamain.mf: javamain.mf.template | out.pln
	sed -e 's~^Class-Path:$$~& tester.jar~' \
            -e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@

out.pln/class/javamain/test/java/javamain/JavaMain.class: JavaMain.java \
            out.pln/tester.jar | out.pln/class
	rm -rf out.pln/class/javamain
	mkdir out.pln/class/javamain
	javac -classpath \
            $(URE_HOME)/program/classes/libreoffice.jar:out.pln/tester.jar \
            -sourcepath . -d out.pln/class/javamain $<


out.pln/runner.jar: out.pln/class/runner/test/java/runner/Runner.class \
            out.pln/runner.mf | out.pln
	jar cfm $@ out.pln/runner.mf -C out.pln/class/runner test

out.pln/runner.mf: runner.mf.template | out.pln
	sed -e \
            's~^Class-Path:$$~& file://$(URE_HOME)/program/classes/unoloader.jar~' \
            -e 's~^UNO-Type-Path:$$~& ~' $< > $@

out.pln/class/runner/test/java/runner/Runner.class: Runner.java | out.pln/class
	rm -rf out.pln/class/runner
	mkdir out.pln/class/runner
	javac -classpath $(URE_HOME)/program/classes/unoloader.jar \
            -sourcepath . -d out.pln/class/runner $<


out.pln/tester.jar: out.pln/class/tester/test/java/tester/Tester.class \
            out.pln/tester.mf | out.pln
	jar cfm $@ out.pln/tester.mf -C out.pln/class/tester test

out.pln/tester.mf: tester.mf.template | out.pln
	sed -e 's~^Class-Path:$$~& types.jar~' \
            -e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@

out.pln/class/tester/test/java/tester/Tester.class: Tester.java \
            out.pln/types.jar | out.pln/class
	rm -rf out.pln/class/tester
	mkdir out.pln/class/tester
	javac -classpath \
            $(URE_HOME)/program/classes/libreoffice.jar:out.pln/types.jar \
            -sourcepath . -d out.pln/class/tester $<


out.pln/javatest.uno.jar: \
            out.pln/class/javatest/test/java/javatest/JavaTest.class \
            out.pln/javatest.mf | out.pln
	jar cfm $@ out.pln/javatest.mf -C out.pln/class/javatest test

out.pln/javatest.mf: javatest.mf.template | out.pln
	sed -e 's~^Class-Path:$$~& types.jar~' \
            -e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@

out.pln/class/javatest/test/java/javatest/JavaTest.class: JavaTest.java \
            out.pln/types.jar | out.pln/class
	rm -rf out.pln/class/javatest
	mkdir out.pln/class/javatest
	javac -classpath \
            $(URE_HOME)/program/classes/libreoffice.jar:out.pln/types.jar \
            -sourcepath . -d out.pln/class/javatest $<


out.pln/javanative.jar: \
            out.pln/class/javanative/test/java/javanative/JavaNative.class \
            out.pln/javanative.mf | out.pln
	jar cfm $@ out.pln/javanative.mf -C out.pln/class/javanative test

out.pln/javanative.mf: javanative.mf.template | out.pln
	sed -e 's~^Class-Path:$$~& tester.jar~' \
            -e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@

out.pln/class/javanative/test/java/javanative/JavaNative.class: \
            JavaNative.java out.pln/tester.jar | out.pln/class
	rm -rf out.pln/class/javanative
	mkdir out.pln/class/javanative
	javac -classpath \
            $(URE_HOME)/program/classes/libreoffice.jar:out.pln/tester.jar \
            -sourcepath . -d out.pln/class/javanative $<


out.pln/javaclient.jar: \
            out.pln/class/javaclient/test/java/javaclient/JavaClient.class \
            out.pln/javaclient.mf | out.pln
	jar cfm $@ out.pln/javaclient.mf -C out.pln/class/javaclient test

out.pln/javaclient.mf: javaclient.mf.template | out.pln
	sed -e 's~^Class-Path:$$~& types.jar~' \
            -e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@

out.pln/class/javaclient/test/java/javaclient/JavaClient.class: \
            JavaClient.java out.pln/types.jar | out.pln/class
	rm -rf out.pln/class/javaclient
	mkdir out.pln/class/javaclient
	javac -classpath \
            $(URE_HOME)/program/classes/libreoffice.jar:out.pln/types.jar \
            -sourcepath . -d out.pln/class/javaclient $<


out.pln/types.jar: out.pln/types.javamaker.flag out.pln/types.mf | out.pln
	jar cfm $@ out.pln/types.mf -C out.pln/class/types test

out.pln/types.mf: types.mf.template | out.pln
	sed -e 's~^Class-Path:$$~& ~' -e 's~^UNO-Type-Path:$$~& \<\>~' $< > $@

out.pln/types.javamaker.flag: out.pln/types.rdb | out.pln out.pln/class
	rm -rf out.pln/class/types
	LD_LIBRARY_PATH=$(URE_HOME)/program $(SDK_HOME)/bin/javamaker \
            -O./out.pln/class/types ./$< -X$(URE_HOME)/program/types.rdb
	touch $@


out.pln/types.rdb: types.idl | out.pln
	LD_LIBRARY_PATH=$(URE_HOME)/program $(SDK_HOME)/bin/unoidl-write \
            $(URE_HOME)/program/types.rdb $< $@


out.pln/services.rdb: services.rdb.in | out.pln/cpptest.uno.so \
            out.pln/javatest.uno.jar out.pln
	sed -e s/@SHAREDLIB_EXT@/so/ < $^ > $@


out.pln/lib/libuno_cppu.so: | out.pln/lib
	ln -fs $(URE_HOME)/program/libuno_cppu.so.3 $@

out.pln/lib/libuno_cppuhelpergcc3.so: | out.pln/lib
	ln -fs $(URE_HOME)/program/libuno_cppuhelpergcc3.so.3 $@

out.pln/lib/libuno_sal.so: | out.pln/lib
	ln -fs $(URE_HOME)/program/libuno_sal.so.3 $@

out.pln/lib/libuno_salhelpergcc3.so: | out.pln/lib
	ln -fs $(URE_HOME)/program/libuno_salhelpergcc3.so.3 $@


out.pln:
	mkdir $@

out.pln/class: | out.pln
	mkdir $@

out.pln/lib: | out.pln
	mkdir $@