merge the formfield patch from ooo-build
[ooovba.git] / odk / examples / DevelopersGuide / Spreadsheet / Makefile
blobe56d322f2d0ce86cc493b8ed0007f3680f5564ed
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.10 $
7 # last change: $Author: rt $ $Date: 2008-07-11 14:25: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 SpreadSheet examples of the Developers Guide.
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 SAMPLE_NAME=DevGuideSpreadsheetExamples
52 SAMPLE_CLASS_OUT=$(OUT_CLASS)/$(SAMPLE_NAME)
53 SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
55 # Example add-in component
56 COMP1_NAME=ExampleAddIn
57 COMP1_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(COMP1_NAME)
58 COMP1_GEN_OUT=$(SAMPLE_GEN_OUT)/$(COMP1_NAME)
59 COMP1_RDB_NAME=$(COMP1_NAME).uno.rdb
60 COMP1_RDB=$(COMP1_GEN_OUT)/$(COMP1_RDB_NAME)
61 COMP1_PACKAGE=$(OUT_BIN)/$(COMP1_NAME).$(UNOOXT_EXT)
62 COMP1_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP1_NAME).$(UNOOXT_EXT)")
63 COMP1_JAR_NAME=$(COMP1_NAME).uno.jar
64 COMP1_JAR=$(SAMPLE_CLASS_OUT)/$(COMP1_JAR_NAME)
65 COMP1_MANIFESTFILE=$(COMP1_GEN_OUT)/$(COMP1_NAME).uno.Manifest
66 COMP1_UNOPKG_MANIFEST=$(COMP1_GEN_OUT)/$(COMP1_NAME)/META-INF/manifest.xml
67 COMP1_REGISTERFLAG=$(SAMPLE_GEN_OUT)/devguide_$(COMP1_NAME)_register_component.flag
69 # Example DataPilot component
70 COMP2_NAME=ExampleDataPilotSource
71 COMP2_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(COMP2_NAME)
72 COMP2_GEN_OUT=$(SAMPLE_GEN_OUT)/$(COMP2_NAME)
73 COMP2_PACKAGE=$(OUT_BIN)/$(COMP2_NAME).$(UNOOXT_EXT)
74 COMP2_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP2_NAME).$(UNOOXT_EXT)")
75 COMP2_JAR_NAME=$(COMP2_NAME).uno.jar
76 COMP2_JAR=$(SAMPLE_CLASS_OUT)/$(COMP2_JAR_NAME)
77 COMP2_MANIFESTFILE=$(COMP2_GEN_OUT)/$(COMP2_NAME).uno.Manifest
78 COMP2_UNOPKG_MANIFEST=$(COMP2_GEN_OUT)/$(COMP2_NAME)/META-INF/manifest.xml
79 COMP2_REGISTERFLAG=$(SAMPLE_GEN_OUT)/devguide_$(COMP2_NAME)_register_component.flag
81 #REGISTERFLAG = $(OUT_MISC)$(PS)devguide_$(SAMPLE_NAME)_register_component.flag
83 APP1_NAME=GeneralTableSample
84 APP1_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP1_NAME)
85 APP1_GEN_OUT=$(SAMPLE_GEN_OUT)/$(APP1_NAME)
86 APP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar
88 APP2_NAME=SpreadsheetSample
89 APP2_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP2_NAME)
90 APP2_GEN_OUT=$(SAMPLE_GEN_OUT)/$(APP2_NAME)
91 APP2_JAR=$(SAMPLE_CLASS_OUT)/$(APP2_NAME).jar
93 APP3_NAME=ViewSample
94 APP3_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP3_NAME)
95 APP3_GEN_OUT=$(SAMPLE_GEN_OUT)/$(APP3_NAME)
96 APP3_JAR=$(SAMPLE_CLASS_OUT)/$(APP3_NAME).jar
99 COMP1_IDLFILES = XExampleAddIn.idl
101 # normally the idl file should be stored in a directory tree fitting the
102 # module structure, for the example we know the module structure
103 PACKAGE = org/openoffice/sheet/addin
105 COMP1_JAVAFILES = \
106 ExampleAddIn.java
108 COMP2_JAVAFILES = \
109 ExampleDataPilotSource.java
111 APP_JAVAFILES = \
112 SpreadsheetDocHelper.java
114 APP_CLASSFILES = $(patsubst %.java,$(SAMPLE_CLASS_OUT)/%.class,$(APP_JAVAFILES))
115 APP_CLASSNAMES = $(patsubst %.java,%.class,$(APP_JAVAFILES))
117 COMP1_GENCLASSFILES = $(patsubst %.idl,$(COMP1_CLASS_OUT)/$(PACKAGE)/%.class,$(COMP1_IDLFILES))
118 COMP1_GENTYPELIST = $(subst /,.,$(patsubst %.idl,-T$(PACKAGE)/% ,$(COMP1_IDLFILES)))
119 COMP1_GENURDFILES = $(patsubst %.idl,$(COMP1_GEN_OUT)/%.urd,$(COMP1_IDLFILES))
121 COMP1_CLASSFILES = $(patsubst %.java,$(COMP1_CLASS_OUT)/%.class,$(COMP1_JAVAFILES))
123 COMP2_CLASSFILES = $(patsubst %.java,$(COMP2_CLASS_OUT)/%.class,$(COMP2_JAVAFILES))
126 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
127 $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)\
128 $(PATH_SEPARATOR)$(COMP1_CLASS_OUT)\
129 $(PATH_SEPARATOR)$(COMP2_CLASS_OUT)\
130 $(PATH_SEPARATOR)$(APP1_CLASS_OUT)\
131 $(PATH_SEPARATOR)$(APP2_CLASS_OUT)\
132 $(PATH_SEPARATOR)$(APP3_CLASS_OUT))
135 # Targets
136 .PHONY: ALL
137 ALL : $(SAMPLE_NAME)
139 include $(SETTINGS)/stdtarget.mk
141 $(SAMPLE_GEN_OUT)/%.Manifest :
142 -$(MKDIR) $(subst /,$(PS),$(@D))
143 @echo UNO-Type-Path: $(basename $(notdir $*)).uno.jar> $@
144 @echo RegistrationClassName: $(basename $(basename $(@F)))>> $@
146 # IDLs only for component 1 relevant
147 $(COMP1_GEN_OUT)/%.urd : %.idl
148 -$(MKDIR) $(subst /,$(PS),$(@D))
149 $(IDLC) -I. -I$(IDL_DIR) -O$(COMP1_GEN_OUT) $^
151 $(COMP1_RDB) : $(COMP1_GENURDFILES)
152 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
153 -$(MKDIR) $(subst /,$(PS),$(@D))
154 $(REGMERGE) $@ /UCR $<
156 $(COMP1_CLASS_OUT)/$(PACKAGE)/%.class : $(COMP1_RDB)
157 -$(MKDIR) $(subst /,$(PS),$(@D))
158 $(JAVAMAKER) -BUCR -nD $(COMP1_GENTYPELIST) -O$(COMP1_CLASS_OUT) $(COMP1_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES)
160 $(COMP1_CLASSFILES) : $(COMP1_JAVAFILES) $(COMP1_GENCLASSFILES)
161 -$(MKDIR) $(subst /,$(PS),$(@D))
162 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP1_CLASS_OUT) $(COMP1_JAVAFILES)
164 $(COMP2_CLASSFILES) : $(COMP2_JAVAFILES)
165 -$(MKDIR) $(subst /,$(PS),$(@D))
166 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP2_CLASS_OUT) $^
168 $(COMP1_JAR) : $(COMP1_MANIFESTFILE) $(COMP1_CLASSFILES)
169 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
170 -$(MKDIR) $(subst /,$(PS),$(@D))
171 $(SDK_JAR) cvfm $@ $< -C $(COMP1_CLASS_OUT) .
173 $(COMP2_JAR) : $(COMP2_MANIFESTFILE) $(COMP2_CLASSFILES)
174 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
175 -$(MKDIR) $(subst /,$(PS),$(@D))
176 $(SDK_JAR) cvfm $@ $< -C $(COMP2_CLASS_OUT) .
178 $(COMP1_UNOPKG_MANIFEST) :
179 -$(MKDIR) $(subst /,$(PS),$(@D))
180 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
181 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
182 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
183 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-typelibrary;type=RDB$(QM)" >> $@
184 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(COMP1_GEN_OUT)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
185 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
186 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(COMP1_GEN_OUT)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
187 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
189 $(COMP2_UNOPKG_MANIFEST) :
190 -$(MKDIR) $(subst /,$(PS),$(@D))
191 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
192 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
193 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
194 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
195 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(COMP2_GEN_OUT)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
196 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
198 $(COMP1_PACKAGE) : $(COMP1_RDB) $(COMP1_JAR) $(COMP1_UNOPKG_MANIFEST)
199 echo "####" $(@)
200 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
201 -$(MKDIR) $(subst /,$(PS),$(@D))
202 cd $(subst /,$(PS),$(COMP1_GEN_OUT)) && $(SDK_ZIP) ../../../bin/$(@F) $(<F)
203 cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP1_JAR_NAME)
204 cd $(subst /,$(PS),$(COMP1_GEN_OUT)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../../bin/$(@F) META-INF/manifest.xml
206 $(COMP2_PACKAGE) : $(COMP2_JAR) $(COMP2_UNOPKG_MANIFEST)
207 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
208 -$(MKDIR) $(subst /,$(PS),$(@D))
209 cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) ../../bin/$(@F) $(<F)
210 cd $(subst /,$(PS),$(COMP2_GEN_OUT)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../../bin/$(@F) META-INF/manifest.xml
212 $(SAMPLE_GEN_OUT)/devguide_$(COMP1_NAME)_register_component.flag : $(OUT_BIN)/$(COMP1_NAME).$(UNOOXT_EXT)
213 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
214 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
215 -$(MKDIR) $(subst /,$(PS),$(@D))
216 $(DEPLOYTOOL) $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP1_NAME).$(UNOOXT_EXT)")
217 @echo flagged > $(subst /,$(PS),$@)
218 else
219 @echo --------------------------------------------------------------------------------
220 @echo If you want to install your component automatically, please set the environment
221 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
222 @echo possible if no office instance is running.
223 @echo --------------------------------------------------------------------------------
224 endif
226 $(SAMPLE_GEN_OUT)/devguide_$(COMP2_NAME)_register_component.flag : $(OUT_BIN)/$(COMP2_NAME).$(UNOOXT_EXT)
227 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
228 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
229 -$(MKDIR) $(subst /,$(PS),$(@D))
230 $(DEPLOYTOOL) $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP2_NAME).$(UNOOXT_EXT)")
231 @echo flagged > $(subst /,$(PS),$@)
232 else
233 @echo --------------------------------------------------------------------------------
234 @echo If you want to install your component automatically, please set the environment
235 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
236 @echo possible if no office instance is running.
237 @echo --------------------------------------------------------------------------------
238 endif
240 $(APP_CLASSFILES) : $(APP_JAVAFILES)
241 -$(MKDIR) $(subst /,$(PS),$(@D))
242 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $(APP_JAVAFILES)
244 $(APP1_CLASS_OUT)/%.class : %.java $(APP_CLASSFILES)
245 -$(MKDIR) $(subst /,$(PS),$(@D))
246 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP1_CLASS_OUT) $<
248 $(APP2_CLASS_OUT)/%.class : %.java $(APP_CLASSFILES)
249 -$(MKDIR) $(subst /,$(PS),$(@D))
250 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP2_CLASS_OUT) $<
252 $(APP3_CLASS_OUT)/%.class : %.java $(APP_CLASSFILES)
253 -$(MKDIR) $(subst /,$(PS),$(@D))
254 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP3_CLASS_OUT) $<
256 $(SAMPLE_GEN_OUT)/%.mf :
257 -$(MKDIR) $(subst /,$(PS),$(@D))
258 @echo Main-Class: com.sun.star.lib.loader.Loader> $@
259 $(ECHOLINE)>> $@
260 @echo Name: com/sun/star/lib/loader/Loader.class>> $@
261 @echo Application-Class: $(basename $(@F))>> $@
263 $(APP1_JAR) : $(APP1_GEN_OUT)/$(APP1_NAME).mf $(APP1_CLASS_OUT)/$(APP1_NAME).class $(APP_CLASSFILES)
264 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
265 -$(MKDIR) $(subst /,$(PS),$(@D))
266 +$(SDK_JAR) cvfm $@ $< -C $(APP1_CLASS_OUT) .
267 +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
268 +cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) uvf $(@F) $(APP_CLASSNAMES)
270 $(APP2_JAR) : $(APP2_GEN_OUT)/$(APP2_NAME).mf $(APP2_CLASS_OUT)/$(APP2_NAME).class $(APP_CLASSFILES)
271 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
272 -$(MKDIR) $(subst /,$(PS),$(@D))
273 +$(SDK_JAR) cvfm $@ $< -C $(APP2_CLASS_OUT) .
274 +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
275 +cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) uvf $(@F) $(APP_CLASSNAMES)
277 $(APP3_JAR) : $(APP3_GEN_OUT)/$(APP3_NAME).mf $(APP3_CLASS_OUT)/$(APP3_NAME).class $(APP_CLASSFILES)
278 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
279 -$(MKDIR) $(subst /,$(PS),$(@D))
280 +$(SDK_JAR) cvfm $@ $< -C $(APP3_CLASS_OUT) .
281 +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
282 +cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) uvf $(@F) $(APP_CLASSNAMES)
284 $(SAMPLE_NAME) : $(COMP1_REGISTERFLAG) $(COMP2_REGISTERFLAG) $(APP1_JAR) $(APP2_JAR) $(APP3_JAR)
285 @echo --------------------------------------------------------------------------------
286 @echo Please use one of the following commands to execute the examples!
287 @echo -
288 @echo $(MAKE) $(APP1_NAME).run
289 @echo $(MAKE) $(APP2_NAME).run
290 @echo $(MAKE) $(APP3_NAME).run
291 @echo --------
292 @echo The "$(QM)$(COMP1_NAME)$(QM)" and "$(QM)$(COMP2_NAME)$(QM)" component are installed if
293 @echo SDK_AUTO_DEPLOYMENT = YES. You can use this components inside your office
294 @echo installation, see the example descriptions. You can also load the "$(QM)ExampleAddIn.ods$(QM)"
295 @echo document to see how the add-in functions can be used. For more details about the
296 @echo "$(QM)$(COMP2_NAME)$(QM)" component see the "$(QM)DataPilotReadme.txt"$(QM).
297 @echo -
298 @echo $(MAKE) ExampleAddIn.ods.load
299 @echo --------------------------------------------------------------------------------
301 %.run: $(SAMPLE_CLASS_OUT)/%.jar
302 $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
304 ExampleAddIn.ods.load : $(COMP1_REGISTERFLAG)
305 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
307 .PHONY: clean
308 clean :
309 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
310 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
311 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP1_PACKAGE_URL)))
312 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP2_PACKAGE_URL)))