1 #*************************************************************************
3 # The Contents of this file are made available subject to the terms of
6 # Copyright 2000, 2010 Oracle and/or its affiliates.
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
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++ counter example of the SDK.
38 SETTINGS
=$(PRJ
)/settings
40 include $(SETTINGS
)/settings.mk
41 include $(SETTINGS
)/std.mk
43 # Define non-platform/compiler specific settings
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 OUT_COMP_INC
= $(OUT_INC
)/$(COMP_NAME
)
50 OUT_COMP_GEN
= $(OUT_MISC
)/$(COMP_NAME
)
51 OUT_COMP_OBJ
= $(OUT_OBJ
)/$(COMP_NAME
)
52 OUT_COMP_SLO
= $(OUT_SLO
)/$(COMP_NAME
)
53 COMP_SERVICES
=$(SHAREDLIB_OUT
)/counterservices.rdb
55 ENV_EXAMPLE_TYPES
=-env
:URE_MORE_TYPES
=$(URLPREFIX
)$(COMP_RDB
)
56 ENV_COMP_SERVICES
=-env
:URE_MORE_SERVICES
=$(URLPREFIX
)$(COMP_SERVICES
)
58 COMP_TYPEFLAG
= $(OUT_MISC
)/cpp_
$(COMP_NAME
)_types.flag
60 IDLFILES
= XCountable.idl
62 COMPCXXFILES
= counter.
cxx
64 CXXFILES
= countermain.
cxx
66 SLOFILES
= $(patsubst %.
cxx,$(OUT_COMP_SLO
)/%.
$(OBJ_EXT
),$(COMPCXXFILES
))
67 OBJFILES
= $(patsubst %.
cxx,$(OUT_COMP_SLO
)/%.
$(OBJ_EXT
),$(CXXFILES
))
69 TYPESLIST
= -Tfoo.XCountable
76 include $(SETTINGS
)/stdtarget.mk
78 $(OUT_BIN
)/%.rdb
: $(IDLFILES
)
79 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
80 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
81 $(UNOIDLWRITE
) $(URE_TYPES
) $(OFFICE_TYPES
) $< $@
83 $(COMP_TYPEFLAG
) : $(COMP_RDB
) $(SDKTYPEFLAG
)
84 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
85 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_TYPEFLAG
)))
86 $(CPPUMAKER
) -Gc
-O
$(OUT_COMP_INC
) $(TYPESLIST
) $(COMP_RDB
) -X
$(URE_TYPES
)
89 $(OUT_COMP_OBJ
)/%.
$(OBJ_EXT
) : %.
cxx $(COMP_TYPEFLAG
)
90 -$(MKDIR
) $(subst /,$(PS
),$(OUT_OBJ
))
91 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
92 $(CC
) $(CC_FLAGS
) $(CC_INCLUDES
) -I
$(OUT_COMP_INC
) $(CC_DEFINES
) $(CC_OUTPUT_SWITCH
)$(subst /,$(PS
),$@
) $<
94 $(OUT_COMP_SLO
)/%.
$(OBJ_EXT
) : %.
cxx $(COMP_TYPEFLAG
)
95 -$(MKDIR
) $(subst /,$(PS
),$(OUT_SLO
))
96 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
97 $(CC
) $(CC_FLAGS
) $(CC_INCLUDES
) -I
$(OUT_COMP_INC
) $(CC_DEFINES
) $(CC_OUTPUT_SWITCH
)$(subst /,$(PS
),$@
) $<
100 $(SHAREDLIB_OUT
)/%.
$(SHAREDLIB_EXT
) : $(SLOFILES
)
101 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
102 -$(MKDIR
) $(subst /,$(PS
),$(OUT_COMP_GEN
))
103 $(LINK
) $(COMP_LINK_FLAGS
) /OUT
:$@ \
104 /MAP
:$(OUT_COMP_GEN
)/$(subst $(SHAREDLIB_EXT
),map
,$(@F
)) $(SLOFILES
) \
105 $(CPPUHELPERLIB
) $(CPPULIB
) $(SALLIB
) msvcprt.lib
$(LIBO_SDK_LDFLAGS_STDLIBS
)
108 $(SHAREDLIB_OUT
)/%.
$(SHAREDLIB_EXT
) : $(SLOFILES
)
109 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
110 $(LINK
) $(COMP_LINK_FLAGS
) $(LINK_LIBS
) -o
$@
$(SLOFILES
) \
111 $(CPPUHELPERLIB
) $(CPPULIB
) $(SALLIB
) $(STC
++LIB
)
112 ifeq "$(OS)" "MACOSX"
113 $(INSTALL_NAME_URELIBS
) $@
117 $(OUT_BIN
)/countermain
$(EXE_EXT
) : $(OUT_COMP_OBJ
)/countermain.
$(OBJ_EXT
) $(SHAREDLIB_OUT
)/counter.uno.
$(SHAREDLIB_EXT
)
119 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
120 $(LINK
) $(EXE_LINK_FLAGS
) /OUT
:$@
/MAP
:$(OUT_COMP_GEN
)/$(basename $(@F
)).map \
121 $< $(CPPUHELPERLIB
) $(CPPULIB
) $(SALHELPERLIB
) $(SALLIB
)
123 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
124 $(LINK
) $(EXE_LINK_FLAGS
) $(LINK_LIBS
) -o
$@
$< \
125 $(CPPUHELPERLIB
) $(CPPULIB
) $(SALHELPERLIB
) $(SALLIB
) $(STDC
++LIB
)
129 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
130 @echo
$(OSEP
)?xml version
="$(QM)1.0$(QM)" encoding
="$(QM)UTF-8$(QM)"?
$(CSEP
) > $@
131 @echo
$(OSEP
)components xmlns
="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP
) >> $@
132 @echo
$(SQM
) $(SQM
)$(OSEP
)component loader
="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri
="$(QM)$(COMP_IMPL_NAME)$(QM)"$(CSEP
) >> $@
133 @echo
$(SQM
) $(SQM
)$(OSEP
)implementation name
="$(QM)com.sun.star.comp.example.cpp.Counter$(QM)"$(CSEP
) >> $@
134 @echo
$(SQM
) $(SQM
)$(OSEP
)service name
="$(QM)foo.Counter$(QM)"/$(CSEP
) >> $@
135 @echo
$(SQM
) $(SQM
)$(OSEP
)/implementation
$(CSEP
) >> $@
136 @echo
$(SQM
) $(SQM
)$(OSEP
)/component
$(CSEP
) >> $@
137 @echo
$(OSEP
)/components
$(CSEP
) >> $@
140 CppCounterExample
: $(OUT_BIN
)/countermain
$(EXE_EXT
) $(COMP_IMPL
) $(COMP_SERVICES
)
141 @echo
--------------------------------------------------------------------------------
142 @echo Please use the following command to execute the example
!
144 @echo
$(MAKE
) countermain.run
146 @echo NOTE
: The example makes use of the URE and use the defaultBootstrap_InitialComponentContext method.
147 @echo
$(SQM
) $(SQM
)The additional example IDL types are provided via the UNO environment variable
-env
:URE_MORE_TYPES
=...
148 @echo
$(SQM
) $(SQM
)and the example component is made available via
-env
:URE_MORE_SERVICES
=...
149 @echo
$(SQM
) $(SQM
)Please
check the generated
$(QM
)$(COMP_SERVICES
)$(QM
) to see how you can specify your own components in such an environment
150 @echo
$(SQM
) $(SQM
)and how to use the passive UNO registration.
151 @echo
--------------------------------------------------------------------------------
153 %.run
: $(OUT_BIN
)/countermain
$(EXE_EXT
) $(COMP_IMPL
)
154 cd
$(subst /,$(PS
),$(OUT_BIN
)) && $(basename $@
) $(ENV_EXAMPLE_TYPES
) $(ENV_COMP_SERVICES
)
158 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_INC
))
159 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_GEN
))
160 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_OBJ
))
161 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_SLO
))
162 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_TYPEFLAG
)))
163 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_RDB
)))
164 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(SHAREDLIB_OUT
)/$(COMP_NAME
).
*))
165 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(OUT_BIN
)/countermain
*))
166 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_SERVICES
)))