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 complextoolbarcontrols C++ component example of the SDK.
38 SETTINGS
=$(PRJ
)/settings
40 include $(SETTINGS
)/settings.mk
41 include $(SETTINGS
)/std.mk
42 include $(SETTINGS
)/platform.mk
44 # Define non-platform/compiler specific settings
45 COMP_NAME
=complextoolbarcontrols
46 COMP_IMPL_NAME
=$(COMP_NAME
).uno.
$(SHAREDLIB_EXT
)
47 OUT_COMP_INC
=$(OUT_INC
)/$(COMP_NAME
)
48 OUT_COMP_GEN
=$(OUT_MISC
)/$(COMP_NAME
)
49 OUT_COMP_SLO
=$(OUT_SLO
)/$(COMP_NAME
)
50 COMP_PACKAGE
= $(OUT_BIN
)/$(COMP_NAME
).
$(UNOOXT_EXT
)
51 COMP_PACKAGE_URL
= $(subst \\,\
,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
52 COMP_UNOPKG_MANIFEST
= $(OUT_COMP_GEN
)/$(COMP_NAME
)/META-INF
/manifest.xml
53 COMP_UNOPKG_DESCRIPTION
= $(OUT_COMP_GEN
)/$(COMPONENT_NAME
)/description.xml
54 COMP_COMPONENTS
= $(OUT_COMP_GEN
)/$(COMP_NAME
).components
55 COMP_REGISTERFLAG
= $(OUT_MISC
)/cpp_
$(COMP_NAME
)_register_component.flag
56 COMP_TYPEFLAG
= $(OUT_MISC
)/cpp_
$(COMP_NAME
)_types.flag
59 MyProtocolHandler.
cxx \
67 SLOFILES
= $(patsubst %.
cxx,$(OUT_COMP_SLO
)/%.
$(OBJ_EXT
),$(CXXFILES
))
75 include $(SETTINGS
)/stdtarget.mk
77 $(OUT_COMP_SLO
)/%.
$(OBJ_EXT
) : %.
cxx $(SDKTYPEFLAG
)
78 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
79 $(CC
) $(CC_FLAGS
) $(STL_INCLUDES
) $(CC_INCLUDES
) -I
$(OUT_COMP_INC
) $(CC_DEFINES
) $(CC_OUTPUT_SWITCH
)$(subst /,$(PS
),$@
) $<
83 $(SHAREDLIB_OUT
)/%.
$(SHAREDLIB_EXT
) : $(SLOFILES
)
84 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
85 -$(MKDIR
) $(subst /,$(PS
),$(OUT_COMP_GEN
))
86 $(LINK
) $(COMP_LINK_FLAGS
) /OUT
:$@ \
87 /MAP
:$(OUT_COMP_GEN
)/$(subst $(SHAREDLIB_EXT
),map
,$(@F
)) $(SLOFILES
) \
88 $(CPPUHELPERLIB
) $(CPPULIB
) $(SALLIB
) msvcprt.lib
$(LIBO_SDK_LDFLAGS_STDLIBS
)
91 $(SHAREDLIB_OUT
)/%.
$(SHAREDLIB_EXT
) : $(SLOFILES
)
92 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
93 $(LINK
) $(COMP_LINK_FLAGS
) $(LINK_LIBS
) -o
$@
$(SLOFILES
) \
94 $(CPPUHELPERLIB
) $(CPPULIB
) $(SALLIB
) $(STC
++LIB
)
96 $(INSTALL_NAME_URELIBS
) $@
100 # rule for extension description.xml
101 $(COMP_UNOPKG_DESCRIPTION
) : description.xml
102 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
103 $(SDK_CAT
) $< |
$(SDK_SED
) -e
"s/#EXTENSION_PLATFORM#/$(EXTENSION_PLATFORM)/" > $@
105 # rule for component package manifest
106 $(OUT_COMP_GEN
)/%/manifest.xml
:
107 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
108 @echo
$(OSEP
)?xml version
="$(QM)1.0$(QM)" encoding
="$(QM)UTF-8$(QM)"?
$(CSEP
) > $@
109 @echo
$(OSEP
)!DOCTYPE manifest
:manifest PUBLIC
"$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP
) >> $@
110 @echo
$(OSEP
)manifest
:manifest xmlns
:manifest
="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP
) >> $@
111 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
112 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)Addons.xcu$(QM)"/$(CSEP
) >> $@
113 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
114 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)WriterWindowState.xcu$(QM)"/$(CSEP
) >> $@
115 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
116 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)CalcWindowState.xcu$(QM)"/$(CSEP
) >> $@
117 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
118 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)ProtocolHandler.xcu$(QM)"/$(CSEP
) >> $@
119 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.uno-components;platform=$(UNOPKG_PLATFORM)$(QM)">> $@
120 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP
)>> $@
122 # @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@
123 # @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_GEN)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@
124 @echo
$(OSEP
)/manifest
:manifest
$(CSEP
) >> $@
127 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
128 @echo
$(OSEP
)?xml version
="$(QM)1.0$(QM)" encoding
="$(QM)UTF-8$(QM)"?
$(CSEP
) > $@
129 @echo
$(OSEP
)components xmlns
="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP
) >> $@
130 @echo
$(SQM
) $(SQM
)$(OSEP
)component loader
="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri
="$(QM)$(UNOPKG_PLATFORM)/$(COMP_IMPL_NAME)$(QM)"$(CSEP
) >> $@
131 @echo
$(SQM
) $(SQM
)$(OSEP
)implementation name
="$(QM)vnd.My.impl.NewDocListener$(QM)"$(CSEP
) >> $@
132 @echo
$(SQM
) $(SQM
)$(OSEP
)service name
="$(QM)vnd.My.NewDocListener$(QM)"/$(CSEP
) >> $@
133 @echo
$(SQM
) $(SQM
)$(OSEP
)/implementation
$(CSEP
) >> $@
134 @echo
$(SQM
) $(SQM
)$(OSEP
)implementation name
="$(QM)vnd.demo.Impl.ProtocolHandler$(QM)"$(CSEP
) >> $@
135 @echo
$(SQM
) $(SQM
)$(OSEP
)service name
="$(QM)vnd.demo.ProtocolHandler$(QM)"/$(CSEP
) >> $@
136 @echo
$(SQM
) $(SQM
)$(OSEP
)/implementation
$(CSEP
) >> $@
137 @echo
$(SQM
) $(SQM
)$(OSEP
)/component
$(CSEP
) >> $@
138 @echo
$(OSEP
)/components
$(CSEP
) >> $@
140 # rule for component package file
141 $(COMP_PACKAGE
) : $(SHAREDLIB_OUT
)/$(COMP_IMPL_NAME
) Addons.xcu ProtocolHandler.xcu WriterWindowState.xcu CalcWindowState.xcu
$(COMP_UNOPKG_MANIFEST
) $(COMP_COMPONENTS
) $(COMP_UNOPKG_DESCRIPTION
)
142 -$(MKDIR
) $(subst /,$(PS
),$(@D
)) && $(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
143 -$(MKDIR
) $(subst /,$(PS
),$(OUT_COMP_GEN
)/$(UNOPKG_PLATFORM
))
144 $(COPY
) $(subst /,$(PS
),$<) $(subst /,$(PS
),$(OUT_COMP_GEN
)/$(UNOPKG_PLATFORM
))
145 $(CD
) $(subst /,$(PS
),$(OUT_COMP_GEN
)) && $(SDK_ZIP
) -u ..
/..
/bin
/$(@F
) $(COMP_NAME
).components description.xml
146 $(CD
) $(subst /,$(PS
),$(OUT_COMP_GEN
)) && $(SDK_ZIP
) -u ..
/..
/bin
/$(@F
) $(UNOPKG_PLATFORM
)/$(<F
)
147 $(SDK_ZIP
) -u
$@ Addons.xcu ProtocolHandler.xcu WriterWindowState.xcu CalcWindowState.xcu logo_small.png logo_big.png
148 $(CD
) $(subst /,$(PS
),$(OUT_COMP_GEN
)/$(subst .
$(UNOOXT_EXT
),,$(@F
))) && $(SDK_ZIP
) -u ..
/..
/..
/bin
/$(@F
) META-INF
/manifest.xml
150 $(COMP_REGISTERFLAG
) : $(COMP_PACKAGE
)
151 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
152 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
153 $(DEPLOYTOOL
) $(COMP_PACKAGE_URL
)
154 @echo flagged
> $(subst /,$(PS
),$@
)
156 @echo
--------------------------------------------------------------------------------
157 @echo If you want to
install your component automatically
, please set the environment
158 @echo variable SDK_AUTO_DEPLOYMENT
= YES. But note that auto deployment is only
159 @echo possible if no office instance is running.
160 @echo
--------------------------------------------------------------------------------
163 Example
: $(COMP_REGISTERFLAG
)
164 @echo
--------------------------------------------------------------------------------
165 @echo The
"$(QM)ProtocolHandler$(QM)" addon component was installed if SDK_AUTO_DEPLOYMENT
= YES.
166 @echo You can use this component inside your office installation
, see the example
168 @echo
--------------------------------------------------------------------------------
170 run
: $(COMP1_COMP_REGISTERFLAG
)
171 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" --writer
176 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_INC
))
177 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_GEN
))
178 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_SLO
))
179 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_PACKAGE_URL
)))
180 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_REGISTERFLAG
)))
181 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_TYPEFLAG
)))
182 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(SHAREDLIB_OUT
)/$(COMP_NAME
).
*))