17871dc3eSAndrew Rist#**************************************************************
27871dc3eSAndrew Rist#
37871dc3eSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
47871dc3eSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
57871dc3eSAndrew Rist#  distributed with this work for additional information
67871dc3eSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
77871dc3eSAndrew Rist#  to you under the Apache License, Version 2.0 (the
87871dc3eSAndrew Rist#  "License"); you may not use this file except in compliance
97871dc3eSAndrew Rist#  with the License.  You may obtain a copy of the License at
107871dc3eSAndrew Rist#
117871dc3eSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
127871dc3eSAndrew Rist#
137871dc3eSAndrew Rist#  Unless required by applicable law or agreed to in writing,
147871dc3eSAndrew Rist#  software distributed under the License is distributed on an
157871dc3eSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
167871dc3eSAndrew Rist#  KIND, either express or implied.  See the License for the
177871dc3eSAndrew Rist#  specific language governing permissions and limitations
187871dc3eSAndrew Rist#  under the License.
197871dc3eSAndrew Rist#
207871dc3eSAndrew Rist#**************************************************************
217871dc3eSAndrew Rist
227871dc3eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweirPRJ=..$/..
25cdf0e10cSrcweir
26cdf0e10cSrcweirPRJNAME=testtools
27cdf0e10cSrcweirTARGET=bridgetest
28cdf0e10cSrcweirUSE_DEFFILE=TRUE
29cdf0e10cSrcweirENABLE_EXCEPTIONS=TRUE
30cdf0e10cSrcweirLIBTARGET=NO
31cdf0e10cSrcweir
32cdf0e10cSrcweir.INCLUDE: settings.mk
33cdf0e10cSrcweir.IF "$(L10N_framework)"==""
34cdf0e10cSrcweirDLLPRE = # no leading "lib" on .so files
35cdf0e10cSrcweir
36cdf0e10cSrcweir.IF "$(GUI)"=="WNT"
37cdf0e10cSrcweirBATCH_SUFFIX=.bat
38cdf0e10cSrcweirGIVE_EXEC_RIGHTS=@echo
39cdf0e10cSrcweirMY_URE_INTERNAL_JAVA_DIR=$(strip $(subst,\,/ file:///$(shell @$(WRAPCMD) echo $(SOLARBINDIR))))
40cdf0e10cSrcweirMY_LOCAL_CLASSDIR=$(strip $(subst,\,/ file:///$(shell $(WRAPCMD) echo $(PWD)/$(CLASSDIR)/)))
41cdf0e10cSrcweir.ELIF "$(GUI)"=="OS2"
42cdf0e10cSrcweirBATCH_SUFFIX=.cmd
43cdf0e10cSrcweirGIVE_EXEC_RIGHTS=@echo
44cdf0e10cSrcweirMY_URE_INTERNAL_JAVA_DIR=$(strip $(subst,\,/ file:///$(shell @$(WRAPCMD) echo $(SOLARBINDIR))))
45cdf0e10cSrcweirMY_LOCAL_CLASSDIR=$(strip $(subst,\,/ file:///$(shell $(WRAPCMD) echo $(PWD)/$(CLASSDIR)/)))
46cdf0e10cSrcweir.ELSE
47cdf0e10cSrcweirGIVE_EXEC_RIGHTS=chmod +x
48cdf0e10cSrcweirMY_URE_INTERNAL_JAVA_DIR=file://$(SOLARBINDIR)
49cdf0e10cSrcweirMY_LOCAL_CLASSDIR=file://$(PWD)/$(CLASSDIR)/
50cdf0e10cSrcweir.ENDIF
51cdf0e10cSrcweir
52cdf0e10cSrcweirmy_components = bridgetest constructors cppobj
53cdf0e10cSrcweir.IF "$(SOLAR_JAVA)" != ""
54cdf0e10cSrcweirmy_components += testComponent
55cdf0e10cSrcweir.END
56cdf0e10cSrcweir
57cdf0e10cSrcweir.IF "$(GUI)"=="WNT"
58cdf0e10cSrcweir.IF "$(compcheck)" != ""
59cdf0e10cSrcweirCFLAGSCXX += -DCOMPCHECK
60cdf0e10cSrcweir.ENDIF
61cdf0e10cSrcweir.ENDIF
62cdf0e10cSrcweir
63cdf0e10cSrcweirSLOFILES = \
64cdf0e10cSrcweir    $(SLO)$/bridgetest.obj \
65cdf0e10cSrcweir    $(SLO)$/cppobj.obj \
66cdf0e10cSrcweir    $(SLO)$/currentcontextchecker.obj \
67cdf0e10cSrcweir    $(SLO)$/multi.obj
68cdf0e10cSrcweir
69cdf0e10cSrcweir# ---- test ----
70cdf0e10cSrcweir
71cdf0e10cSrcweirLIB1TARGET=$(SLB)$/cppobj.lib
72cdf0e10cSrcweirLIB1OBJFILES= \
73cdf0e10cSrcweir		$(SLO)$/cppobj.obj $(SLO)$/currentcontextchecker.obj $(SLO)$/multi.obj
74cdf0e10cSrcweir
75cdf0e10cSrcweirSHL1TARGET = cppobj.uno
76cdf0e10cSrcweirSHL1STDLIBS= \
77cdf0e10cSrcweir		$(CPPULIB)		\
78cdf0e10cSrcweir		$(CPPUHELPERLIB)	\
79cdf0e10cSrcweir		$(SALLIB)
80cdf0e10cSrcweir
81cdf0e10cSrcweirSHL1LIBS=	$(LIB1TARGET)
82cdf0e10cSrcweirSHL1DEF=	$(MISC)$/$(SHL1TARGET).def
83cdf0e10cSrcweirDEF1NAME=	$(SHL1TARGET)
84cdf0e10cSrcweirSHL1VERSIONMAP = $(SOLARENV)/src/component.map
85cdf0e10cSrcweir
86cdf0e10cSrcweir# ---- test object ----
87cdf0e10cSrcweir
88cdf0e10cSrcweirLIB2TARGET=$(SLB)$/bridgetest.lib
89cdf0e10cSrcweirLIB2OBJFILES= \
90cdf0e10cSrcweir        $(SLO)$/bridgetest.obj \
91cdf0e10cSrcweir        $(SLO)$/currentcontextchecker.obj \
92cdf0e10cSrcweir        $(SLO)$/multi.obj
93cdf0e10cSrcweir
94cdf0e10cSrcweirSHL2TARGET = bridgetest.uno
95cdf0e10cSrcweirSHL2STDLIBS= \
96cdf0e10cSrcweir		$(CPPULIB)		\
97cdf0e10cSrcweir		$(CPPUHELPERLIB)	\
98cdf0e10cSrcweir		$(SALLIB)
99cdf0e10cSrcweir
100cdf0e10cSrcweirSHL2LIBS=	$(LIB2TARGET)
101cdf0e10cSrcweirSHL2DEF=	$(MISC)$/$(SHL2TARGET).def
102cdf0e10cSrcweirDEF2NAME=	$(SHL2TARGET)
103cdf0e10cSrcweirSHL2VERSIONMAP = $(SOLARENV)/src/component.map
104cdf0e10cSrcweir
105cdf0e10cSrcweirSHL3TARGET = constructors.uno
106cdf0e10cSrcweirSHL3OBJS = $(SLO)$/constructors.obj
107cdf0e10cSrcweirSHL3STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB)
108cdf0e10cSrcweirSHL3VERSIONMAP = $(SOLARENV)/src/component.map
109cdf0e10cSrcweirSHL3IMPLIB = i$(SHL3TARGET)
110cdf0e10cSrcweirDEF3NAME = $(SHL3TARGET)
111cdf0e10cSrcweir
112cdf0e10cSrcweir.IF "$(SOLAR_JAVA)" != ""
113cdf0e10cSrcweirJARFILES = java_uno.jar jurt.jar ridl.jar
114cdf0e10cSrcweirJAVATARGETS=\
115cdf0e10cSrcweir	$(DLLDEST)$/bridgetest_javaserver$(BATCH_SUFFIX) \
116cdf0e10cSrcweir	$(DLLDEST)$/bridgetest_inprocess_java$(BATCH_SUFFIX)
117cdf0e10cSrcweir.ENDIF
118cdf0e10cSrcweir
119cdf0e10cSrcweir# --- Targets ------------------------------------------------------
120cdf0e10cSrcweir.ENDIF # L10N_framework
121cdf0e10cSrcweir
122cdf0e10cSrcweir.INCLUDE :	target.mk
123cdf0e10cSrcweir.IF "$(L10N_framework)"==""
124cdf0e10cSrcweirALLTAR: \
125cdf0e10cSrcweir		runtest \
126cdf0e10cSrcweir        $(DLLDEST)/services.rdb \
127cdf0e10cSrcweir		$(DLLDEST)$/uno_types.rdb \
128cdf0e10cSrcweir		$(DLLDEST)$/uno_services.rdb \
129cdf0e10cSrcweir		$(DLLDEST)$/bridgetest_server$(BATCH_SUFFIX) \
130cdf0e10cSrcweir		$(DLLDEST)$/bridgetest_client$(BATCH_SUFFIX) \
131cdf0e10cSrcweir		$(JAVATARGETS)
132cdf0e10cSrcweir
133cdf0e10cSrcweir#################################################################
134cdf0e10cSrcweir
135cdf0e10cSrcweirruntest : $(DLLDEST)$/uno_types.rdb $(DLLDEST)$/uno_services.rdb makefile.mk \
136cdf0e10cSrcweir        $(SHL1TARGETN) $(SHL2TARGETN) $(SHL3TARGETN)
137*e15a4534Spfg.IF "$(COM)$(OS)$(CPU)" == "GCCMACOSXP" || "$(OS)$(CPU)"=="SOLARISS" || "$(COM)$(OS)$(CPU)"=="GCCFREEBSDP"
138c25219e0SPedro Giffuni	@echo "Mac OSX PPC GCC and Solaris fails this test! likely broken UNO bridge. Fix me."
139cdf0e10cSrcweir.ELSE
140cdf0e10cSrcweir        cd $(DLLDEST) && $(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/uno \
141cdf0e10cSrcweir		-ro uno_services.rdb -ro uno_types.rdb \
142cdf0e10cSrcweir		-s com.sun.star.test.bridge.BridgeTest -- \
143cdf0e10cSrcweir		com.sun.star.test.bridge.CppTestObject
144cdf0e10cSrcweir.ENDIF
145cdf0e10cSrcweir
146cdf0e10cSrcweir$(DLLDEST)/services.rdb :
147cdf0e10cSrcweir    $(COPY) $(SOLARXMLDIR)/ure/services.rdb $@
148cdf0e10cSrcweir
149cdf0e10cSrcweir$(DLLDEST)$/uno_types.rdb : $(SOLARBINDIR)$/udkapi.rdb
150cdf0e10cSrcweir	echo $(DLLDEST)
151cdf0e10cSrcweir	$(GNUCOPY) $? $@
152cdf0e10cSrcweir    $(REGMERGE) $@ / $(BIN)$/bridgetest.rdb
153cdf0e10cSrcweir
154cdf0e10cSrcweir$(DLLDEST)$/bridgetest_client$(BATCH_SUFFIX) .ERRREMOVE: makefile.mk
155cdf0e10cSrcweir    echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro services.rdb \
156cdf0e10cSrcweir        -ro uno_services.rdb -ro uno_types.rdb \
157cdf0e10cSrcweir        -s com.sun.star.test.bridge.BridgeTest -- \
158cdf0e10cSrcweir        -u \''uno:socket,host=127.0.0.1,port=2002;urp;test'\' > $@
159cdf0e10cSrcweir	$(GIVE_EXEC_RIGHTS) $@
160cdf0e10cSrcweir
161cdf0e10cSrcweir$(DLLDEST)$/bridgetest_server$(BATCH_SUFFIX) .ERRREMOVE: makefile.mk
162cdf0e10cSrcweir    echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro uno_services.rdb -ro uno_types.rdb \
163cdf0e10cSrcweir        -s com.sun.star.test.bridge.CppTestObject \
164cdf0e10cSrcweir        -u \''uno:socket,host=127.0.0.1,port=2002;urp;test'\' --singleaccept \
165cdf0e10cSrcweir        > $@
166cdf0e10cSrcweir	$(GIVE_EXEC_RIGHTS) $@
167cdf0e10cSrcweir
168cdf0e10cSrcweir
169cdf0e10cSrcweir.IF "$(SOLAR_JAVA)" != ""
170cdf0e10cSrcweir# jar-files, which regcomp needs so that it can use java
171cdf0e10cSrcweirMY_JARS=java_uno.jar ridl.jar jurt.jar juh.jar
172cdf0e10cSrcweir
173cdf0e10cSrcweir# CLASSPATH, which regcomp needs to be run
174cdf0e10cSrcweirMY_CLASSPATH_TMP=$(foreach,i,$(MY_JARS) $(SOLARBINDIR)$/$i)$(PATH_SEPERATOR)$(XCLASSPATH)
175cdf0e10cSrcweirMY_CLASSPATH=$(strip $(subst,!,$(PATH_SEPERATOR) $(MY_CLASSPATH_TMP:s/ /!/)))$(PATH_SEPERATOR)..$/class
176cdf0e10cSrcweir
177cdf0e10cSrcweir# Use "127.0.0.1" instead of "localhost", see #i32281#:
178cdf0e10cSrcweir$(DLLDEST)$/bridgetest_javaserver$(BATCH_SUFFIX) : makefile.mk
179cdf0e10cSrcweir	-rm -f $@
180cdf0e10cSrcweir	echo java -classpath "$(MY_CLASSPATH)$(PATH_SEPERATOR)..$/class$/testComponent.jar" \
181cdf0e10cSrcweir		com.sun.star.comp.bridge.TestComponentMain \""uno:socket,host=127.0.0.1,port=2002;urp;test"\" singleaccept > $@
182cdf0e10cSrcweir	$(GIVE_EXEC_RIGHTS) $@
183cdf0e10cSrcweir
184cdf0e10cSrcweir$(DLLDEST)$/bridgetest_inprocess_java$(BATCH_SUFFIX) .ERRREMOVE: makefile.mk
185cdf0e10cSrcweir	echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro services.rdb \
186cdf0e10cSrcweir        -ro uno_services.rdb -ro uno_types.rdb \
187cdf0e10cSrcweir        -s com.sun.star.test.bridge.BridgeTest \
188cdf0e10cSrcweir        -env:URE_INTERNAL_JAVA_DIR=$(MY_URE_INTERNAL_JAVA_DIR) \
189cdf0e10cSrcweir        -env:MY_CLASSDIR_URL=$(MY_LOCAL_CLASSDIR) \
190cdf0e10cSrcweir        -- com.sun.star.test.bridge.JavaTestObject noCurrentContext > $@
191cdf0e10cSrcweir	$(GIVE_EXEC_RIGHTS) $@
192cdf0e10cSrcweir.ENDIF
193cdf0e10cSrcweir
194cdf0e10cSrcweir$(DLLDEST)$/uno_services.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \
195cdf0e10cSrcweir        $(MISC)/uno_services.input $(my_components:^"$(MISC)/":+".component")
196cdf0e10cSrcweir    $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/ -o $@ \
197cdf0e10cSrcweir        $(SOLARENV)/bin/packcomponents.xslt $(MISC)/uno_services.input
198cdf0e10cSrcweir
199cdf0e10cSrcweir$(MISC)/uno_services.input :
200cdf0e10cSrcweir    echo \
201cdf0e10cSrcweir        '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
202cdf0e10cSrcweir        > $@
203cdf0e10cSrcweir
204cdf0e10cSrcweir$(MISC)/bridgetest.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
205cdf0e10cSrcweir        bridgetest.component
206cdf0e10cSrcweir    $(XSLTPROC) --nonet --stringparam uri './$(SHL2TARGETN:f)' -o $@ \
207cdf0e10cSrcweir        $(SOLARENV)/bin/createcomponent.xslt bridgetest.component
208cdf0e10cSrcweir
209cdf0e10cSrcweir$(MISC)/constructors.component .ERRREMOVE : \
210cdf0e10cSrcweir        $(SOLARENV)/bin/createcomponent.xslt constructors.component
211cdf0e10cSrcweir    $(XSLTPROC) --nonet --stringparam uri './$(SHL3TARGETN:f)' -o $@ \
212cdf0e10cSrcweir        $(SOLARENV)/bin/createcomponent.xslt constructors.component
213cdf0e10cSrcweir
214cdf0e10cSrcweir$(MISC)/cppobj.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
215cdf0e10cSrcweir        cppobj.component
216cdf0e10cSrcweir    $(XSLTPROC) --nonet --stringparam uri './$(SHL1TARGETN:f)' -o $@ \
217cdf0e10cSrcweir        $(SOLARENV)/bin/createcomponent.xslt cppobj.component
218cdf0e10cSrcweir
219cdf0e10cSrcweir$(MISC)/testComponent.component .ERRREMOVE : \
220cdf0e10cSrcweir        $(SOLARENV)/bin/createcomponent.xslt testComponent.component
221cdf0e10cSrcweir    $(XSLTPROC) --nonet --stringparam uri \
222cdf0e10cSrcweir        'vnd.sun.star.expand:$${{MY_CLASSDIR_URL}}testComponent.jar' -o $@ \
223cdf0e10cSrcweir        $(SOLARENV)/bin/createcomponent.xslt testComponent.component
224cdf0e10cSrcweir
225cdf0e10cSrcweir.ENDIF # L10N_framework
226