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 Java Spreadsheet examples of the SDK.
38 SETTINGS
=$(PRJ
)/settings
40 include $(SETTINGS
)/settings.mk
41 include $(SETTINGS
)/std.mk
43 # Define non-platform/compiler specific settings
44 EXAMPLE_NAME
=JavaSpreadsheetExamples
45 OUT_COMP_CLASS
= $(OUT_CLASS
)/$(EXAMPLE_NAME
)
46 OUT_COMP_GEN
= $(OUT_MISC
)/$(EXAMPLE_NAME
)
48 APP1_NAME
=EuroAdaption
49 APP1_JAR
=$(OUT_COMP_CLASS
)/$(APP1_NAME
).jar
51 APP2_JAR
=$(OUT_COMP_CLASS
)/$(APP2_NAME
).jar
52 APP3_NAME
=ChartTypeChange
53 APP3_JAR
=$(OUT_COMP_CLASS
)/$(APP3_NAME
).jar
56 COMP_RDB_NAME
=$(COMP_NAME
).uno.rdb
57 COMP_RDB
=$(OUT_COMP_GEN
)/$(COMP_RDB_NAME
)
58 COMP_PACKAGE
=$(OUT_BIN
)/$(COMP_NAME
).
$(UNOOXT_EXT
)
59 COMP_PACKAGE_URL
=$(subst \\,\
,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
60 COMP_JAR_NAME
=$(COMP_NAME
).uno.jar
61 COMP_JAR
=$(OUT_COMP_CLASS
)/$(COMP_JAR_NAME
)
62 COMP_MANIFESTFILE
=$(OUT_COMP_CLASS
)/$(COMP_NAME
).uno.Manifest
63 COMP_UNOPKG_MANIFEST
= $(OUT_COMP_CLASS
)/$(COMP_NAME
)/META-INF
/manifest.xml
64 COMP_REGISTERFLAG
=$(OUT_MISC
)$(PS
)java_
$(COMP_NAME
)_register_component.flag
65 COMP_COMPONENTS
=$(COMP_NAME
).components
67 IDLFILES
= XCalcAddins.idl
69 # normally the idl file should be stored in a directory tree fitting the module structure,
70 # for the example we know the module structure
71 PACKAGE
= org
/openoffice
/sheet
/addin
73 COMPJAVAFILES
= CalcAddins.java
75 #GENJAVAFILES = $(patsubst %.idl,$(OUT_COMP_GEN)/$(PACKAGE)/%.java,$(IDLFILES))
76 GENCLASSFILES
= $(patsubst %.idl
,$(OUT_COMP_CLASS
)/$(PACKAGE
)/%.class
,$(IDLFILES
))
77 GENTYPELIST
= $(subst /,.
,$(patsubst %.idl
,-T
$(PACKAGE
)/% ,$(IDLFILES
)))
78 GENURDFILES
= $(patsubst %.idl
,$(OUT_COMP_GEN
)/%.urd
,$(IDLFILES
))
80 COMPCLASSFILES
= $(patsubst %.java
,$(OUT_COMP_CLASS
)/%.class
,$(COMPJAVAFILES
))
81 #COMPCLASSFILES += $(subst $(OUT_COMP_GEN),$(OUT_COMP_CLASS),$(GENJAVAFILES:.java=.class))
83 $(COMP_NAME
)_CLASSFILES
= $(COMP_NAME
).class \
84 $(COMP_NAME
)$(QUOTE
)$$_$(COMP_NAME
).class
86 #$(COMP_NAME)_CLASSFILES += $(subst $(OUT_COMP_GEN)/,,$(GENJAVAFILES:.java=.class))
87 $(COMP_NAME
)_CLASSFILES
+= $(subst $(OUT_COMP_CLASS
)/,,$(GENCLASSFILES
))
89 SDK_CLASSPATH
= $(subst $(EMPTYSTRING
) $(PATH_SEPARATOR
),$(PATH_SEPARATOR
),$(CLASSPATH
)\
90 $(PATH_SEPARATOR
)$(OUT_COMP_CLASS
))
96 include $(SETTINGS
)/stdtarget.mk
98 # rule for a component manifest file
99 $(OUT_COMP_CLASS
)/%.Manifest
:
100 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
101 @echo UNO-Type-Path
: $(basename $*).uno.jar
> $@
102 @echo RegistrationClassName
: $(basename $*)>> $@
104 $(OUT_COMP_GEN
)/%.urd
: %.idl
105 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
106 $(IDLC
) -C
-I.
-I
$(IDL_DIR
) -O
$(OUT_COMP_GEN
) $<
108 $(OUT_COMP_GEN
)/%.rdb
: $(GENURDFILES
)
109 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
110 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
111 $(REGMERGE
) $@
/UCR
$(GENURDFILES
)
113 #$(OUT_COMP_GEN)/%.java : $(COMP_RDB)
114 $(GENCLASSFILES
) : $(COMP_RDB
)
115 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
116 $(JAVAMAKER
) -nD
$(GENTYPELIST
) -O
$(OUT_COMP_CLASS
) $(COMP_RDB
) -X
$(URE_TYPES
) -X
$(OFFICE_TYPES
)
118 $(OUT_COMP_CLASS
)/%.class
: %.java
119 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
120 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(OUT_COMP_CLASS
) $<
122 # only the component depends on the generated types
123 $(COMPCLASSFILES
) : $(JAVAFILES
) $(GENCLASSFILES
)
124 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
125 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(OUT_COMP_CLASS
) $(COMPJAVAFILES
)
127 # rule for client/example application manifest file
128 $(OUT_COMP_CLASS
)/%.mf
:
129 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
130 @echo Main-Class
: com.sun.star.lib.loader.Loader
> $@
132 @echo Name
: com
/sun
/star
/lib
/loader
/Loader.class
>> $@
133 @echo Application-Class
: $*>> $@
135 # rule for client/example application jar file
136 $(OUT_COMP_CLASS
)/%.jar
: $(OUT_COMP_CLASS
)/%.mf
$(OUT_COMP_CLASS
)/%.class
137 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
138 +cd
$(subst /,$(PS
),$(OUT_COMP_CLASS
)) && $(SDK_JAR
) cvfm
$(@F
) $*.mf
$*.class
139 +$(SDK_JAR
) uvf
$@
$(SDK_JAVA_UNO_BOOTSTRAP_FILES
)
141 # rule for component jar file
142 $(COMP_JAR
) : $(COMP_MANIFESTFILE
) $(COMPCLASSFILES
)
143 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
144 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
145 cd
$(subst /,$(PS
),$(OUT_COMP_CLASS
)) && $(SDK_JAR
) cvfm
$(@F
) $(<F
) $($(basename $(basename $(@F
)))_CLASSFILES
)
147 # rule for component package manifest
148 $(OUT_COMP_CLASS
)/%/manifest.xml
:
149 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
150 @echo
$(OSEP
)?xml version
="$(QM)1.0$(QM)" encoding
="$(QM)UTF-8$(QM)"?
$(CSEP
) > $@
151 @echo
$(OSEP
)!DOCTYPE manifest
:manifest PUBLIC
"$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP
) >> $@
152 @echo
$(OSEP
)manifest
:manifest xmlns
:manifest
="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP
) >> $@
153 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.uno-typelibrary;type=RDB$(QM)" >> $@
154 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).uno.rdb$(QM)"/$(CSEP
) >> $@
155 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@
156 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP
)>> $@
157 @echo
$(OSEP
)/manifest
:manifest
$(CSEP
) >> $@
159 # rule for component package file
160 $(COMP_PACKAGE
) : $(COMP_RDB
) $(COMP_JAR
) $(COMP_UNOPKG_MANIFEST
) $(COMP_NAME
).components
161 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
162 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
163 $(COPY
) $(subst /,$(PS
),$<) $(subst /,$(PS
),$(OUT_COMP_CLASS
))
164 $(SDK_ZIP
) $@
-u
$(COMP_NAME
).components
165 cd
$(subst /,$(PS
),$(OUT_COMP_CLASS
)) && $(SDK_ZIP
) -u ..
/..
/bin
/$(@F
) $(COMP_RDB_NAME
) $(COMP_JAR_NAME
)
166 cd
$(subst /,$(PS
),$(OUT_COMP_CLASS
)/$(subst .
$(UNOOXT_EXT
),,$(@F
))) && $(SDK_ZIP
) -u ..
/..
/..
/bin
/$(@F
) META-INF
/manifest.xml
167 $(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(OUT_COMP_CLASS
)/$(<F
)))
169 $(COMP_REGISTERFLAG
) : $(COMP_PACKAGE
)
170 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
171 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
172 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
173 $(DEPLOYTOOL
) $(COMP_PACKAGE_URL
)
174 @echo flagged
> $(subst /,$(PS
),$@
)
176 @echo
--------------------------------------------------------------------------------
177 @echo If you want to
install your component automatically
, please set the environment
178 @echo variable SDK_AUTO_DEPLOYMENT
= YES. But note that auto deployment is only
179 @echo possible if no office instance is running.
180 @echo
--------------------------------------------------------------------------------
183 $(APP1_JAR
) : $(OUT_COMP_CLASS
)/$(APP1_NAME
).mf
$(OUT_COMP_CLASS
)/$(APP1_NAME
).class
184 $(APP2_JAR
) : $(OUT_COMP_CLASS
)/$(APP2_NAME
).mf
$(OUT_COMP_CLASS
)/$(APP2_NAME
).class
185 $(APP3_JAR
) : $(OUT_COMP_CLASS
)/$(APP3_NAME
).mf
$(OUT_COMP_CLASS
)/$(APP3_NAME
).class
187 $(EXAMPLE_NAME
) : $(COMP_REGISTERFLAG
) $(APP1_JAR
) $(APP2_JAR
) $(APP3_JAR
)
188 @echo
--------------------------------------------------------------------------------
189 @echo Please use the following command to execute the examples
!
191 @echo
$(MAKE
) EuroAdaption.run
192 @echo
$(MAKE
) SCalc.run
193 @echo
$(MAKE
) ChartTypeChange.run
194 @echo
--------------------------------------------------------------------------------
195 @echo The Calc add-in component was installed if SDK_AUTO_DEPLOYMENT
= YES.
196 @echo You can use this component inside your office installation
, see the example
197 @echo description. You can also load the
"$(QM)CalcAddins.ods$(QM)" document to see
198 @echo how the add-in functions works.
200 @echo
$(MAKE
) CalcAddins.ods.load
201 @echo
--------------------------------------------------------------------------------
203 %.run
: $(OUT_COMP_CLASS
)/%.jar
204 $(SDK_JAVA
) -Dcom.sun.star.lib.loader.unopath
="$(OFFICE_PROGRAM_PATH)" -jar
$<
206 CalcAddins.ods.load
: $(COMP_REGISTERFLAG
)
207 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@
)
211 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_CLASS
))
212 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_GEN
))
213 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_PACKAGE_URL
)))
214 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_REGISTERFLAG
)))