Update ooo320-m1
[ooovba.git] / odk / examples / cpp / complextoolbarcontrols / Makefile
blobe2eda4a5f532fb62cf06289e148c634539d69454
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.5 $
7 # last change: $Author: rt $ $Date: 2008-07-11 14:26:28 $
9 # The Contents of this file are made available subject to the terms of
10 # the BSD license.
12 # Copyright (c) 2003 by Sun Microsystems, Inc.
13 # All rights reserved.
15 # Redistribution and use in source and binary forms, with or without
16 # modification, are permitted provided that the following conditions
17 # are met:
18 # 1. Redistributions of source code must retain the above copyright
19 # notice, this list of conditions and the following disclaimer.
20 # 2. Redistributions in binary form must reproduce the above copyright
21 # notice, this list of conditions and the following disclaimer in the
22 # documentation and/or other materials provided with the distribution.
23 # 3. Neither the name of Sun Microsystems, Inc. nor the names of its
24 # contributors may be used to endorse or promote products derived
25 # from this software without specific prior written permission.
27 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
34 # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36 # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #**************************************************************************
41 # Builds the complextoolbarcontrols C++ component example of the SDK.
43 PRJ=../../..
44 SETTINGS=$(PRJ)/settings
46 include $(SETTINGS)/settings.mk
47 include $(SETTINGS)/std.mk
48 include $(SETTINGS)/dk.mk
50 # Define non-platform/compiler specific settings
51 COMP_NAME=complextoolbarcontrols
52 COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT)
53 OUT_COMP_INC=$(OUT_INC)/$(COMP_NAME)
54 OUT_COMP_GEN=$(OUT_MISC)/$(COMP_NAME)
55 OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME)
56 COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
57 COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
58 COMP_UNOPKG_MANIFEST = $(OUT_COMP_GEN)/$(COMP_NAME)/META-INF/manifest.xml
59 COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map
61 REGISTERFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_register_component.flag
62 COMP_TYPEFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_types.flag
64 CXXFILES = \
65 MyProtocolHandler.cxx \
66 MyJob.cxx \
67 MyListener.cxx \
68 WriterListener.cxx \
69 CalcListener.cxx \
70 ListenerHelper.cxx \
71 exports.cxx
73 SLOFILES = $(patsubst %.cxx,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(CXXFILES))
76 # Targets
77 .PHONY: ALL
78 ALL : \
79 Example
81 include $(SETTINGS)/stdtarget.mk
83 $(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG)
84 -$(MKDIR) $(subst /,$(PS),$(@D))
85 $(CC) $(CC_FLAGS) $(STL_INCLUDES) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
88 $(COMP_MAPFILE) : $(SLOFILES)
89 -$(MKDIR) $(subst /,$(PS),$(@D))
90 cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE)
91 ifeq "$(OS)" "MACOSX"
92 nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE)
93 endif
95 ifeq "$(OS)" "WIN"
96 $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES)
97 -$(MKDIR) $(subst /,$(PS),$(@D))
98 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN))
99 $(LINK) $(COMP_LINK_FLAGS) /OUT:$@ \
100 /MAP:$(OUT_COMP_GEN)/$(subst $(SHAREDLIB_EXT),map,$(@F)) $(SLOFILES) \
101 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) msvcrt.lib kernel32.lib
102 $(LINK_MANIFEST_VC8_ONLY)
103 else
104 $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE)
105 -$(MKDIR) $(subst /,$(PS),$(@D))
106 $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \
107 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB)
108 ifeq "$(OS)" "MACOSX"
109 $(INSTALL_NAME_URELIBS) $@
110 endif
111 endif
113 # rule for component package manifest
114 $(OUT_COMP_GEN)/%/manifest.xml :
115 -$(MKDIR) $(subst /,$(PS),$(@D))
116 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
117 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
118 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
119 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
120 @echo $(SQM) $(SQM)manifest:full-path="$(QM)Addons.xcu$(QM)"/$(CSEP) >> $@
121 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
122 @echo $(SQM) $(SQM)manifest:full-path="$(QM)WriterWindowState.xcu$(QM)"/$(CSEP) >> $@
123 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
124 @echo $(SQM) $(SQM)manifest:full-path="$(QM)CalcWindowState.xcu$(QM)"/$(CSEP) >> $@
125 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
126 @echo $(SQM) $(SQM)manifest:full-path="$(QM)ProtocolHandler.xcu$(QM)"/$(CSEP) >> $@
127 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@
128 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_GEN)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP) >> $@
129 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
131 # rule for component package file
132 $(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) Addons.xcu ProtocolHandler.xcu WriterWindowState.xcu CalcWindowState.xcu $(COMP_UNOPKG_MANIFEST)
133 -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@))
134 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM))
135 $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM))
136 cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F)
137 $(SDK_ZIP) -u $@ Addons.xcu ProtocolHandler.xcu WriterWindowState.xcu CalcWindowState.xcu logo_small.png logo_big.png
138 cd $(subst /,$(PS),$(OUT_COMP_GEN)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
140 $(REGISTERFLAG) : $(COMP_PACKAGE)
141 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
142 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
143 $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
144 @echo flagged > $(subst /,$(PS),$@)
145 else
146 @echo --------------------------------------------------------------------------------
147 @echo If you want to install your component automatically, please set the environment
148 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
149 @echo possible if no office instance is running.
150 @echo --------------------------------------------------------------------------------
151 endif
153 Example : $(REGISTERFLAG)
154 @echo --------------------------------------------------------------------------------
155 @echo The "$(QM)ProtocolHandler$(QM)" addon component was installed if SDK_AUTO_DEPLOYMENT = YES.
156 @echo You can use this component inside your office installation, see the example
157 @echo description.
158 @echo --------------------------------------------------------------------------------
160 run: $(COMP1_REGISTERFLAG)
161 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" -writer
164 .PHONY: clean
165 clean :
166 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC))
167 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN))
168 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO))
169 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))
170 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG)))
171 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_TYPEFLAG)))
172 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*))