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 # Builds the C++ DocumentLoader example of the SDK.
23 
24 PRJ=../../..
25 SETTINGS=$(PRJ)/settings
26 
27 include $(SETTINGS)/settings.mk
28 include $(SETTINGS)/std.mk
29 include $(SETTINGS)/dk.mk
30 
31 # Define non-platform/compiler specific settings
32 COMPONENT_NAME=DocumentLoader
33 
34 OUT_COMP_INC = $(OUT_INC)/$(COMPONENT_NAME)
35 OUT_COMP_GEN = $(OUT_MISC)/$(COMPONENT_NAME)
36 OUT_COMP_OBJ=$(OUT_OBJ)/$(COMPONENT_NAME)
37 
38 CXXFILES = DocumentLoader.cxx
39 
40 OBJFILES = $(patsubst %.cxx,$(OUT_SLO_COMP)/%.$(OBJ_EXT),$(CXXFILES))
41 
42 ENV_OFFICE_TYPES=-env:URE_MORE_TYPES=$(URLPREFIX)$(OFFICE_TYPES)
43 
44 # Targets
45 .PHONY: ALL
46 ALL : \
47 	CppDocumentLoaderExample
48 
49 include $(SETTINGS)/stdtarget.mk
50 
51 $(OUT_COMP_OBJ)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG)
52 	-$(MKDIR) $(subst /,$(PS),$(@D))
53 	$(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
54 
55 $(OUT_BIN)/DocumentLoader$(EXE_EXT) : $(OUT_COMP_OBJ)/DocumentLoader.$(OBJ_EXT)
56 	-$(MKDIR) $(subst /,$(PS),$(@D))
57 	-$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN))
58 ifeq "$(OS)" "WIN"
59 	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(OUT_COMP_GEN)/$(basename $(@F)).map \
60 	  $< $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB)
61 else
62 	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $< \
63 	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STLPORTLIB) $(STDC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALHELPERDYLIB) $(SALDYLIB)
64 ifeq "$(OS)" "MACOSX"
65 	$(INSTALL_NAME_URELIBS_BIN)  $@
66 endif
67 endif
68 
69 CppDocumentLoaderExample : $(OUT_BIN)/DocumentLoader$(EXE_EXT)
70 	@echo --------------------------------------------------------------------------------
71 	@echo The example loads the "$(QM)test.odt$(QM)" document in the DocumentLoader example directory.
72 	@echo If you want to load your own document, please use:
73 	@echo $(SQM)  $(SQM)DocumentLoader -env:URE_MORE_TYPES="$(QM)<fileurl_office_types_rdb>$(QM)" "$(QM)filename$(QM)" [connection_url]
74 	@echo -
75 	@echo Use the following command to execute the example!
76 	@echo -
77 	@echo $(MAKE) DocumentLoader.run
78 	@echo -
79 	@echo NOTE: This example does not use the new UNO bootstrap mechanism, it uses still a socket
80 	@echo $(SQM)      $(SQM)connection. The example use the defaultBootstrap_InitialComponentContext method and provides
81 	@echo $(SQM)      $(SQM)the additional office types via the UNO environment variable -env:URE_MORE_TYPES=...
82 	@echo $(SQM)      $(SQM)Before you can run this example you have to start your office in listening mode.
83 	@echo -
84 	@echo $(SQM)  $(SQM)soffice "$(QM)-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager$(QM)"
85 	@echo --------------------------------------------------------------------------------
86 
87 %.run: $(OUT_BIN)/DocumentLoader$(EXE_EXT)
88 	cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@) $(ENV_OFFICE_TYPES) $(subst \\,/,$(subst /,$(PS),"$(OO_SDK_HOME)/examples/cpp/DocumentLoader/test.odt"))
89 
90 .PHONY: clean
91 clean :
92 	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC))
93 	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN))
94 	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_OBJ))
95 	-$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/DocumentLoader*))
96