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 
37 PRJ=../../..
38 SETTINGS=$(PRJ)/settings
39 
40 include $(SETTINGS)/settings.mk
41 include $(SETTINGS)/std.mk
42 include $(SETTINGS)/dk.mk
43 
44 # Define non-platform/compiler specific settings
45 COMPONENT_NAME=DocumentLoader
46 
47 OUT_COMP_INC = $(OUT_INC)/$(COMPONENT_NAME)
48 OUT_COMP_GEN = $(OUT_MISC)/$(COMPONENT_NAME)
49 OUT_COMP_OBJ=$(OUT_OBJ)/$(COMPONENT_NAME)
50 
51 CXXFILES = DocumentLoader.cxx
52 
53 OBJFILES = $(patsubst %.cxx,$(OUT_SLO_COMP)/%.$(OBJ_EXT),$(CXXFILES))
54 
55 ENV_OFFICE_TYPES=-env:URE_MORE_TYPES=$(URLPREFIX)$(OFFICE_TYPES)
56 
57 # Targets
58 .PHONY: ALL
59 ALL : \
60 	CppDocumentLoaderExample
61 
62 include $(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))
71 ifeq "$(OS)" "WIN"
72 	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(OUT_COMP_GEN)/$(basename $(@F)).map \
73 	  $< $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)
74 else
75 	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $< \
76 	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALHELPERDYLIB) $(SALDYLIB)
77 ifeq "$(OS)" "MACOSX"
78 	$(INSTALL_NAME_URELIBS_BIN)  $@
79 endif
80 endif
81 
82 CppDocumentLoaderExample : $(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
104 clean :
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