xref: /aoo41x/main/ure/source/uretest/Makefile (revision cdf0e10c)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2010 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28# The following variable can be set, if necessary (see README):
29#GCCS_COMPAT := LD_PRELOAD=/lib/libgcc_s.so.1
30
31
32.DELETE_ON_ERROR:
33
34
35PRJ = $(OO_SDK_HOME)
36
37include $(PRJ)/settings/settings.mk
38include $(PRJ)/settings/std.mk
39
40ifeq "$(PLATFORM)" "windows"
41qt = "
42qt2 =
43cwd = $(subst \,/,$(shell cd))
44link_output_switch = -out:
45link_std_libs = kernel32.lib msvcrt.lib
46ure_java_url = $(subst $(subst .,., ),%%20,$(subst \,/,$(URLPREFIX)$(OO_SDK_URE_JAVA_DIR)))
47ure_unorc_url = $(subst $(subst .,., ),%%20,$(subst \,/,$(URLPREFIX)$(OO_SDK_URE_LIB_DIR)/uno.ini))
48else
49qt = '
50qt2 = '
51cwd = $(PWD)
52link_output_switch = $(subst .,.,-o )
53link_std_libs =
54ure_java_url = $(URLPREFIX)$(OO_SDK_URE_JAVA_DIR)
55ure_unorc_url = $(URLPREFIX)$(OO_SDK_URE_LIB_DIR)/unorc
56endif
57
58
59.PHONY: ALL
60ALL: test
61
62include $(PRJ)/settings/stdtarget.mk
63
64
65.PHONY: test
66test: test-cpptest test-javatest test-javanative test-clientserver
67
68.PHONY: test-cpptest
69test-cpptest: out.sdk/cppmain.uno.$(SHAREDLIB_EXT) out.sdk/types.rdb \
70            out.sdk/services.rdb
71	$(GCCS_COMPAT) uno \
72            -c test.cpp.cppmain.Component -l $(URLPREFIX)$(cwd)/$< \
73            -ro "$(subst \,/,$(URLPREFIX)$(URE_TYPES))" -ro out.sdk/types.rdb \
74            -ro "$(subst \,/,$(URLPREFIX)$(URE_SERVICES))" \
75            -ro out.sdk/services.rdb
76
77.PHONY: test-javatest
78test-javatest: out.sdk/javamain.uno.jar out.sdk/types.rdb out.sdk/services.rdb
79	$(GCCS_COMPAT) uno \
80            -c test.java.javamain.Component -l $(URLPREFIX)$(cwd)/$< \
81            -ro "$(subst \,/,$(URLPREFIX)$(URE_TYPES))" -ro out.sdk/types.rdb \
82            -ro "$(subst \,/,$(URLPREFIX)$(URE_SERVICES))" \
83            -ro out.sdk/services.rdb
84
85.PHONY: test-javanative
86test-javanative: out.sdk/runner.jar out.sdk/javanative.jar \
87            out.sdk/javanative.rc out.sdk/services.rdb out.sdk/types.rdb
88	$(GCCS_COMPAT) $(SDK_JAVA) -jar out.sdk/runner.jar $(ure_java_url)/ \
89            $(URLPREFIX)$(cwd)/out.sdk/javanative.jar \
90            $(URLPREFIX)$(cwd)/out.sdk/javanative.rc
91
92do_server = $(GCCS_COMPAT) uno -c test.cpp.cppserver.Component \
93    -l $(URLPREFIX)$(cwd)/out.sdk/cppserver.uno.$(SHAREDLIB_EXT) \
94    -ro "$(subst \,/,$(URLPREFIX)$(URE_TYPES))" -ro out.sdk/types.rdb \
95    -ro "$(subst \,/,$(URLPREFIX)$(URE_SERVICES))" -ro out.sdk/services.rdb \
96    -u "uno:pipe,name=ure_test;urp;server" --singleaccept
97do_client = $(SDK_JAVA) -jar out.sdk/runner.jar $(ure_java_url)/ \
98    $(URLPREFIX)$(cwd)/out.sdk/javaclient.jar \
99    "uno:pipe,name=ure_test;urp;server"
100.PHONY: test-clientserver
101test-clientserver: out.sdk/cppserver.uno.$(SHAREDLIB_EXT) out.sdk/runner.jar \
102            out.sdk/javaclient.jar
103ifeq "$(PLATFORM)" "windows"
104	echo $(subst %,%%,$(do_server)) > out.sdk/server.bat
105	echo $(subst %,%%,$(do_client)) > out.sdk/client.bat
106	@ echo Execute test-clientserver manually: start out.sdk\server.bat
107	@ echo and then simultaneously start out.sdk\client.bat
108else
109	$(do_server) &
110	sleep 5 && $(do_client)
111endif
112
113
114.PHONY: clean
115clean:
116	$(DELRECURSIVE) $(subst /,$(PS),out.sdk)
117
118
119out.sdk/cppmain.uno.$(SHAREDLIB_EXT): out.sdk/cppmain.$(OBJ_EXT) version.map | \
120            out.sdk
121	$(LINK) $(COMP_LINK_FLAGS) $(link_output_switch)$@ $< $(LINK_LIBS) \
122            $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) $(SALHELPERLIB) \
123            $(STLPORTLIB) $(link_std_libs)
124
125out.sdk/cppmain.$(OBJ_EXT): cppmain.cc out.sdk/cpputypes.cppumaker.flag \
126            out.sdk/types.cppumaker.flag | out.sdk
127	$(CC) $(CC_FLAGS) $(CC_OUTPUT_SWITCH)$@ -I$(PRJ)/include/stl \
128            $(CC_INCLUDES) -Iout.sdk/include/cpputypes -Iout.sdk/include/types \
129            $(CC_DEFINES) $<
130
131
132out.sdk/cpptest.uno.$(SHAREDLIB_EXT): out.sdk/cpptest.$(OBJ_EXT) version.map | \
133            out.sdk
134	$(LINK) $(COMP_LINK_FLAGS) $(link_output_switch)$@ $< $(LINK_LIBS) \
135            $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) $(link_std_libs)
136
137out.sdk/cpptest.$(OBJ_EXT): cpptest.cc out.sdk/cpputypes.cppumaker.flag \
138            out.sdk/types.cppumaker.flag | out.sdk
139	$(CC) $(CC_FLAGS) $(CC_OUTPUT_SWITCH)$@ -I$(PRJ)/include/stl \
140            $(CC_INCLUDES) -Iout.sdk/include/cpputypes -Iout.sdk/include/types \
141            $(CC_DEFINES) $<
142
143
144out.sdk/cppserver.uno.$(SHAREDLIB_EXT): out.sdk/cppserver.$(OBJ_EXT) \
145            version.map | out.sdk
146	$(LINK) $(COMP_LINK_FLAGS) $(link_output_switch)$@ $< $(LINK_LIBS) \
147            $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) $(link_std_libs)
148
149out.sdk/cppserver.$(OBJ_EXT): cppserver.cc out.sdk/cpputypes.cppumaker.flag \
150            out.sdk/types.cppumaker.flag | out.sdk
151	$(CC) $(CC_FLAGS) $(CC_OUTPUT_SWITCH)$@ -I$(PRJ)/include/stl \
152            $(CC_INCLUDES) -Iout.sdk/include/cpputypes -Iout.sdk/include/types \
153            $(CC_DEFINES) $<
154
155
156out.sdk/cpputypes.cppumaker.flag: | out.sdk
157	$(CPPUMAKER) -O./out.sdk/include/cpputypes \
158            "-Tcom.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.registry.XRegistryKey;com.sun.star.uno.DeploymentException;com.sun.star.uno.Exception;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" \
159            -B/UCR "$(URE_TYPES)"
160	touch $@
161
162out.sdk/types.cppumaker.flag: out.sdk/types.rdb | out.sdk
163	$(CPPUMAKER) -O./out.sdk/include/types -B/UCR $< "-X$(URE_TYPES)"
164	touch $@
165
166
167out.sdk/javamain.uno.jar: \
168            out.sdk/class/javamain/test/java/javamain/JavaMain.class \
169            out.sdk/javamain.mf | out.sdk
170	$(SDK_JAR) cfm $@ out.sdk/javamain.mf -C out.sdk/class/javamain test
171
172out.sdk/javamain.mf: javamain.mf.template | out.sdk
173	sed -e $(qt)s~^Class-Path:$$~& tester.jar~$(qt) \
174            -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@
175
176out.sdk/class/javamain/test/java/javamain/JavaMain.class: JavaMain.java \
177            out.sdk/tester.jar | out.sdk/class
178	- $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/javamain)
179	$(MKDIR) $(subst /,$(PS),out.sdk/class/javamain)
180	$(SDK_JAVAC) $(JAVAC_FLAGS) \
181            -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/tester.jar" \
182            -sourcepath . -d out.sdk/class/javamain $<
183
184
185out.sdk/runner.jar: out.sdk/class/runner/test/java/runner/Runner.class \
186            out.sdk/runner.mf | out.sdk
187	$(SDK_JAR) cfm $@ out.sdk/runner.mf -C out.sdk/class/runner test
188
189out.sdk/runner.mf: runner.mf.template | out.sdk
190	sed -e \
191            $(qt)s~^Class-Path:$$~& $(ure_java_url)/unoloader.jar~$(qt) \
192            -e $(qt)s~^UNO-Type-Path:$$~& ~$(qt) $< > $@
193
194out.sdk/class/runner/test/java/runner/Runner.class: Runner.java | out.sdk/class
195	- $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/runner)
196	$(MKDIR) $(subst /,$(PS),out.sdk/class/runner)
197	$(SDK_JAVAC) $(JAVAC_FLAGS) -sourcepath . -d out.sdk/class/runner $<
198
199
200out.sdk/tester.jar: out.sdk/class/tester/test/java/tester/Tester.class \
201            out.sdk/tester.mf | out.sdk
202	$(SDK_JAR) cfm $@ out.sdk/tester.mf -C out.sdk/class/tester test
203
204out.sdk/tester.mf: tester.mf.template | out.sdk
205	sed -e $(qt)s~^Class-Path:$$~& types.jar~$(qt) \
206            -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@
207
208out.sdk/class/tester/test/java/tester/Tester.class: Tester.java \
209            out.sdk/types.jar | out.sdk/class
210	- $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/tester)
211	$(MKDIR) $(subst /,$(PS),out.sdk/class/tester)
212	$(SDK_JAVAC) $(JAVAC_FLAGS) \
213            -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/types.jar" \
214            -sourcepath . -d out.sdk/class/tester $<
215
216
217out.sdk/javatest.uno.jar: \
218            out.sdk/class/javatest/test/java/javatest/JavaTest.class \
219            out.sdk/javatest.mf | out.sdk
220	$(SDK_JAR) cfm $@ out.sdk/javatest.mf -C out.sdk/class/javatest test
221
222out.sdk/javatest.mf: javatest.mf.template | out.sdk
223	sed -e $(qt)s~^Class-Path:$$~& types.jar~$(qt) \
224            -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@
225
226out.sdk/class/javatest/test/java/javatest/JavaTest.class: JavaTest.java \
227            out.sdk/types.jar | out.sdk/class
228	- $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/javatest)
229	$(MKDIR) $(subst /,$(PS),out.sdk/class/javatest)
230	$(SDK_JAVAC) $(JAVAC_FLAGS) \
231            -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/types.jar" \
232            -sourcepath . -d out.sdk/class/javatest $<
233
234
235out.sdk/javanative.jar: \
236            out.sdk/class/javanative/test/java/javanative/JavaNative.class \
237            out.sdk/javanative.mf | out.sdk
238	$(SDK_JAR) cfm $@ out.sdk/javanative.mf -C out.sdk/class/javanative test
239
240out.sdk/javanative.mf: javanative.mf.template | out.sdk
241	sed -e $(qt)s~^Class-Path:$$~& tester.jar~$(qt) \
242            -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@
243
244out.sdk/class/javanative/test/java/javanative/JavaNative.class: \
245            JavaNative.java out.sdk/tester.jar | out.sdk/class
246	- $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/javanative)
247	$(MKDIR) $(subst /,$(PS),out.sdk/class/javanative)
248	$(SDK_JAVAC) $(JAVAC_FLAGS) \
249            -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/tester.jar" \
250            -sourcepath . -d out.sdk/class/javanative $<
251
252out.sdk/javanative.rc: | out.sdk
253	echo $(qt2)URE_INTERNAL_LIB_DIR=$${$(subst :,\u003A,$(ure_unorc_url)):URE_INTERNAL_LIB_DIR}$(qt2) > $@
254	echo $(qt2)URE_INTERNAL_JAVA_DIR=$${$(subst :,\u003A,$(ure_unorc_url)):URE_INTERNAL_JAVA_DIR}$(qt2) >> $@
255	echo $(qt2)UNO_TYPES=$${$(subst :,\u003A,$(ure_unorc_url)):UNO_TYPES} $(URLPREFIX)$(cwd)/out.sdk/types.rdb$(qt2) >> $@
256	echo $(qt2)UNO_SERVICES=$${$(subst :,\u003A,$(ure_unorc_url)):UNO_SERVICES} $(URLPREFIX)$(cwd)/out.sdk/services.rdb$(qt2) >> $@
257
258
259out.sdk/javaclient.jar: \
260            out.sdk/class/javaclient/test/java/javaclient/JavaClient.class \
261            out.sdk/javaclient.mf | out.sdk
262	$(SDK_JAR) cfm $@ out.sdk/javaclient.mf -C out.sdk/class/javaclient test
263
264out.sdk/javaclient.mf: javaclient.mf.template | out.sdk
265	sed -e $(qt)s~^Class-Path:$$~& types.jar~$(qt) \
266            -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@
267
268out.sdk/class/javaclient/test/java/javaclient/JavaClient.class: \
269            JavaClient.java out.sdk/types.jar | out.sdk/class
270	- $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/javaclient)
271	$(MKDIR) $(subst /,$(PS),out.sdk/class/javaclient)
272	$(SDK_JAVAC) $(JAVAC_FLAGS) \
273            -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/types.jar" \
274            -sourcepath . -d out.sdk/class/javaclient $<
275
276
277out.sdk/types.jar: out.sdk/types.javamaker.flag out.sdk/types.mf | out.sdk
278	$(SDK_JAR) cfm $@ out.sdk/types.mf -C out.sdk/class/types test
279
280out.sdk/types.mf: types.mf.template | out.sdk
281	sed -e $(qt)s~^Class-Path:$$~& ~$(qt) \
282            -e $(qt)s~^UNO-Type-Path:$$~& \<\>~$(qt) $< > $@
283
284out.sdk/types.javamaker.flag: out.sdk/types.rdb | out.sdk out.sdk/class
285	- $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/types)
286	$(JAVAMAKER) -O./out.sdk/class/types -B/UCR $< "-X$(URE_TYPES)"
287	touch $@
288
289
290out.sdk/types.rdb: out.sdk/types.urd | out.sdk
291	$(REGMERGE) $@ /UCR $<
292
293out.sdk/types.urd: types.idl | out.sdk
294	$(IDLC) -O$(@D) -I$(IDL_DIR) -cid -we $<
295
296
297out.sdk/services.rdb: out.sdk/cpptest.uno.$(SHAREDLIB_EXT) \
298            out.sdk/javatest.uno.jar | out.sdk
299	$(DEL) $(subst /,$(PS),$@)
300	$(REGCOMP) -register -r $@ \
301            -c $(URLPREFIX)$(cwd)/out.sdk/cpptest.uno.$(SHAREDLIB_EXT)
302	$(REGCOMP) -register -br "$(URE_TYPES)" -br "$(URE_SERVICES)" -r $@ \
303            -c $(URLPREFIX)$(cwd)/out.sdk/javatest.uno.jar
304
305
306out.sdk:
307	$(MKDIR) $(subst /,$(PS),$@)
308
309out.sdk/class: | out.sdk
310	$(MKDIR) $(subst /,$(PS),$@)
311