Update git submodules
[LibreOffice.git] / odk / examples / DevelopersGuide / ProfUNO / CppBinding / Makefile
blob5e4a061381210d5a88c918f5016ef06b3ef8faad
1 #*************************************************************************
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.
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.
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.
33 #**************************************************************************
35 # Builds the ProfUNO cpp binding example of the Developers Guide
37 PRJ=../../../..
38 SETTINGS=$(PRJ)/settings
40 include $(SETTINGS)/settings.mk
41 include $(SETTINGS)/std.mk
43 # Define non-platform/compiler specific settings
44 SAMPLE_NAME=ProfUnoCppBinding
45 SAMPLE_INC_OUT = $(OUT_INC)/$(SAMPLE_NAME)
46 SAMPLE_GEN_OUT = $(OUT_MISC)/$(SAMPLE_NAME)
47 SAMPLE_OBJ_OUT=$(OUT_OBJ)/$(SAMPLE_NAME)
49 APP1_NAME=office_connect
50 APP1_BINARY=$(OUT_BIN)/$(APP1_NAME)$(EXE_EXT)
52 APP2_NAME=string_samples
53 APP2_BINARY=$(OUT_BIN)/$(APP2_NAME)$(EXE_EXT)
55 ENV_OFFICE_TYPES=-env:URE_MORE_TYPES=$(URLPREFIX)$(OFFICE_TYPES)
57 CXXFILES = \
58 office_connect.cxx \
59 string_samples.cxx
61 # Targets
62 .PHONY: ALL
63 ALL : \
64 ProUNOCppBindingExample
66 include $(SETTINGS)/stdtarget.mk
68 $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG)
69 -$(MKDIR) $(subst /,$(PS),$(@D))
70 $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(SAMPLE_INC_OUT) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
72 $(OUT_BIN)/%$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/%.$(OBJ_EXT)
73 -$(MKDIR) $(subst /,$(PS),$(@D))
74 -$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
75 ifeq "$(OS)" "WIN"
76 $(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(SAMPLE_GEN_OUT)/$(subst $(EXE_EXT),.map,$(@F)) \
77 $< $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB)
78 else
79 $(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $< \
80 $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STDC++LIB)
81 ifeq "$(OS)" "MACOSX"
82 $(INSTALL_NAME_URELIBS_BIN) $@
83 endif
84 endif
86 $(OUT_BIN)/office_connect$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/office_connect.$(OBJ_EXT)
88 $(OUT_BIN)/string_samples$(EXE_EXT) : $(SAMPLE_OBJ_OUT)/string_samples.$(OBJ_EXT)
90 ProUNOCppBindingExample : $(APP1_BINARY) $(APP2_BINARY)
91 @echo --------------------------------------------------------------------------------
92 @echo Note: For the "$(QM)$(APP1_NAME)$(QM)" example you need a running office listening
93 @echo $(SQM) $(SQM)on port 2083. 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 @echo Please use one of the following commands to execute the examples!
100 @echo -
101 @echo $(MAKE) $(APP1_NAME).run
102 @echo $(MAKE) $(APP2_NAME).run
103 @echo --------------------------------------------------------------------------------
105 %.run: $(OUT_BIN)/%$(EXE_EXT)
106 cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@)
108 $(API1_NAME).run: $(API1_BINARY)
109 cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@) $(ENV_OFFICE_TYPES)
111 .PHONY: clean
112 clean :
113 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_INC_OUT))
114 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
115 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_OBJ_OUT))
116 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/$(APP1_NAME)*))
117 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/$(APP2_NAME)*))