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# The following variable can be set, if necessary (see README): 23#GCCS_COMPAT := LD_PRELOAD=/lib/libgcc_s.so.1 24 25 26.DELETE_ON_ERROR: 27 28 29PRJ = $(OO_SDK_HOME) 30 31include $(PRJ)/settings/settings.mk 32include $(PRJ)/settings/std.mk 33 34ifeq "$(PLATFORM)" "windows" 35qt = " 36qt2 = 37cwd = $(subst \,/,$(shell cd)) 38link_output_switch = -out: 39link_std_libs = kernel32.lib msvcrt.lib 40ure_java_url = $(subst $(subst .,., ),%%20,$(subst \,/,$(URLPREFIX)$(OO_SDK_URE_JAVA_DIR))) 41ure_unorc_url = $(subst $(subst .,., ),%%20,$(subst \,/,$(URLPREFIX)$(OO_SDK_URE_LIB_DIR)/uno.ini)) 42else 43qt = ' 44qt2 = ' 45cwd = $(PWD) 46link_output_switch = $(subst .,.,-o ) 47link_std_libs = 48ure_java_url = $(URLPREFIX)$(OO_SDK_URE_JAVA_DIR) 49ure_unorc_url = $(URLPREFIX)$(OO_SDK_URE_LIB_DIR)/unorc 50endif 51 52 53.PHONY: ALL 54ALL: test 55 56include $(PRJ)/settings/stdtarget.mk 57 58 59.PHONY: test 60test: test-cpptest test-javatest test-javanative test-clientserver 61 62.PHONY: test-cpptest 63test-cpptest: out.sdk/cppmain.uno.$(SHAREDLIB_EXT) out.sdk/types.rdb \ 64 out.sdk/services.rdb 65 uno \ 66 -c test.cpp.cppmain.Component -l $(URLPREFIX)$(cwd)/$< \ 67 -ro "$(subst \,/,$(URLPREFIX)$(URE_TYPES))" -ro out.sdk/types.rdb \ 68 -ro "$(subst \,/,$(URLPREFIX)$(URE_SERVICES))" \ 69 -ro out.sdk/services.rdb 70 71.PHONY: test-javatest 72test-javatest: out.sdk/javamain.uno.jar out.sdk/types.rdb out.sdk/services.rdb 73 uno \ 74 -c test.java.javamain.Component -l $(URLPREFIX)$(cwd)/$< \ 75 -ro "$(subst \,/,$(URLPREFIX)$(URE_TYPES))" -ro out.sdk/types.rdb \ 76 -ro "$(subst \,/,$(URLPREFIX)$(URE_SERVICES))" \ 77 -ro out.sdk/services.rdb 78 79.PHONY: test-javanative 80test-javanative: out.sdk/runner.jar out.sdk/javanative.jar \ 81 out.sdk/javanative.rc out.sdk/services.rdb out.sdk/types.rdb 82 $(SDK_JAVA) -jar out.sdk/runner.jar $(ure_java_url)/ \ 83 $(URLPREFIX)$(cwd)/out.sdk/javanative.jar \ 84 $(URLPREFIX)$(cwd)/out.sdk/javanative.rc 85 86do_server = uno -c test.cpp.cppserver.Component \ 87 -l $(URLPREFIX)$(cwd)/out.sdk/cppserver.uno.$(SHAREDLIB_EXT) \ 88 -ro "$(subst \,/,$(URLPREFIX)$(URE_TYPES))" -ro out.sdk/types.rdb \ 89 -ro "$(subst \,/,$(URLPREFIX)$(URE_SERVICES))" -ro out.sdk/services.rdb \ 90 -u "uno:pipe,name=ure_test;urp;server" --singleaccept 91do_client = $(SDK_JAVA) -jar out.sdk/runner.jar $(ure_java_url)/ \ 92 $(URLPREFIX)$(cwd)/out.sdk/javaclient.jar \ 93 "uno:pipe,name=ure_test;urp;server" 94.PHONY: test-clientserver 95test-clientserver: out.sdk/cppserver.uno.$(SHAREDLIB_EXT) out.sdk/runner.jar \ 96 out.sdk/javaclient.jar 97ifeq "$(PLATFORM)" "windows" 98 echo $(subst %,%%,$(do_server)) > out.sdk/server.bat 99 echo $(subst %,%%,$(do_client)) > out.sdk/client.bat 100 @ echo Execute test-clientserver manually: start out.sdk\server.bat 101 @ echo and then simultaneously start out.sdk\client.bat 102else 103 $(do_server) & 104 sleep 5 && $(do_client) 105endif 106 107 108.PHONY: clean 109clean: 110 $(DELRECURSIVE) $(subst /,$(PS),out.sdk) 111 112 113out.sdk/cppmain.uno.$(SHAREDLIB_EXT): out.sdk/cppmain.$(OBJ_EXT) version.map | \ 114 out.sdk 115 $(LINK) $(COMP_LINK_FLAGS) $(link_output_switch)$@ $< $(LINK_LIBS) \ 116 $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) $(SALHELPERLIB) \ 117 $(link_std_libs) 118 119out.sdk/cppmain.$(OBJ_EXT): cppmain.cc out.sdk/cpputypes.cppumaker.flag \ 120 out.sdk/types.cppumaker.flag | out.sdk 121 $(CC) $(CC_FLAGS) $(CC_OUTPUT_SWITCH)$@ -I$(PRJ)/include/stl \ 122 $(CC_INCLUDES) -Iout.sdk/include/cpputypes -Iout.sdk/include/types \ 123 $(CC_DEFINES) $< 124 125 126out.sdk/cpptest.uno.$(SHAREDLIB_EXT): out.sdk/cpptest.$(OBJ_EXT) version.map | \ 127 out.sdk 128 $(LINK) $(COMP_LINK_FLAGS) $(link_output_switch)$@ $< $(LINK_LIBS) \ 129 $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) $(link_std_libs) 130 131out.sdk/cpptest.$(OBJ_EXT): cpptest.cc out.sdk/cpputypes.cppumaker.flag \ 132 out.sdk/types.cppumaker.flag | out.sdk 133 $(CC) $(CC_FLAGS) $(CC_OUTPUT_SWITCH)$@ -I$(PRJ)/include/stl \ 134 $(CC_INCLUDES) -Iout.sdk/include/cpputypes -Iout.sdk/include/types \ 135 $(CC_DEFINES) $< 136 137 138out.sdk/cppserver.uno.$(SHAREDLIB_EXT): out.sdk/cppserver.$(OBJ_EXT) \ 139 version.map | out.sdk 140 $(LINK) $(COMP_LINK_FLAGS) $(link_output_switch)$@ $< $(LINK_LIBS) \ 141 $(CPPULIB) $(CPPUHELPERLIB) $(SALLIB) $(link_std_libs) 142 143out.sdk/cppserver.$(OBJ_EXT): cppserver.cc out.sdk/cpputypes.cppumaker.flag \ 144 out.sdk/types.cppumaker.flag | out.sdk 145 $(CC) $(CC_FLAGS) $(CC_OUTPUT_SWITCH)$@ -I$(PRJ)/include/stl \ 146 $(CC_INCLUDES) -Iout.sdk/include/cpputypes -Iout.sdk/include/types \ 147 $(CC_DEFINES) $< 148 149 150out.sdk/cpputypes.cppumaker.flag: | out.sdk 151 $(CPPUMAKER) -O./out.sdk/include/cpputypes \ 152 "-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" \ 153 -B/UCR "$(URE_TYPES)" 154 touch $@ 155 156out.sdk/types.cppumaker.flag: out.sdk/types.rdb | out.sdk 157 $(CPPUMAKER) -O./out.sdk/include/types -B/UCR $< "-X$(URE_TYPES)" 158 touch $@ 159 160 161out.sdk/javamain.uno.jar: \ 162 out.sdk/class/javamain/test/java/javamain/JavaMain.class \ 163 out.sdk/javamain.mf | out.sdk 164 $(SDK_JAR) cfm $@ out.sdk/javamain.mf -C out.sdk/class/javamain test 165 166out.sdk/javamain.mf: javamain.mf.template | out.sdk 167 sed -e $(qt)s~^Class-Path:$$~& tester.jar~$(qt) \ 168 -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@ 169 170out.sdk/class/javamain/test/java/javamain/JavaMain.class: JavaMain.java \ 171 out.sdk/tester.jar | out.sdk/class 172 - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/javamain) 173 $(MKDIR) $(subst /,$(PS),out.sdk/class/javamain) 174 $(SDK_JAVAC) $(JAVAC_FLAGS) \ 175 -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/tester.jar" \ 176 -sourcepath . -d out.sdk/class/javamain $< 177 178 179out.sdk/runner.jar: out.sdk/class/runner/test/java/runner/Runner.class \ 180 out.sdk/runner.mf | out.sdk 181 $(SDK_JAR) cfm $@ out.sdk/runner.mf -C out.sdk/class/runner test 182 183out.sdk/runner.mf: runner.mf.template | out.sdk 184 sed -e \ 185 $(qt)s~^Class-Path:$$~& $(ure_java_url)/unoloader.jar~$(qt) \ 186 -e $(qt)s~^UNO-Type-Path:$$~& ~$(qt) $< > $@ 187 188out.sdk/class/runner/test/java/runner/Runner.class: Runner.java | out.sdk/class 189 - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/runner) 190 $(MKDIR) $(subst /,$(PS),out.sdk/class/runner) 191 $(SDK_JAVAC) $(JAVAC_FLAGS) -sourcepath . -d out.sdk/class/runner $< 192 193 194out.sdk/tester.jar: out.sdk/class/tester/test/java/tester/Tester.class \ 195 out.sdk/tester.mf | out.sdk 196 $(SDK_JAR) cfm $@ out.sdk/tester.mf -C out.sdk/class/tester test 197 198out.sdk/tester.mf: tester.mf.template | out.sdk 199 sed -e $(qt)s~^Class-Path:$$~& types.jar~$(qt) \ 200 -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@ 201 202out.sdk/class/tester/test/java/tester/Tester.class: Tester.java \ 203 out.sdk/types.jar | out.sdk/class 204 - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/tester) 205 $(MKDIR) $(subst /,$(PS),out.sdk/class/tester) 206 $(SDK_JAVAC) $(JAVAC_FLAGS) \ 207 -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/types.jar" \ 208 -sourcepath . -d out.sdk/class/tester $< 209 210 211out.sdk/javatest.uno.jar: \ 212 out.sdk/class/javatest/test/java/javatest/JavaTest.class \ 213 out.sdk/javatest.mf | out.sdk 214 $(SDK_JAR) cfm $@ out.sdk/javatest.mf -C out.sdk/class/javatest test 215 216out.sdk/javatest.mf: javatest.mf.template | out.sdk 217 sed -e $(qt)s~^Class-Path:$$~& types.jar~$(qt) \ 218 -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@ 219 220out.sdk/class/javatest/test/java/javatest/JavaTest.class: JavaTest.java \ 221 out.sdk/types.jar | out.sdk/class 222 - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/javatest) 223 $(MKDIR) $(subst /,$(PS),out.sdk/class/javatest) 224 $(SDK_JAVAC) $(JAVAC_FLAGS) \ 225 -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/types.jar" \ 226 -sourcepath . -d out.sdk/class/javatest $< 227 228 229out.sdk/javanative.jar: \ 230 out.sdk/class/javanative/test/java/javanative/JavaNative.class \ 231 out.sdk/javanative.mf | out.sdk 232 $(SDK_JAR) cfm $@ out.sdk/javanative.mf -C out.sdk/class/javanative test 233 234out.sdk/javanative.mf: javanative.mf.template | out.sdk 235 sed -e $(qt)s~^Class-Path:$$~& tester.jar~$(qt) \ 236 -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@ 237 238out.sdk/class/javanative/test/java/javanative/JavaNative.class: \ 239 JavaNative.java out.sdk/tester.jar | out.sdk/class 240 - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/javanative) 241 $(MKDIR) $(subst /,$(PS),out.sdk/class/javanative) 242 $(SDK_JAVAC) $(JAVAC_FLAGS) \ 243 -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/tester.jar" \ 244 -sourcepath . -d out.sdk/class/javanative $< 245 246out.sdk/javanative.rc: | out.sdk 247 echo $(qt2)URE_INTERNAL_LIB_DIR=$${$(subst :,\u003A,$(ure_unorc_url)):URE_INTERNAL_LIB_DIR}$(qt2) > $@ 248 echo $(qt2)URE_INTERNAL_JAVA_DIR=$${$(subst :,\u003A,$(ure_unorc_url)):URE_INTERNAL_JAVA_DIR}$(qt2) >> $@ 249 echo $(qt2)UNO_TYPES=$${$(subst :,\u003A,$(ure_unorc_url)):UNO_TYPES} $(URLPREFIX)$(cwd)/out.sdk/types.rdb$(qt2) >> $@ 250 echo $(qt2)UNO_SERVICES=$${$(subst :,\u003A,$(ure_unorc_url)):UNO_SERVICES} $(URLPREFIX)$(cwd)/out.sdk/services.rdb$(qt2) >> $@ 251 252 253out.sdk/javaclient.jar: \ 254 out.sdk/class/javaclient/test/java/javaclient/JavaClient.class \ 255 out.sdk/javaclient.mf | out.sdk 256 $(SDK_JAR) cfm $@ out.sdk/javaclient.mf -C out.sdk/class/javaclient test 257 258out.sdk/javaclient.mf: javaclient.mf.template | out.sdk 259 sed -e $(qt)s~^Class-Path:$$~& types.jar~$(qt) \ 260 -e $(qt)s~^UNO-Type-Path:$$~& types.jar~$(qt) $< > $@ 261 262out.sdk/class/javaclient/test/java/javaclient/JavaClient.class: \ 263 JavaClient.java out.sdk/types.jar | out.sdk/class 264 - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/javaclient) 265 $(MKDIR) $(subst /,$(PS),out.sdk/class/javaclient) 266 $(SDK_JAVAC) $(JAVAC_FLAGS) \ 267 -classpath "$(CLASSPATH)$(PATH_SEPARATOR)out.sdk/types.jar" \ 268 -sourcepath . -d out.sdk/class/javaclient $< 269 270 271out.sdk/types.jar: out.sdk/types.javamaker.flag out.sdk/types.mf | out.sdk 272 $(SDK_JAR) cfm $@ out.sdk/types.mf -C out.sdk/class/types test 273 274out.sdk/types.mf: types.mf.template | out.sdk 275 sed -e $(qt)s~^Class-Path:$$~& ~$(qt) \ 276 -e $(qt)s~^UNO-Type-Path:$$~& \<\>~$(qt) $< > $@ 277 278out.sdk/types.javamaker.flag: out.sdk/types.rdb | out.sdk out.sdk/class 279 - $(DELRECURSIVE) $(subst /,$(PS),out.sdk/class/types) 280 $(JAVAMAKER) -O./out.sdk/class/types -B/UCR $< "-X$(URE_TYPES)" 281 touch $@ 282 283 284out.sdk/types.rdb: out.sdk/types.urd | out.sdk 285 $(REGMERGE) $@ /UCR $< 286 287out.sdk/types.urd: types.idl | out.sdk 288 $(IDLC) -O$(@D) -I$(IDL_DIR) -cid -we $< 289 290 291out.sdk/services.rdb: out.sdk/cpptest.uno.$(SHAREDLIB_EXT) \ 292 out.sdk/javatest.uno.jar | out.sdk 293 $(DEL) $(subst /,$(PS),$@) 294 $(REGCOMP) -register -r $@ \ 295 -c $(URLPREFIX)$(cwd)/out.sdk/cpptest.uno.$(SHAREDLIB_EXT) 296 $(REGCOMP) -register -br "$(URE_TYPES)" -br "$(URE_SERVICES)" -r $@ \ 297 -c $(URLPREFIX)$(cwd)/out.sdk/javatest.uno.jar 298 299 300out.sdk: 301 $(MKDIR) $(subst /,$(PS),$@) 302 303out.sdk/class: | out.sdk 304 $(MKDIR) $(subst /,$(PS),$@) 305