1#************************************************************************* 2# 3# The Contents of this file are made available subject to the terms of 4# the BSD license. 5# 6# Copyright 2000, 2010 Oracle and/or its affiliates. 7# All rights reserved. 8# 9# Redistribution and use in source and binary forms, with or without 10# modification, are permitted provided that the following conditions 11# are met: 12# 1. Redistributions of source code must retain the above copyright 13# notice, this list of conditions and the following disclaimer. 14# 2. Redistributions in binary form must reproduce the above copyright 15# notice, this list of conditions and the following disclaimer in the 16# documentation and/or other materials provided with the distribution. 17# 3. Neither the name of Sun Microsystems, Inc. nor the names of its 18# contributors may be used to endorse or promote products derived 19# from this software without specific prior written permission. 20# 21# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 28# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 30# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 31# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32# 33#************************************************************************** 34 35# Builds the C++ DocumentLoader example of the SDK. 36 37PRJ=../../.. 38SETTINGS=$(PRJ)/settings 39 40include $(SETTINGS)/settings.mk 41include $(SETTINGS)/std.mk 42include $(SETTINGS)/dk.mk 43 44# Define non-platform/compiler specific settings 45COMPONENT_NAME=DocumentLoader 46 47OUT_COMP_INC = $(OUT_INC)/$(COMPONENT_NAME) 48OUT_COMP_GEN = $(OUT_MISC)/$(COMPONENT_NAME) 49OUT_COMP_OBJ=$(OUT_OBJ)/$(COMPONENT_NAME) 50 51CXXFILES = DocumentLoader.cxx 52 53OBJFILES = $(patsubst %.cxx,$(OUT_SLO_COMP)/%.$(OBJ_EXT),$(CXXFILES)) 54 55ENV_OFFICE_TYPES=-env:URE_MORE_TYPES=$(URLPREFIX)$(OFFICE_TYPES) 56 57# Targets 58.PHONY: ALL 59ALL : \ 60 CppDocumentLoaderExample 61 62include $(SETTINGS)/stdtarget.mk 63 64$(OUT_COMP_OBJ)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) 65 -$(MKDIR) $(subst /,$(PS),$(@D)) 66 $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< 67 68$(OUT_BIN)/DocumentLoader$(EXE_EXT) : $(OUT_COMP_OBJ)/DocumentLoader.$(OBJ_EXT) 69 -$(MKDIR) $(subst /,$(PS),$(@D)) 70 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)) 71ifeq "$(OS)" "WIN" 72 $(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(OUT_COMP_GEN)/$(basename $(@F)).map \ 73 $< $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) 74else 75 $(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $< \ 76 $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALHELPERDYLIB) $(SALDYLIB) 77ifeq "$(OS)" "MACOSX" 78 $(INSTALL_NAME_URELIBS_BIN) $@ 79endif 80endif 81 82CppDocumentLoaderExample : $(OUT_BIN)/DocumentLoader$(EXE_EXT) 83 @echo -------------------------------------------------------------------------------- 84 @echo The example loads the "$(QM)test.odt$(QM)" document in the DocumentLoader example directory. 85 @echo If you want to load your own document, please use: 86 @echo $(SQM) $(SQM)DocumentLoader -env:URE_MORE_TYPES="$(QM)<fileurl_office_types_rdb>$(QM)" "$(QM)filename$(QM)" [connection_url] 87 @echo - 88 @echo Use the following command to execute the example! 89 @echo - 90 @echo $(MAKE) DocumentLoader.run 91 @echo - 92 @echo NOTE: This example does not use the new UNO bootstrap mechanism, it uses still a socket 93 @echo $(SQM) $(SQM)connection. The example use the defaultBootstrap_InitialComponentContext method and provides 94 @echo $(SQM) $(SQM)the additional office types via the UNO environment variable -env:URE_MORE_TYPES=... 95 @echo $(SQM) $(SQM)Before you can run this example you have to start your office in listening mode. 96 @echo - 97 @echo $(SQM) $(SQM)soffice "$(QM)-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager$(QM)" 98 @echo -------------------------------------------------------------------------------- 99 100%.run: $(OUT_BIN)/DocumentLoader$(EXE_EXT) 101 cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@) $(ENV_OFFICE_TYPES) $(subst \\,/,$(subst /,$(PS),"$(OO_SDK_HOME)/examples/cpp/DocumentLoader/test.odt")) 102 103.PHONY: clean 104clean : 105 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC)) 106 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) 107 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_OBJ)) 108 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/DocumentLoader*)) 109