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 SpreadSheet examples of the Developers Guide.
38 SETTINGS
=$(PRJ
)/settings
40 include $(SETTINGS
)/settings.mk
41 include $(SETTINGS
)/std.mk
43 # Define non-platform/compiler specific settings
44 SAMPLE_NAME
=DevGuideSpreadsheetExamples
45 SAMPLE_CLASS_OUT
=$(OUT_CLASS
)/$(SAMPLE_NAME
)
46 SAMPLE_GEN_OUT
=$(OUT_MISC
)/$(SAMPLE_NAME
)
48 # Example add-in component
49 COMP1_NAME
=ExampleAddIn
50 COMP1_CLASS_OUT
=$(SAMPLE_CLASS_OUT
)/$(COMP1_NAME
)
51 COMP1_GEN_OUT
=$(SAMPLE_GEN_OUT
)/$(COMP1_NAME
)
52 COMP1_RDB_NAME
=$(COMP1_NAME
).uno.rdb
53 COMP1_RDB
=$(COMP1_GEN_OUT
)/$(COMP1_RDB_NAME
)
54 COMP1_PACKAGE
=$(OUT_BIN
)/$(COMP1_NAME
).
$(UNOOXT_EXT
)
55 COMP1_PACKAGE_URL
=$(subst \\,\
,"$(COMP_PACKAGE_DIR)$(PS)$(COMP1_NAME).$(UNOOXT_EXT)")
56 COMP1_JAR_NAME
=$(COMP1_NAME
).uno.jar
57 COMP1_JAR
=$(SAMPLE_CLASS_OUT
)/$(COMP1_JAR_NAME
)
58 COMP1_MANIFESTFILE
=$(COMP1_GEN_OUT
)/$(COMP1_NAME
).uno.Manifest
59 COMP1_UNOPKG_MANIFEST
=$(COMP1_GEN_OUT
)/$(COMP1_NAME
)/META-INF
/manifest.xml
60 COMP1_REGISTERFLAG
=$(SAMPLE_GEN_OUT
)/devguide_
$(COMP1_NAME
)_register_component.flag
61 COMP1_COMPONENTS
=$(COMP1_NAME
).components
63 # Example DataPilot component
64 COMP2_NAME
=ExampleDataPilotSource
65 COMP2_CLASS_OUT
=$(SAMPLE_CLASS_OUT
)/$(COMP2_NAME
)
66 COMP2_GEN_OUT
=$(SAMPLE_GEN_OUT
)/$(COMP2_NAME
)
67 COMP2_PACKAGE
=$(OUT_BIN
)/$(COMP2_NAME
).
$(UNOOXT_EXT
)
68 COMP2_PACKAGE_URL
=$(subst \\,\
,"$(COMP_PACKAGE_DIR)$(PS)$(COMP2_NAME).$(UNOOXT_EXT)")
69 COMP2_JAR_NAME
=$(COMP2_NAME
).uno.jar
70 COMP2_JAR
=$(SAMPLE_CLASS_OUT
)/$(COMP2_JAR_NAME
)
71 COMP2_MANIFESTFILE
=$(COMP2_GEN_OUT
)/$(COMP2_NAME
).uno.Manifest
72 COMP2_UNOPKG_MANIFEST
=$(COMP2_GEN_OUT
)/$(COMP2_NAME
)/META-INF
/manifest.xml
73 COMP2_REGISTERFLAG
=$(SAMPLE_GEN_OUT
)/devguide_
$(COMP2_NAME
)_register_component.flag
74 COMP2_COMPONENTS
=$(COMP2_NAME
).components
76 #REGISTERFLAG = $(OUT_MISC)$(PS)devguide_$(SAMPLE_NAME)_register_component.flag
78 APP1_NAME
=GeneralTableSample
79 APP1_CLASS_OUT
=$(SAMPLE_CLASS_OUT
)/$(APP1_NAME
)
80 APP1_GEN_OUT
=$(SAMPLE_GEN_OUT
)/$(APP1_NAME
)
81 APP1_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP1_NAME
).jar
83 APP2_NAME
=SpreadsheetSample
84 APP2_CLASS_OUT
=$(SAMPLE_CLASS_OUT
)/$(APP2_NAME
)
85 APP2_GEN_OUT
=$(SAMPLE_GEN_OUT
)/$(APP2_NAME
)
86 APP2_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP2_NAME
).jar
89 APP3_CLASS_OUT
=$(SAMPLE_CLASS_OUT
)/$(APP3_NAME
)
90 APP3_GEN_OUT
=$(SAMPLE_GEN_OUT
)/$(APP3_NAME
)
91 APP3_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP3_NAME
).jar
94 COMP1_IDLFILES
= XExampleAddIn.idl
96 # normally the idl file should be stored in a directory tree fitting the
97 # module structure, for the example we know the module structure
98 PACKAGE
= org
/openoffice
/sheet
/addin
104 ExampleDataPilotSource.java
107 SpreadsheetDocHelper.java
109 APP_CLASSFILES
= $(patsubst %.java
,$(SAMPLE_CLASS_OUT
)/%.class
,$(APP_JAVAFILES
))
110 APP_CLASSNAMES
= $(patsubst %.java
,%.class
,$(APP_JAVAFILES
))
112 COMP1_GENCLASSFILES
= $(patsubst %.idl
,$(COMP1_CLASS_OUT
)/$(PACKAGE
)/%.class
,$(COMP1_IDLFILES
))
113 COMP1_GENTYPELIST
= $(subst /,.
,$(patsubst %.idl
,-T
$(PACKAGE
)/% ,$(COMP1_IDLFILES
)))
115 COMP1_CLASSFILES
= $(patsubst %.java
,$(COMP1_CLASS_OUT
)/%.class
,$(COMP1_JAVAFILES
))
117 COMP2_CLASSFILES
= $(patsubst %.java
,$(COMP2_CLASS_OUT
)/%.class
,$(COMP2_JAVAFILES
))
120 SDK_CLASSPATH
= $(subst $(EMPTYSTRING
) $(PATH_SEPARATOR
),$(PATH_SEPARATOR
),$(CLASSPATH
)\
121 $(PATH_SEPARATOR
)$(SAMPLE_CLASS_OUT
)\
122 $(PATH_SEPARATOR
)$(COMP1_CLASS_OUT
)\
123 $(PATH_SEPARATOR
)$(COMP2_CLASS_OUT
)\
124 $(PATH_SEPARATOR
)$(APP1_CLASS_OUT
)\
125 $(PATH_SEPARATOR
)$(APP2_CLASS_OUT
)\
126 $(PATH_SEPARATOR
)$(APP3_CLASS_OUT
))
133 include $(SETTINGS
)/stdtarget.mk
135 $(SAMPLE_GEN_OUT
)/%.Manifest
:
136 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
137 @echo UNO-Type-Path
: $(basename $(notdir $*)).uno.jar
> $@
138 @echo RegistrationClassName
: $(basename $(basename $(@F
)))>> $@
140 # IDLs only for component 1 relevant
141 $(COMP1_RDB
) : $(COMP1_IDLFILES
)
142 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
143 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
144 $(UNOIDLWRITE
) $(URE_TYPES
) $(OFFICE_TYPES
) $< $@
146 $(COMP1_CLASS_OUT
)/$(PACKAGE
)/%.class
: $(COMP1_RDB
)
147 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
148 $(JAVAMAKER
) -nD
$(COMP1_GENTYPELIST
) -O
$(COMP1_CLASS_OUT
) $(COMP1_RDB
) -X
$(URE_TYPES
) -X
$(OFFICE_TYPES
)
150 $(COMP1_CLASSFILES
) : $(COMP1_JAVAFILES
) $(COMP1_GENCLASSFILES
)
151 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
152 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(COMP1_CLASS_OUT
) $(COMP1_JAVAFILES
)
154 $(COMP2_CLASSFILES
) : $(COMP2_JAVAFILES
)
155 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
156 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(COMP2_CLASS_OUT
) $^
158 $(COMP1_JAR
) : $(COMP1_MANIFESTFILE
) $(COMP1_CLASSFILES
)
159 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
160 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
161 $(SDK_JAR
) cvfm
$@
$< -C
$(COMP1_CLASS_OUT
) .
163 $(COMP2_JAR
) : $(COMP2_MANIFESTFILE
) $(COMP2_CLASSFILES
)
164 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
165 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
166 $(SDK_JAR
) cvfm
$@
$< -C
$(COMP2_CLASS_OUT
) .
168 $(COMP1_UNOPKG_MANIFEST
) :
169 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
170 @echo
$(OSEP
)?xml version
="$(QM)1.0$(QM)" encoding
="$(QM)UTF-8$(QM)"?
$(CSEP
) > $@
171 @echo
$(OSEP
)!DOCTYPE manifest
:manifest PUBLIC
"$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP
) >> $@
172 @echo
$(OSEP
)manifest
:manifest xmlns
:manifest
="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP
) >> $@
173 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.uno-typelibrary;type=RDB$(QM)" >> $@
174 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)$(subst /META-INF,,$(subst $(COMP1_GEN_OUT)/,,$(@D))).uno.rdb$(QM)"/$(CSEP
) >> $@
175 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@
176 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)$(COMP1_COMPONENTS)$(QM)"/$(CSEP
)>> $@
177 @echo
$(OSEP
)/manifest
:manifest
$(CSEP
) >> $@
179 $(COMP2_UNOPKG_MANIFEST
) :
180 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
181 @echo
$(OSEP
)?xml version
="$(QM)1.0$(QM)" encoding
="$(QM)UTF-8$(QM)"?
$(CSEP
) > $@
182 @echo
$(OSEP
)!DOCTYPE manifest
:manifest PUBLIC
"$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP
) >> $@
183 @echo
$(OSEP
)manifest
:manifest xmlns
:manifest
="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP
) >> $@
184 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@
185 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)$(COMP2_COMPONENTS)$(QM)"/$(CSEP
)>> $@
186 @echo
$(OSEP
)/manifest
:manifest
$(CSEP
) >> $@
188 $(COMP1_PACKAGE
) : $(COMP1_RDB
) $(COMP1_JAR
) $(COMP1_UNOPKG_MANIFEST
) $(COMP1_COMPONENTS
) description.xml
190 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
191 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
192 $(SDK_ZIP
) $@
$(COMP1_COMPONENTS
) description.xml
193 cd
$(subst /,$(PS
),$(COMP1_GEN_OUT
)) && $(SDK_ZIP
) -u ..
/..
/..
/bin
/$(@F
) $(<F
)
194 cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_ZIP
) -u ..
/..
/bin
/$(@F
) $(COMP1_JAR_NAME
)
195 cd
$(subst /,$(PS
),$(COMP1_GEN_OUT
)/$(subst .
$(UNOOXT_EXT
),,$(@F
))) && $(SDK_ZIP
) -u ..
/..
/..
/..
/bin
/$(@F
) META-INF
/manifest.xml
197 $(COMP2_PACKAGE
) : $(COMP2_JAR
) $(COMP2_UNOPKG_MANIFEST
) $(COMP2_COMPONENTS
)
198 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
199 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
200 $(SDK_ZIP
) $@
$(COMP2_COMPONENTS
)
201 cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_ZIP
) -u ..
/..
/bin
/$(@F
) $(<F
)
202 cd
$(subst /,$(PS
),$(COMP2_GEN_OUT
)/$(subst .
$(UNOOXT_EXT
),,$(@F
))) && $(SDK_ZIP
) -u ..
/..
/..
/..
/bin
/$(@F
) META-INF
/manifest.xml
204 $(SAMPLE_GEN_OUT
)/devguide_
$(COMP1_NAME
)_register_component.flag
: $(OUT_BIN
)/$(COMP1_NAME
).
$(UNOOXT_EXT
)
205 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
206 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
207 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
208 $(DEPLOYTOOL
) $(subst \\,\
,"$(COMP_PACKAGE_DIR)$(PS)$(COMP1_NAME).$(UNOOXT_EXT)")
209 @echo flagged
> $(subst /,$(PS
),$@
)
211 @echo
--------------------------------------------------------------------------------
212 @echo If you want to
install your component automatically
, please set the environment
213 @echo variable SDK_AUTO_DEPLOYMENT
= YES. But note that auto deployment is only
214 @echo possible if no office instance is running.
215 @echo
--------------------------------------------------------------------------------
218 $(SAMPLE_GEN_OUT
)/devguide_
$(COMP2_NAME
)_register_component.flag
: $(OUT_BIN
)/$(COMP2_NAME
).
$(UNOOXT_EXT
)
219 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
220 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
221 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
222 $(DEPLOYTOOL
) $(subst \\,\
,"$(COMP_PACKAGE_DIR)$(PS)$(COMP2_NAME).$(UNOOXT_EXT)")
223 @echo flagged
> $(subst /,$(PS
),$@
)
225 @echo
--------------------------------------------------------------------------------
226 @echo If you want to
install your component automatically
, please set the environment
227 @echo variable SDK_AUTO_DEPLOYMENT
= YES. But note that auto deployment is only
228 @echo possible if no office instance is running.
229 @echo
--------------------------------------------------------------------------------
232 $(APP_CLASSFILES
) : $(APP_JAVAFILES
)
233 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
234 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(SAMPLE_CLASS_OUT
) $(APP_JAVAFILES
)
236 $(APP1_CLASS_OUT
)/%.class
: %.java
$(APP_CLASSFILES
)
237 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
238 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(APP1_CLASS_OUT
) $<
240 $(APP2_CLASS_OUT
)/%.class
: %.java
$(APP_CLASSFILES
)
241 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
242 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(APP2_CLASS_OUT
) $<
244 $(APP3_CLASS_OUT
)/%.class
: %.java
$(APP_CLASSFILES
)
245 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
246 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(APP3_CLASS_OUT
) $<
248 $(SAMPLE_GEN_OUT
)/%.mf
:
249 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
250 @echo Main-Class
: com.sun.star.lib.loader.Loader
> $@
252 @echo Name
: com
/sun
/star
/lib
/loader
/Loader.class
>> $@
253 @echo Application-Class
: $(basename $(@F
))>> $@
255 $(APP1_JAR
) : $(APP1_GEN_OUT
)/$(APP1_NAME
).mf
$(APP1_CLASS_OUT
)/$(APP1_NAME
).class
$(APP_CLASSFILES
)
256 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
257 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
258 +$(SDK_JAR
) cvfm
$@
$< -C
$(APP1_CLASS_OUT
) .
259 +$(SDK_JAR
) uvf
$@
$(SDK_JAVA_UNO_BOOTSTRAP_FILES
)
260 +cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_JAR
) uvf
$(@F
) $(APP_CLASSNAMES
)
262 $(APP2_JAR
) : $(APP2_GEN_OUT
)/$(APP2_NAME
).mf
$(APP2_CLASS_OUT
)/$(APP2_NAME
).class
$(APP_CLASSFILES
)
263 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
264 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
265 +$(SDK_JAR
) cvfm
$@
$< -C
$(APP2_CLASS_OUT
) .
266 +$(SDK_JAR
) uvf
$@
$(SDK_JAVA_UNO_BOOTSTRAP_FILES
)
267 +cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_JAR
) uvf
$(@F
) $(APP_CLASSNAMES
)
269 $(APP3_JAR
) : $(APP3_GEN_OUT
)/$(APP3_NAME
).mf
$(APP3_CLASS_OUT
)/$(APP3_NAME
).class
$(APP_CLASSFILES
)
270 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
271 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
272 +$(SDK_JAR
) cvfm
$@
$< -C
$(APP3_CLASS_OUT
) .
273 +$(SDK_JAR
) uvf
$@
$(SDK_JAVA_UNO_BOOTSTRAP_FILES
)
274 +cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_JAR
) uvf
$(@F
) $(APP_CLASSNAMES
)
276 $(SAMPLE_NAME
) : $(COMP1_REGISTERFLAG
) $(COMP2_REGISTERFLAG
) $(APP1_JAR
) $(APP2_JAR
) $(APP3_JAR
)
277 @echo
--------------------------------------------------------------------------------
278 @echo Please use one of the following commands to execute the examples
!
280 @echo
$(MAKE
) $(APP1_NAME
).run
281 @echo
$(MAKE
) $(APP2_NAME
).run
282 @echo
$(MAKE
) $(APP3_NAME
).run
284 @echo The
"$(QM)$(COMP1_NAME)$(QM)" and
"$(QM)$(COMP2_NAME)$(QM)" component are installed if
285 @echo SDK_AUTO_DEPLOYMENT
= YES. You can use this components inside your office
286 @echo installation
, see the example descriptions. You can also load the
"$(QM)ExampleAddIn.ods$(QM)"
287 @echo document to see how the add-in functions can be used. For more details about the
288 @echo
"$(QM)$(COMP2_NAME)$(QM)" component see the
"$(QM)DataPilotReadme.txt"$(QM
).
290 @echo
$(MAKE
) ExampleAddIn.ods.load
291 @echo
--------------------------------------------------------------------------------
293 %.run
: $(SAMPLE_CLASS_OUT
)/%.jar
294 $(SDK_JAVA
) -Dcom.sun.star.lib.loader.unopath
="$(OFFICE_PROGRAM_PATH)" -jar
$<
296 ExampleAddIn.ods.load
: $(COMP1_REGISTERFLAG
)
297 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@
)
301 -$(DELRECURSIVE
) $(subst /,$(PS
),$(SAMPLE_CLASS_OUT
))
302 -$(DELRECURSIVE
) $(subst /,$(PS
),$(SAMPLE_GEN_OUT
))
303 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP1_PACKAGE_URL
)))
304 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP2_PACKAGE_URL
)))