1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24PRJ=..$/..
25
26PRJNAME=testtools
27TARGET=bridgetest
28USE_DEFFILE=TRUE
29ENABLE_EXCEPTIONS=TRUE
30LIBTARGET=NO
31
32.INCLUDE: settings.mk
33.IF "$(L10N_framework)"==""
34DLLPRE = # no leading "lib" on .so files
35
36.IF "$(GUI)"=="WNT"
37BATCH_SUFFIX=.bat
38GIVE_EXEC_RIGHTS=@echo
39MY_URE_INTERNAL_JAVA_DIR=$(strip $(subst,\,/ file:///$(shell @$(WRAPCMD) echo $(SOLARBINDIR))))
40MY_LOCAL_CLASSDIR=$(strip $(subst,\,/ file:///$(shell $(WRAPCMD) echo $(PWD)/$(CLASSDIR)/)))
41.ELIF "$(GUI)"=="OS2"
42BATCH_SUFFIX=.cmd
43GIVE_EXEC_RIGHTS=@echo
44MY_URE_INTERNAL_JAVA_DIR=$(strip $(subst,\,/ file:///$(shell @$(WRAPCMD) echo $(SOLARBINDIR))))
45MY_LOCAL_CLASSDIR=$(strip $(subst,\,/ file:///$(shell $(WRAPCMD) echo $(PWD)/$(CLASSDIR)/)))
46.ELSE
47GIVE_EXEC_RIGHTS=chmod +x
48MY_URE_INTERNAL_JAVA_DIR=file://$(SOLARBINDIR)
49MY_LOCAL_CLASSDIR=file://$(PWD)/$(CLASSDIR)/
50.ENDIF
51
52my_components = bridgetest constructors cppobj
53.IF "$(SOLAR_JAVA)" != ""
54my_components += testComponent
55.END
56
57.IF "$(GUI)"=="WNT"
58.IF "$(compcheck)" != ""
59CFLAGSCXX += -DCOMPCHECK
60.ENDIF
61.ENDIF
62
63SLOFILES = \
64    $(SLO)$/bridgetest.obj \
65    $(SLO)$/cppobj.obj \
66    $(SLO)$/currentcontextchecker.obj \
67    $(SLO)$/multi.obj
68
69# ---- test ----
70
71LIB1TARGET=$(SLB)$/cppobj.lib
72LIB1OBJFILES= \
73		$(SLO)$/cppobj.obj $(SLO)$/currentcontextchecker.obj $(SLO)$/multi.obj
74
75SHL1TARGET = cppobj.uno
76SHL1STDLIBS= \
77		$(CPPULIB)		\
78		$(CPPUHELPERLIB)	\
79		$(SALLIB)
80
81SHL1LIBS=	$(LIB1TARGET)
82SHL1DEF=	$(MISC)$/$(SHL1TARGET).def
83DEF1NAME=	$(SHL1TARGET)
84SHL1VERSIONMAP = $(SOLARENV)/src/component.map
85
86# ---- test object ----
87
88LIB2TARGET=$(SLB)$/bridgetest.lib
89LIB2OBJFILES= \
90        $(SLO)$/bridgetest.obj \
91        $(SLO)$/currentcontextchecker.obj \
92        $(SLO)$/multi.obj
93
94SHL2TARGET = bridgetest.uno
95SHL2STDLIBS= \
96		$(CPPULIB)		\
97		$(CPPUHELPERLIB)	\
98		$(SALLIB)
99
100SHL2LIBS=	$(LIB2TARGET)
101SHL2DEF=	$(MISC)$/$(SHL2TARGET).def
102DEF2NAME=	$(SHL2TARGET)
103SHL2VERSIONMAP = $(SOLARENV)/src/component.map
104
105SHL3TARGET = constructors.uno
106SHL3OBJS = $(SLO)$/constructors.obj
107SHL3STDLIBS = $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB)
108SHL3VERSIONMAP = $(SOLARENV)/src/component.map
109SHL3IMPLIB = i$(SHL3TARGET)
110DEF3NAME = $(SHL3TARGET)
111
112.IF "$(SOLAR_JAVA)" != ""
113JARFILES = java_uno.jar jurt.jar ridl.jar
114JAVATARGETS=\
115	$(DLLDEST)$/bridgetest_javaserver$(BATCH_SUFFIX) \
116	$(DLLDEST)$/bridgetest_inprocess_java$(BATCH_SUFFIX)
117.ENDIF
118
119# --- Targets ------------------------------------------------------
120.ENDIF # L10N_framework
121
122.INCLUDE :	target.mk
123.IF "$(L10N_framework)"==""
124ALLTAR: \
125		runtest \
126        $(DLLDEST)/services.rdb \
127		$(DLLDEST)$/uno_types.rdb \
128		$(DLLDEST)$/uno_services.rdb \
129		$(DLLDEST)$/bridgetest_server$(BATCH_SUFFIX) \
130		$(DLLDEST)$/bridgetest_client$(BATCH_SUFFIX) \
131		$(JAVATARGETS)
132
133#################################################################
134
135runtest : $(DLLDEST)$/uno_types.rdb $(DLLDEST)$/uno_services.rdb makefile.mk \
136        $(SHL1TARGETN) $(SHL2TARGETN) $(SHL3TARGETN)
137.IF "$(COM)$(OS)$(CPU)" == "GCCMACOSXP" || "$(COM)$(OS)$(CPU)" == "GCCFREEBSDI" || "$(OS)$(CPU)"=="SOLARISS"
138	@echo "Mac OSX PPC GCC ad FreeBDS/i386 fails this test! likely broken UNO bridge. Fix me."
139.ELSE
140        cd $(DLLDEST) && $(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/uno \
141		-ro uno_services.rdb -ro uno_types.rdb \
142		-s com.sun.star.test.bridge.BridgeTest -- \
143		com.sun.star.test.bridge.CppTestObject
144.ENDIF
145
146$(DLLDEST)/services.rdb :
147    $(COPY) $(SOLARXMLDIR)/ure/services.rdb $@
148
149$(DLLDEST)$/uno_types.rdb : $(SOLARBINDIR)$/udkapi.rdb
150	echo $(DLLDEST)
151	$(GNUCOPY) $? $@
152    $(REGMERGE) $@ / $(BIN)$/bridgetest.rdb
153
154$(DLLDEST)$/bridgetest_client$(BATCH_SUFFIX) .ERRREMOVE: makefile.mk
155    echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro services.rdb \
156        -ro uno_services.rdb -ro uno_types.rdb \
157        -s com.sun.star.test.bridge.BridgeTest -- \
158        -u \''uno:socket,host=127.0.0.1,port=2002;urp;test'\' > $@
159	$(GIVE_EXEC_RIGHTS) $@
160
161$(DLLDEST)$/bridgetest_server$(BATCH_SUFFIX) .ERRREMOVE: makefile.mk
162    echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro uno_services.rdb -ro uno_types.rdb \
163        -s com.sun.star.test.bridge.CppTestObject \
164        -u \''uno:socket,host=127.0.0.1,port=2002;urp;test'\' --singleaccept \
165        > $@
166	$(GIVE_EXEC_RIGHTS) $@
167
168
169.IF "$(SOLAR_JAVA)" != ""
170# jar-files, which regcomp needs so that it can use java
171MY_JARS=java_uno.jar ridl.jar jurt.jar juh.jar
172
173# CLASSPATH, which regcomp needs to be run
174MY_CLASSPATH_TMP=$(foreach,i,$(MY_JARS) $(SOLARBINDIR)$/$i)$(PATH_SEPERATOR)$(XCLASSPATH)
175MY_CLASSPATH=$(strip $(subst,!,$(PATH_SEPERATOR) $(MY_CLASSPATH_TMP:s/ /!/)))$(PATH_SEPERATOR)..$/class
176
177# Use "127.0.0.1" instead of "localhost", see #i32281#:
178$(DLLDEST)$/bridgetest_javaserver$(BATCH_SUFFIX) : makefile.mk
179	-rm -f $@
180	echo java -classpath "$(MY_CLASSPATH)$(PATH_SEPERATOR)..$/class$/testComponent.jar" \
181		com.sun.star.comp.bridge.TestComponentMain \""uno:socket,host=127.0.0.1,port=2002;urp;test"\" singleaccept > $@
182	$(GIVE_EXEC_RIGHTS) $@
183
184$(DLLDEST)$/bridgetest_inprocess_java$(BATCH_SUFFIX) .ERRREMOVE: makefile.mk
185	echo '$(AUGMENT_LIBRARY_PATH)' '$(SOLARBINDIR)'/uno -ro services.rdb \
186        -ro uno_services.rdb -ro uno_types.rdb \
187        -s com.sun.star.test.bridge.BridgeTest \
188        -env:URE_INTERNAL_JAVA_DIR=$(MY_URE_INTERNAL_JAVA_DIR) \
189        -env:MY_CLASSDIR_URL=$(MY_LOCAL_CLASSDIR) \
190        -- com.sun.star.test.bridge.JavaTestObject noCurrentContext > $@
191	$(GIVE_EXEC_RIGHTS) $@
192.ENDIF
193
194$(DLLDEST)$/uno_services.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \
195        $(MISC)/uno_services.input $(my_components:^"$(MISC)/":+".component")
196    $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/ -o $@ \
197        $(SOLARENV)/bin/packcomponents.xslt $(MISC)/uno_services.input
198
199$(MISC)/uno_services.input :
200    echo \
201        '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
202        > $@
203
204$(MISC)/bridgetest.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
205        bridgetest.component
206    $(XSLTPROC) --nonet --stringparam uri './$(SHL2TARGETN:f)' -o $@ \
207        $(SOLARENV)/bin/createcomponent.xslt bridgetest.component
208
209$(MISC)/constructors.component .ERRREMOVE : \
210        $(SOLARENV)/bin/createcomponent.xslt constructors.component
211    $(XSLTPROC) --nonet --stringparam uri './$(SHL3TARGETN:f)' -o $@ \
212        $(SOLARENV)/bin/createcomponent.xslt constructors.component
213
214$(MISC)/cppobj.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
215        cppobj.component
216    $(XSLTPROC) --nonet --stringparam uri './$(SHL1TARGETN:f)' -o $@ \
217        $(SOLARENV)/bin/createcomponent.xslt cppobj.component
218
219$(MISC)/testComponent.component .ERRREMOVE : \
220        $(SOLARENV)/bin/createcomponent.xslt testComponent.component
221    $(XSLTPROC) --nonet --stringparam uri \
222        'vnd.sun.star.expand:$${{MY_CLASSDIR_URL}}testComponent.jar' -o $@ \
223        $(SOLARENV)/bin/createcomponent.xslt testComponent.component
224
225.ENDIF # L10N_framework
226