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 GENURDFILES
= $(patsubst %.idl
,$(OUT_COMP_GEN
)/%.urd
,$(IDLFILES
))
71 TYPESLIST
= -Tfoo.XCountable
78 include $(SETTINGS
)/stdtarget.mk
80 $(OUT_COMP_GEN
)/%.urd
: %.idl
81 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
82 $(IDLC
) -I.
-I
$(IDL_DIR
) -O
$(OUT_COMP_GEN
) $<
84 # This example type library will be extended by the URE types
85 $(OUT_BIN
)/%.rdb
: $(GENURDFILES
)
86 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
87 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
88 $(REGMERGE
) $@
/UCR
$(GENURDFILES
)
89 # $(REGMERGE) $@ / $(URE_TYPES)
91 $(COMP_TYPEFLAG
) : $(COMP_RDB
) $(SDKTYPEFLAG
)
92 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
93 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_TYPEFLAG
)))
94 $(CPPUMAKER
) -Gc
-O
$(OUT_COMP_INC
) $(TYPESLIST
) $(COMP_RDB
) -X
$(URE_TYPES
)
97 $(OUT_COMP_OBJ
)/%.
$(OBJ_EXT
) : %.
cxx $(COMP_TYPEFLAG
)
98 -$(MKDIR
) $(subst /,$(PS
),$(OUT_OBJ
))
99 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
100 $(CC
) $(CC_FLAGS
) $(CC_INCLUDES
) -I
$(OUT_COMP_INC
) $(CC_DEFINES
) $(CC_OUTPUT_SWITCH
)$(subst /,$(PS
),$@
) $<
102 $(OUT_COMP_SLO
)/%.
$(OBJ_EXT
) : %.
cxx $(COMP_TYPEFLAG
)
103 -$(MKDIR
) $(subst /,$(PS
),$(OUT_SLO
))
104 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
105 $(CC
) $(CC_FLAGS
) $(CC_INCLUDES
) -I
$(OUT_COMP_INC
) $(CC_DEFINES
) $(CC_OUTPUT_SWITCH
)$(subst /,$(PS
),$@
) $<
108 $(SHAREDLIB_OUT
)/%.
$(SHAREDLIB_EXT
) : $(SLOFILES
)
109 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
110 -$(MKDIR
) $(subst /,$(PS
),$(OUT_COMP_GEN
))
111 $(LINK
) $(COMP_LINK_FLAGS
) /OUT
:$@ \
112 /MAP
:$(OUT_COMP_GEN
)/$(subst $(SHAREDLIB_EXT
),map
,$(@F
)) $(SLOFILES
) \
113 $(CPPUHELPERLIB
) $(CPPULIB
) $(SALLIB
) msvcprt.lib
$(LIBO_SDK_LDFLAGS_STDLIBS
)
116 $(SHAREDLIB_OUT
)/%.
$(SHAREDLIB_EXT
) : $(SLOFILES
)
117 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
118 $(LINK
) $(COMP_LINK_FLAGS
) $(LINK_LIBS
) -o
$@
$(SLOFILES
) \
119 $(CPPUHELPERLIB
) $(CPPULIB
) $(SALLIB
) $(STC
++LIB
)
120 ifeq "$(OS)" "MACOSX"
121 $(INSTALL_NAME_URELIBS
) $@
125 $(OUT_BIN
)/countermain
$(EXE_EXT
) : $(OUT_COMP_OBJ
)/countermain.
$(OBJ_EXT
) $(SHAREDLIB_OUT
)/counter.uno.
$(SHAREDLIB_EXT
)
127 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
128 $(LINK
) $(EXE_LINK_FLAGS
) /OUT
:$@
/MAP
:$(OUT_COMP_GEN
)/$(basename $(@F
)).map \
129 $< $(CPPUHELPERLIB
) $(CPPULIB
) $(SALHELPERLIB
) $(SALLIB
)
131 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
132 $(LINK
) $(EXE_LINK_FLAGS
) $(LINK_LIBS
) -o
$@
$< \
133 $(CPPUHELPERLIB
) $(CPPULIB
) $(SALHELPERLIB
) $(SALLIB
) $(STDC
++LIB
)
137 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
138 @echo
$(OSEP
)?xml version
="$(QM)1.0$(QM)" encoding
="$(QM)UTF-8$(QM)"?
$(CSEP
) > $@
139 @echo
$(OSEP
)components xmlns
="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP
) >> $@
140 @echo
$(SQM
) $(SQM
)$(OSEP
)component loader
="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri
="$(QM)$(COMP_IMPL_NAME)$(QM)"$(CSEP
) >> $@
141 @echo
$(SQM
) $(SQM
)$(OSEP
)implementation name
="$(QM)com.sun.star.comp.example.cpp.Counter$(QM)"$(CSEP
) >> $@
142 @echo
$(SQM
) $(SQM
)$(OSEP
)service name
="$(QM)foo.Counter$(QM)"/$(CSEP
) >> $@
143 @echo
$(SQM
) $(SQM
)$(OSEP
)/implementation
$(CSEP
) >> $@
144 @echo
$(SQM
) $(SQM
)$(OSEP
)/component
$(CSEP
) >> $@
145 @echo
$(OSEP
)/components
$(CSEP
) >> $@
148 CppCounterExample
: $(OUT_BIN
)/countermain
$(EXE_EXT
) $(COMP_IMPL
) $(COMP_SERVICES
)
149 @echo
--------------------------------------------------------------------------------
150 @echo Please use the following command to execute the example
!
152 @echo
$(MAKE
) countermain.run
154 @echo NOTE
: The example makes use of the URE and use the defaultBootstrap_InitialComponentContext method.
155 @echo
$(SQM
) $(SQM
)The additional example IDL types are provided via the UNO environment variable
-env
:URE_MORE_TYPES
=...
156 @echo
$(SQM
) $(SQM
)and the example component is made available via
-env
:URE_MORE_SERVICES
=...
157 @echo
$(SQM
) $(SQM
)Please
check the generated
$(QM
)$(COMP_SERVICES
)$(QM
) to see how you can specify your own components in such an environment
158 @echo
$(SQM
) $(SQM
)and how to use the passive UNO registration.
159 @echo
--------------------------------------------------------------------------------
161 %.run
: $(OUT_BIN
)/countermain
$(EXE_EXT
) $(COMP_IMPL
)
162 cd
$(subst /,$(PS
),$(OUT_BIN
)) && $(basename $@
) $(ENV_EXAMPLE_TYPES
) $(ENV_COMP_SERVICES
)
166 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_INC
))
167 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_GEN
))
168 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_OBJ
))
169 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_SLO
))
170 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_TYPEFLAG
)))
171 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_RDB
)))
172 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(SHAREDLIB_OUT
)/$(COMP_NAME
).
*))
173 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(OUT_BIN
)/countermain
*))
174 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_SERVICES
)))