Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / odk / examples / cpp / remoteclient / Makefile
blob238ec3ca2a748c9ddc7b667069a3be17cbfa2717
1 #*************************************************************************
3 # The Contents of this file are made available subject to the terms of
4 # the BSD license.
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 C++ remoteclient example of the SDK.
37 PRJ=../../..
38 SETTINGS=$(PRJ)/settings
40 include $(SETTINGS)/settings.mk
41 include $(SETTINGS)/std.mk
43 # Define non-platform/compiler specific settings
44 COMP_NAME=remoteclientsample
45 COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT)
46 COMP_IMPL=$(SHAREDLIB_OUT)/$(COMP_IMPL_NAME)
47 COMP_RDB_NAME = $(COMP_NAME).uno.rdb
48 COMP_RDB = $(OUT_BIN)/$(COMP_RDB_NAME)
49 COMP_SERVICES=$(SHAREDLIB_OUT)/remoteclientsample.rdb
51 ENV_COMP_SERVICES=-env:URE_MORE_SERVICES=$(URLPREFIX)$(COMP_SERVICES)
53 OUT_COMP_INC=$(OUT_INC)/$(COMP_NAME)
54 OUT_COMP_GEN=$(OUT_MISC)/$(COMP_NAME)
55 OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME)
57 COMP_TYPEFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_types.flag
59 CXXFILES = remoteclient.cxx
61 SLOFILES = $(patsubst %.cxx,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(CXXFILES))
63 # Targets
64 .PHONY: ALL
65 ALL : \
66 CppClientExample
68 include $(SETTINGS)/stdtarget.mk
70 # This example type library will be extended by the URE types
71 $(OUT_BIN)/%.rdb :
72 -$(MKDIR) $(subst /,$(PS),$(@D))
73 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
74 $(REGMERGE) $@ / $(URE_TYPES)
76 $(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG)
77 -$(MKDIR) $(subst /,$(PS),$(@D))
78 $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
80 ifeq "$(OS)" "WIN"
81 $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES)
82 -$(MKDIR) $(subst /,$(PS),$(@D))
83 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN))
84 $(LINK) $(COMP_LINK_FLAGS) /OUT:$@ \
85 /MAP:$(OUT_COMP_GEN)/$(subst $(SHAREDLIB_EXT),map,$(@F)) $(SLOFILES) \
86 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) msvcprt.lib $(LIBO_SDK_LDFLAGS_STDLIBS)
87 $(LINK_MANIFEST)
88 else
89 $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES)
90 -$(MKDIR) $(subst /,$(PS),$(@D))
91 $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \
92 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STC++LIB)
93 ifeq "$(OS)" "MACOSX"
94 $(INSTALL_NAME_URELIBS) $@
95 endif
96 endif
98 $(COMP_SERVICES) :
99 -$(MKDIR) $(subst /,$(PS),$(@D))
100 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
101 @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@
102 @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@
103 @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)com.sun.star.comp.product.example.RemoteClientSample$(QM)"$(CSEP) >> $@
104 @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)com.sun.star.bridge.example.RemoteClientSample$(QM)"/$(CSEP) >> $@
105 @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@
106 @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@
107 @echo $(OSEP)/components$(CSEP) >> $@
110 #CppClientExample : $(COMP_IMPL) $(COMP_ENV_FLAG)
111 CppClientExample : $(COMP_IMPL) $(COMP_SERVICES)
112 @echo --------------------------------------------------------------------------------
113 @echo The remoteclient C++ component can be used by using the uno binary. Use the
114 @echo the following command to start the example. The run target starts a remote
115 @echo server and connect with the client to this server.
116 @echo -
117 @echo $(MAKE) remoteclient.run
118 @echo -
119 @echo NOTE: The example uses the $(QM)uno$(QM) tool to prepare a working UNO environment.
120 @echo $(SQM) $(SQM)The example component is made available via -env:URE_MORE_SERVICES=...
121 @echo $(SQM) $(SQM)Please check the generated $(QM)$(COMP_SERVICES)$(QM) to see how you can specify your own components in such an environment
122 @echo $(SQM) $(SQM)and how to use the passive UNO registration.
123 @echo --------------------------------------------------------------------------------
125 %.run: $(COMP_IMPL)
126 @echo Start the remote server process ...
127 @echo -
128 ifeq "$(OS)" "WIN"
129 start uno $(ENV_COMP_SERVICES) --singleaccept -s com.sun.star.io.Pipe \
130 -u "uno:socket,host=localhost,port=2083;urp;MyPipe"
131 else
132 uno $(ENV_COMP_SERVICES) --singleaccept -s com.sun.star.io.Pipe \
133 -u "uno:socket,host=localhost,port=2083;urp;MyPipe" &
134 @echo waiting on the server process ...
135 sleep 5
136 endif
137 @echo -
138 @echo ... remote server process runs ...
139 @echo -
140 @echo Start remote client process ...
141 @echo -
142 uno $(ENV_COMP_SERVICES) -s com.sun.star.bridge.example.RemoteClientSample \
143 -- "uno:socket,host=localhost,port=2083;urp;MyPipe"
144 @echo -
146 .PHONY: clean
147 clean :
148 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC))
149 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN))
150 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO))
151 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_TYPEFLAG)))
152 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_SERVICES)))
153 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*))
154 # -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/remoteserver.rdb))