cid#1607171 Data race condition
[LibreOffice.git] / odk / examples / cpp / remoteclient / Makefile
blob956243a5d452ab0953a54058740b42ce396a4ee1
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_SERVICES=$(SHAREDLIB_OUT)/remoteclientsample.rdb
49 ENV_COMP_SERVICES=-env:URE_MORE_SERVICES=$(URLPREFIX)$(COMP_SERVICES)
51 OUT_COMP_INC=$(OUT_INC)/$(COMP_NAME)
52 OUT_COMP_GEN=$(OUT_MISC)/$(COMP_NAME)
53 OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME)
55 COMP_TYPEFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_types.flag
57 CXXFILES = remoteclient.cxx
59 SLOFILES = $(patsubst %.cxx,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(CXXFILES))
61 # Targets
62 .PHONY: ALL
63 ALL : \
64 CppClientExample
66 include $(SETTINGS)/stdtarget.mk
68 $(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG)
69 -$(MKDIR) $(subst /,$(PS),$(@D))
70 $(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
72 ifeq "$(OS)" "WIN"
73 $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES)
74 -$(MKDIR) $(subst /,$(PS),$(@D))
75 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN))
76 $(LINK) $(COMP_LINK_FLAGS) /OUT:$@ \
77 /MAP:$(OUT_COMP_GEN)/$(subst $(SHAREDLIB_EXT),map,$(@F)) $(SLOFILES) \
78 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) msvcprt.lib $(LIBO_SDK_LDFLAGS_STDLIBS)
79 $(LINK_MANIFEST)
80 else
81 $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES)
82 -$(MKDIR) $(subst /,$(PS),$(@D))
83 $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \
84 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STC++LIB)
85 ifeq "$(OS)" "MACOSX"
86 $(INSTALL_NAME_URELIBS) $@
87 endif
88 endif
90 $(COMP_SERVICES) :
91 -$(MKDIR) $(subst /,$(PS),$(@D))
92 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
93 @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@
94 @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@
95 @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)com.sun.star.comp.product.example.RemoteClientSample$(QM)"$(CSEP) >> $@
96 @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)com.sun.star.bridge.example.RemoteClientSample$(QM)"/$(CSEP) >> $@
97 @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@
98 @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@
99 @echo $(OSEP)/components$(CSEP) >> $@
102 #CppClientExample : $(COMP_IMPL) $(COMP_ENV_FLAG)
103 CppClientExample : $(COMP_IMPL) $(COMP_SERVICES)
104 @echo --------------------------------------------------------------------------------
105 @echo The remoteclient C++ component can be used by using the uno binary. Use the
106 @echo the following command to start the example. The run target starts a remote
107 @echo server and connect with the client to this server.
108 @echo -
109 @echo $(MAKE) remoteclient.run
110 @echo -
111 @echo NOTE: The example uses the $(QM)uno$(QM) tool to prepare a working UNO environment.
112 @echo $(SQM) $(SQM)The example component is made available via -env:URE_MORE_SERVICES=...
113 @echo $(SQM) $(SQM)Please check the generated $(QM)$(COMP_SERVICES)$(QM) to see how you can specify your own components in such an environment
114 @echo $(SQM) $(SQM)and how to use the passive UNO registration.
115 @echo --------------------------------------------------------------------------------
117 %.run: $(COMP_IMPL)
118 @echo Start the remote server process ...
119 @echo -
120 ifeq "$(OS)" "WIN"
121 start uno $(ENV_COMP_SERVICES) --singleaccept -s com.sun.star.io.Pipe \
122 -u "uno:socket,host=localhost,port=2083;urp;MyPipe"
123 else
124 uno $(ENV_COMP_SERVICES) --singleaccept -s com.sun.star.io.Pipe \
125 -u "uno:socket,host=localhost,port=2083;urp;MyPipe" &
126 @echo waiting on the server process ...
127 sleep 5
128 endif
129 @echo -
130 @echo ... remote server process runs ...
131 @echo -
132 @echo Start remote client process ...
133 @echo -
134 uno $(ENV_COMP_SERVICES) -s com.sun.star.bridge.example.RemoteClientSample \
135 -- "uno:socket,host=localhost,port=2083;urp;MyPipe"
136 @echo -
138 .PHONY: clean
139 clean :
140 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC))
141 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN))
142 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO))
143 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_TYPEFLAG)))
144 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_SERVICES)))
145 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*))
146 # -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/remoteserver.rdb))