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 Charts 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
=DevGuideChartExample
45 SAMPLE_CLASS_OUT
= $(OUT_CLASS
)/$(SAMPLE_NAME
)
46 SAMPLE_GEN_OUT
= $(OUT_MISC
)/$(SAMPLE_NAME
)
49 APP1_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP1_NAME
).jar
51 APP2_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP2_NAME
).jar
52 APP3_NAME
=ChartInWriter
53 APP3_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP3_NAME
).jar
54 APP4_NAME
=ListenAtCalcRangeInDraw
55 APP4_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP4_NAME
).jar
56 APP5_NAME
=SelectionChangeListener
57 APP5_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP5_NAME
).jar
59 COMP_NAME
=JavaSampleChartAddIn
60 COMP_PACKAGE
= $(OUT_BIN
)/$(COMP_NAME
).
$(UNOOXT_EXT
)
61 COMP_PACKAGE_URL
= $(subst \\,\
,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
62 COMP_JAR_NAME
= $(COMP_NAME
).uno.jar
63 COMP_JAR
= $(SAMPLE_CLASS_OUT
)/$(COMP_JAR_NAME
)
64 COMP_MANIFESTFILE
= $(SAMPLE_CLASS_OUT
)/$(COMP_NAME
).uno.Manifest
65 COMP_UNOPKG_MANIFEST
= $(SAMPLE_CLASS_OUT
)/$(COMP_NAME
)/META-INF
/manifest.xml
66 COMP_REGISTERFLAG
= $(SAMPLE_GEN_OUT
)/devguide_
$(COMP_NAME
)_register_component.flag
67 COMP_COMPONENTS
=$(COMP_NAME
).components
70 JavaSampleChartAddIn.java
77 COMPCLASSFILES
= $(patsubst %.java
,$(SAMPLE_CLASS_OUT
)/%.class
,$(COMPJAVAFILES
))
79 APP_CLASSFILES
= $(patsubst %.java
,$(SAMPLE_CLASS_OUT
)/%.class
,$(APP_JAVAFILES
))
80 APP_CLASSNAMES
= $(patsubst %.java
,%.class
,$(APP_JAVAFILES
))
82 $(COMP_NAME
)_CLASSFILES
= $(COMP_NAME
).class
84 SDK_CLASSPATH
= $(subst $(EMPTYSTRING
) $(PATH_SEPARATOR
),$(PATH_SEPARATOR
),$(CLASSPATH
)\
85 $(PATH_SEPARATOR
)$(SAMPLE_CLASS_OUT
))
92 include $(SETTINGS
)/stdtarget.mk
94 $(SAMPLE_CLASS_OUT
)/%.Manifest
:
95 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
96 @echo RegistrationClassName
: $(basename $(basename $(@F
)))> $@
98 # rule for client/example application class files, explicit dependencies to common
99 # java files which are used in all examples.
100 $(SAMPLE_CLASS_OUT
)/%.class
: %.java
$(APP_JAVAFILES
)
101 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
102 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(SAMPLE_CLASS_OUT
) $< $(APP_JAVAFILES
)
104 $(COMPCLASSFILES
) : $(JAVAFILES
)
105 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
106 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(SAMPLE_CLASS_OUT
) $(COMPJAVAFILES
)
108 # rule for client/example application manifest file
109 $(SAMPLE_CLASS_OUT
)/%.mf
:
110 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
111 @echo Main-Class
: com.sun.star.lib.loader.Loader
> $@
113 @echo Name
: com
/sun
/star
/lib
/loader
/Loader.class
>> $@
114 @echo Application-Class
: $*>> $@
116 # rule for client/example application jar file
117 $(SAMPLE_CLASS_OUT
)/%.jar
: $(SAMPLE_CLASS_OUT
)/%.mf
$(SAMPLE_CLASS_OUT
)/%.class
118 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
119 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
120 +cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_JAR
) cvfm
$(@F
) $*.mf
$**.class
$(APP_CLASSNAMES
)
122 +$(SDK_JAR
) uvf
$@
$(SDK_JAVA_UNO_BOOTSTRAP_FILES
)
124 # rule for component jar file
125 $(COMP_JAR
) : $(COMP_MANIFESTFILE
) $(COMPCLASSFILES
)
126 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
127 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
128 cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_JAR
) cvfm
$(@F
) $(<F
) $($(basename $(basename $(@F
)))_CLASSFILES
)
130 # rule for component package manifest
131 $(SAMPLE_CLASS_OUT
)/%/manifest.xml
:
132 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
133 @echo
$(OSEP
)?xml version
="$(QM)1.0$(QM)" encoding
="$(QM)UTF-8$(QM)"?
$(CSEP
) > $@
134 @echo
$(OSEP
)!DOCTYPE manifest
:manifest PUBLIC
"$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP
) >> $@
135 @echo
$(OSEP
)manifest
:manifest xmlns
:manifest
="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP
) >> $@
136 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@
137 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)$(COMP_COMPONENTS)$(QM)"/$(CSEP
)>> $@
138 @echo
$(OSEP
)/manifest
:manifest
$(CSEP
) >> $@
140 # rule for component pacakge file
141 $(COMP_PACKAGE
) : $(COMP_JAR
) $(COMP_UNOPKG_MANIFEST
) $(COMP_COMPONENTS
)
142 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
143 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
144 $(SDK_ZIP
) $@
$(COMP_COMPONENTS
)
145 cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_ZIP
) ..
/..
/bin
/$(@F
) -u
$(<F
)
146 cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)/$(subst .
$(UNOOXT_EXT
),,$(@F
))) && $(SDK_ZIP
) ..
/..
/..
/bin
/$(@F
) -u META-INF
/manifest.xml
148 $(COMP_REGISTERFLAG
) : $(COMP_PACKAGE
)
149 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
150 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
151 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
152 $(DEPLOYTOOL
) $(COMP_PACKAGE_URL
)
153 @echo flagged
> $(subst /,$(PS
),$@
)
155 @echo
--------------------------------------------------------------------------------
156 @echo If you want to
install your component automatically
, please set the environment
157 @echo variable SDK_AUTO_DEPLOYMENT
= YES. But note that auto deployment is only
158 @echo possible if no office instance is running.
159 @echo
--------------------------------------------------------------------------------
162 $(APP1_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP1_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP1_NAME
).class
163 $(APP2_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP2_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP2_NAME
).class
164 $(APP3_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP3_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP3_NAME
).class
165 $(APP4_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP4_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP4_NAME
).class
166 $(APP5_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP5_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP5_NAME
).class
168 $(SAMPLE_NAME
) : $(COMP_REGISTERFLAG
) $(APP1_JAR
) $(APP2_JAR
) $(APP3_JAR
) $(APP4_JAR
) $(APP5_JAR
)
169 @echo
--------------------------------------------------------------------------------
170 @echo When you run the
"$(QM)$(APP5_NAME)$(QM)" example please select the
171 @echo legend or the title to add a
$(APP5_NAME
). The example terminates
172 @echo when the document is closed.
174 @echo Please use the following commands to execute the examples
!
176 @echo
$(MAKE
) $(APP1_NAME
).run
177 @echo
$(MAKE
) $(APP2_NAME
).run
178 @echo
$(MAKE
) $(APP3_NAME
).run
179 @echo
$(MAKE
) $(APP4_NAME
).run
180 @echo
$(MAKE
) $(APP5_NAME
).run
182 @echo The Chart add-in component was installed if SDK_AUTO_DEPLOYMENT
= YES.
183 @echo Load the
"$(QM)AddInChart.ods$(QM)" document in your office to see the new chart type
,
184 @echo and see the example description.
186 @echo
$(MAKE
) AddInChart.ods.load
187 @echo
--------------------------------------------------------------------------------
189 %.run
: $(SAMPLE_CLASS_OUT
)/%.jar
190 $(SDK_JAVA
) -Dcom.sun.star.lib.loader.unopath
="$(OFFICE_PROGRAM_PATH)" -jar
$<
192 AddInChart.ods.load
: $(REGISTERFLAG
)
193 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@
)
197 -$(DELRECURSIVE
) $(subst /,$(PS
),$(SAMPLE_CLASS_OUT
))
198 -$(DELRECURSIVE
) $(subst /,$(PS
),$(SAMPLE_GEN_OUT
))
199 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_PACKAGE_URL
)))