xref: /AOO41X/main/odk/examples/DevelopersGuide/ProfUNO/CppBinding/Makefile (revision b597708ba18998e5b62934c916addb8de3415a8a)
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 ProfUNO cpp binding example of the Developers Guide
23
24PRJ=../../../..
25SETTINGS=$(PRJ)/settings
26
27include $(SETTINGS)/settings.mk
28include $(SETTINGS)/std.mk
29include $(SETTINGS)/dk.mk
30
31# Define non-platform/compiler specific settings
32SAMPLE_NAME=ProfUnoCppBinding
33SAMPLE_INC_OUT = $(OUT_INC)/$(SAMPLE_NAME)
34SAMPLE_GEN_OUT = $(OUT_MISC)/$(SAMPLE_NAME)
35SAMPLE_OBJ_OUT=$(OUT_OBJ)/$(SAMPLE_NAME)
36
37APP1_NAME=office_connect
38APP1_BINARY=$(OUT_BIN)/$(APP1_NAME)$(EXE_EXT)
39
40APP2_NAME=string_samples
41APP2_BINARY=$(OUT_BIN)/$(APP2_NAME)$(EXE_EXT)
42
43ENV_OFFICE_TYPES=-env:URE_MORE_TYPES=$(URLPREFIX)$(OFFICE_TYPES)
44
45CXXFILES = \
46     office_connect.cxx \
47     string_samples.cxx
48
49# Targets
50.PHONY: ALL
51ALL : \
52    ProUNOCppBindingExample
53
54include $(SETTINGS)/stdtarget.mk
55
56$(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG)
57    -$(MKDIR) $(subst /,$(PS),$(@D))
58    $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(SAMPLE_INC_OUT) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
59
60$(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)
61    -$(MKDIR) $(subst /,$(PS),$(@D))
62    -$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
63ifeq "$(OS)" "WIN"
64    $(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \
65      $< $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB)
66else
67    $(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $< \
68      $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STDC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALHELPERDYLIB) $(SALDYLIB)
69ifeq "$(OS)" "MACOSX"
70    $(INSTALL_NAME_URELIBS_BIN)  $@
71endif
72endif
73
74$(OUT_BIN)/office_connect$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/office_connect.$(OBJ_EXT)
75
76$(OUT_BIN)/string_samples$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/string_samples.$(OBJ_EXT)
77
78ProUNOCppBindingExample : $(APP1_BINARY) $(APP2_BINARY)
79    @echo --------------------------------------------------------------------------------
80    @echo Note: For the "$(QM)$(APP1_NAME)$(QM)" example you need a running office listening
81    @echo $(SQM)      $(SQM)on port 2083. The example use the defaultBootstrap_InitialComponentContext method and provides
82    @echo $(SQM)      $(SQM)the additional office types via the UNO environment variable -env:URE_MORE_TYPES=...
83    @echo $(SQM)      $(SQM)Before you can run this example you have to start your office in listening mode.
84    @echo -
85    @echo $(SQM)  $(SQM)soffice "$(QM)-accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager$(QM)"
86    @echo -----
87    @echo Please use one of the following commands to execute the examples!
88    @echo -
89    @echo $(MAKE) $(APP1_NAME).run
90    @echo $(MAKE) $(APP2_NAME).run
91    @echo --------------------------------------------------------------------------------
92
93%.run: $(OUT_BIN)/%$(EXE_EXT)
94    cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@)
95
96$(API1_NAME).run: $(API1_BINARY)
97    cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@) $(ENV_OFFICE_TYPES)
98
99.PHONY: clean
100clean :
101    -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_INC_OUT))
102    -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
103    -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_OBJ_OUT))
104    -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/$(APP1_NAME)*))
105    -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/$(APP2_NAME)*))
106