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
28PRJ=..$/..
29
30PRJNAME=testtools
31TARGET=bridgetest
32USE_DEFFILE=TRUE
33ENABLE_EXCEPTIONS=TRUE
34LIBTARGET=NO
35
36.INCLUDE: settings.mk
37.IF "$(L10N_framework)"==""
38DLLPRE = # no leading "lib" on .so files
39
40.IF "$(GUI)"=="WNT"
41BATCH_SUFFIX=.bat
42GIVE_EXEC_RIGHTS=@echo
43MY_URE_INTERNAL_JAVA_DIR=$(strip $(subst,\,/ file:///$(shell @$(WRAPCMD) echo $(SOLARBINDIR))))
44MY_LOCAL_CLASSDIR=$(strip $(subst,\,/ file:///$(shell $(WRAPCMD) echo $(PWD)/$(CLASSDIR)/)))
45.ELIF "$(GUI)"=="OS2"
46BATCH_SUFFIX=.cmd
47GIVE_EXEC_RIGHTS=@echo
48MY_URE_INTERNAL_JAVA_DIR=$(strip $(subst,\,/ file:///$(shell @$(WRAPCMD) echo $(SOLARBINDIR))))
49MY_LOCAL_CLASSDIR=$(strip $(subst,\,/ file:///$(shell $(WRAPCMD) echo $(PWD)/$(CLASSDIR)/)))
50.ELSE
51GIVE_EXEC_RIGHTS=chmod +x
52MY_URE_INTERNAL_JAVA_DIR=file://$(SOLARBINDIR)
53MY_LOCAL_CLASSDIR=file://$(PWD)/$(CLASSDIR)/
54.ENDIF
55
56my_components = bridgetest constructors cppobj
57.IF "$(SOLAR_JAVA)" != ""
58my_components += testComponent
59.END
60
61.IF "$(GUI)"=="WNT"
62.IF "$(compcheck)" != ""
63CFLAGSCXX += -DCOMPCHECK
64.ENDIF
65.ENDIF
66
67SLOFILES = \
68    $(SLO)$/bridgetest.obj \
69    $(SLO)$/cppobj.obj \
70    $(SLO)$/currentcontextchecker.obj \
71    $(SLO)$/multi.obj
72
73# ---- test ----
74
75LIB1TARGET=$(SLB)$/cppobj.lib
76LIB1OBJFILES= \
77		$(SLO)$/cppobj.obj $(SLO)$/currentcontextchecker.obj $(SLO)$/multi.obj
78
79SHL1TARGET = cppobj.uno
80SHL1STDLIBS= \
81		$(CPPULIB)		\
82		$(CPPUHELPERLIB)	\
83		$(SALLIB)
84
85SHL1LIBS=	$(LIB1TARGET)
86SHL1DEF=	$(MISC)$/$(SHL1TARGET).def
87DEF1NAME=	$(SHL1TARGET)
88SHL1VERSIONMAP = $(SOLARENV)/src/component.map
89
90# ---- test object ----
91
92LIB2TARGET=$(SLB)$/bridgetest.lib
93LIB2OBJFILES= \
94        $(SLO)$/bridgetest.obj \
95        $(SLO)$/currentcontextchecker.obj \
96        $(SLO)$/multi.obj
97
98SHL2TARGET = bridgetest.uno
99SHL2STDLIBS= \
100		$(CPPULIB)		\
101		$(CPPUHELPERLIB)	\
102		$(SALLIB)
103
104SHL2LIBS=	$(LIB2TARGET)
105SHL2DEF=	$(MISC)$/$(SHL2TARGET).def
106DEF2NAME=	$(SHL2TARGET)
107SHL2VERSIONMAP = $(SOLARENV)/src/component.map
108
109SHL3TARGET = constructors.uno
110SHL3OBJS = $(SLO)$/constructors.obj
111SHL3STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB)
112SHL3VERSIONMAP = $(SOLARENV)/src/component.map
113SHL3IMPLIB = i$(SHL3TARGET)
114DEF3NAME = $(SHL3TARGET)
115
116.IF "$(SOLAR_JAVA)" != ""
117JARFILES = java_uno.jar jurt.jar ridl.jar
118JAVATARGETS=\
119	$(DLLDEST)$/bridgetest_javaserver$(BATCH_SUFFIX) \
120	$(DLLDEST)$/bridgetest_inprocess_java$(BATCH_SUFFIX)
121.ENDIF
122
123# --- Targets ------------------------------------------------------
124.ENDIF # L10N_framework
125
126.INCLUDE :	target.mk
127.IF "$(L10N_framework)"==""
128ALLTAR: \
129		runtest \
130        $(DLLDEST)/services.rdb \
131		$(DLLDEST)$/uno_types.rdb \
132		$(DLLDEST)$/uno_services.rdb \
133		$(DLLDEST)$/bridgetest_server$(BATCH_SUFFIX) \
134		$(DLLDEST)$/bridgetest_client$(BATCH_SUFFIX) \
135		$(JAVATARGETS)
136
137#################################################################
138
139runtest : $(DLLDEST)$/uno_types.rdb $(DLLDEST)$/uno_services.rdb makefile.mk \
140        $(SHL1TARGETN) $(SHL2TARGETN) $(SHL3TARGETN)
141.IF "$(COM)$(OS)$(CPU)" == "GCCMACOSXP"
142	@echo "Mac OSX PPC GCC fails this test!, likely broken UNO bridge. Fix me."
143.ELSE
144        cd $(DLLDEST) && $(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/uno \
145		-ro uno_services.rdb -ro uno_types.rdb \
146		-s com.sun.star.test.bridge.BridgeTest -- \
147		com.sun.star.test.bridge.CppTestObject
148.ENDIF
149
150$(DLLDEST)/services.rdb :
151    $(COPY) $(SOLARXMLDIR)/ure/services.rdb $@
152
153$(DLLDEST)$/uno_types.rdb : $(SOLARBINDIR)$/udkapi.rdb
154	echo $(DLLDEST)
155	$(GNUCOPY) $? $@
156    $(REGMERGE) $@ / $(BIN)$/bridgetest.rdb
157
158$(DLLDEST)$/bridgetest_client$(BATCH_SUFFIX) .ERRREMOVE: makefile.mk
159    echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro services.rdb \
160        -ro uno_services.rdb -ro uno_types.rdb \
161        -s com.sun.star.test.bridge.BridgeTest -- \
162        -u \''uno:socket,host=127.0.0.1,port=2002;urp;test'\' > $@
163	$(GIVE_EXEC_RIGHTS) $@
164
165$(DLLDEST)$/bridgetest_server$(BATCH_SUFFIX) .ERRREMOVE: makefile.mk
166    echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro uno_services.rdb -ro uno_types.rdb \
167        -s com.sun.star.test.bridge.CppTestObject \
168        -u \''uno:socket,host=127.0.0.1,port=2002;urp;test'\' --singleaccept \
169        > $@
170	$(GIVE_EXEC_RIGHTS) $@
171
172
173.IF "$(SOLAR_JAVA)" != ""
174# jar-files, which regcomp needs so that it can use java
175MY_JARS=java_uno.jar ridl.jar jurt.jar juh.jar
176
177# CLASSPATH, which regcomp needs to be run
178MY_CLASSPATH_TMP=$(foreach,i,$(MY_JARS) $(SOLARBINDIR)$/$i)$(PATH_SEPERATOR)$(XCLASSPATH)
179MY_CLASSPATH=$(strip $(subst,!,$(PATH_SEPERATOR) $(MY_CLASSPATH_TMP:s/ /!/)))$(PATH_SEPERATOR)..$/class
180
181# Use "127.0.0.1" instead of "localhost", see #i32281#:
182$(DLLDEST)$/bridgetest_javaserver$(BATCH_SUFFIX) : makefile.mk
183	-rm -f $@
184	echo java -classpath "$(MY_CLASSPATH)$(PATH_SEPERATOR)..$/class$/testComponent.jar" \
185		com.sun.star.comp.bridge.TestComponentMain \""uno:socket,host=127.0.0.1,port=2002;urp;test"\" singleaccept > $@
186	$(GIVE_EXEC_RIGHTS) $@
187
188$(DLLDEST)$/bridgetest_inprocess_java$(BATCH_SUFFIX) .ERRREMOVE: makefile.mk
189	echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro services.rdb \
190        -ro uno_services.rdb -ro uno_types.rdb \
191        -s com.sun.star.test.bridge.BridgeTest \
192        -env:URE_INTERNAL_JAVA_DIR=$(MY_URE_INTERNAL_JAVA_DIR) \
193        -env:MY_CLASSDIR_URL=$(MY_LOCAL_CLASSDIR) \
194        -- com.sun.star.test.bridge.JavaTestObject noCurrentContext > $@
195	$(GIVE_EXEC_RIGHTS) $@
196.ENDIF
197
198$(DLLDEST)$/uno_services.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \
199        $(MISC)/uno_services.input $(my_components:^"$(MISC)/":+".component")
200    $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/ -o $@ \
201        $(SOLARENV)/bin/packcomponents.xslt $(MISC)/uno_services.input
202
203$(MISC)/uno_services.input :
204    echo \
205        '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
206        > $@
207
208$(MISC)/bridgetest.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
209        bridgetest.component
210    $(XSLTPROC) --nonet --stringparam uri './$(SHL2TARGETN:f)' -o $@ \
211        $(SOLARENV)/bin/createcomponent.xslt bridgetest.component
212
213$(MISC)/constructors.component .ERRREMOVE : \
214        $(SOLARENV)/bin/createcomponent.xslt constructors.component
215    $(XSLTPROC) --nonet --stringparam uri './$(SHL3TARGETN:f)' -o $@ \
216        $(SOLARENV)/bin/createcomponent.xslt constructors.component
217
218$(MISC)/cppobj.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
219        cppobj.component
220    $(XSLTPROC) --nonet --stringparam uri './$(SHL1TARGETN:f)' -o $@ \
221        $(SOLARENV)/bin/createcomponent.xslt cppobj.component
222
223$(MISC)/testComponent.component .ERRREMOVE : \
224        $(SOLARENV)/bin/createcomponent.xslt testComponent.component
225    $(XSLTPROC) --nonet --stringparam uri \
226        'vnd.sun.star.expand:$${{MY_CLASSDIR_URL}}testComponent.jar' -o $@ \
227        $(SOLARENV)/bin/createcomponent.xslt testComponent.component
228
229.ENDIF # L10N_framework
230