1 #*************************************************************************
3 # $RCSfile: Makefile,v $
7 # last change: $Author: rt $ $Date: 2007-11-06 15:07:34 $
9 # The Contents of this file are made available subject to the terms of
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
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 Charts examples of the Developers Guide.
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
=DevGuideChartExample
52 SAMPLE_CLASS_OUT
= $(OUT_CLASS
)/$(SAMPLE_NAME
)
53 SAMPLE_GEN_OUT
= $(OUT_MISC
)/$(SAMPLE_NAME
)
56 APP1_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP1_NAME
).jar
58 APP2_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP2_NAME
).jar
59 APP3_NAME
=ChartInWriter
60 APP3_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP3_NAME
).jar
61 APP4_NAME
=ListenAtCalcRangeInDraw
62 APP4_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP4_NAME
).jar
63 APP5_NAME
=SelectionChangeListener
64 APP5_JAR
=$(SAMPLE_CLASS_OUT
)/$(APP5_NAME
).jar
66 COMPONENT_NAME
=JavaSampleChartAddIn
67 COMPONENT_PACKAGE
= $(OUT_BIN
)/$(COMPONENT_NAME
).
$(UNOOXT_EXT
)
68 COMPONENT_PACKAGE_URL
= $(subst \\,\
,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)")
69 COMPONENT_JAR_NAME
= $(COMPONENT_NAME
).uno.jar
70 COMPONENT_JAR
= $(SAMPLE_CLASS_OUT
)/$(COMPONENT_JAR_NAME
)
71 COMPONENT_MANIFESTFILE
= $(SAMPLE_CLASS_OUT
)/$(COMPONENT_NAME
).uno.Manifest
72 COMPONENT_UNOPKG_MANIFEST
= $(SAMPLE_CLASS_OUT
)/$(COMPONENT_NAME
)/META-INF
/manifest.xml
73 COMP_REGISTERFLAG
= $(SAMPLE_GEN_OUT
)/devguide_
$(COMPONENT_NAME
)_register_component.flag
76 JavaSampleChartAddIn.java
83 COMPCLASSFILES
= $(patsubst %.java
,$(SAMPLE_CLASS_OUT
)/%.class
,$(COMPJAVAFILES
))
85 APP_CLASSFILES
= $(patsubst %.java
,$(SAMPLE_CLASS_OUT
)/%.class
,$(APP_JAVAFILES
))
86 APP_CLASSNAMES
= $(patsubst %.java
,%.class
,$(APP_JAVAFILES
))
88 $(COMPONENT_NAME
)_CLASSFILES
= $(COMPONENT_NAME
).class
90 SDK_CLASSPATH
= $(subst $(EMPTYSTRING
) $(PATH_SEPARATOR
),$(PATH_SEPARATOR
),$(CLASSPATH
)\
91 $(PATH_SEPARATOR
)$(SAMPLE_CLASS_OUT
))
98 include $(SETTINGS
)/stdtarget.mk
100 $(SAMPLE_CLASS_OUT
)/%.Manifest
:
101 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
102 @echo RegistrationClassName
: $(basename $(basename $(@F
)))> $@
104 # rule for client/example application class files, explicit dependencies to common
105 # java files which are used in all examples.
106 $(SAMPLE_CLASS_OUT
)/%.class
: %.java
$(APP_JAVAFILES
)
107 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
108 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(SAMPLE_CLASS_OUT
) $< $(APP_JAVAFILES
)
110 $(COMPCLASSFILES
) : $(JAVAFILES
)
111 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
112 $(SDK_JAVAC
) $(JAVAC_FLAGS
) -classpath
"$(SDK_CLASSPATH)" -d
$(SAMPLE_CLASS_OUT
) $(COMPJAVAFILES
)
114 # rule for client/example application manifest file
115 $(SAMPLE_CLASS_OUT
)/%.mf
:
116 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
117 @echo Main-Class
: com.sun.star.lib.loader.Loader
> $@
119 @echo Name
: com
/sun
/star
/lib
/loader
/Loader.class
>> $@
120 @echo Application-Class
: $*>> $@
122 # rule for client/example application jar file
123 $(SAMPLE_CLASS_OUT
)/%.jar
: $(SAMPLE_CLASS_OUT
)/%.mf
$(SAMPLE_CLASS_OUT
)/%.class
124 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
125 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
126 +cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_JAR
) cvfm
$(@F
) $*.mf
$**.class
$(APP_CLASSNAMES
)
128 +$(SDK_JAR
) uvf
$@
$(SDK_JAVA_UNO_BOOTSTRAP_FILES
)
130 # rule for component jar file
131 $(COMPONENT_JAR
) : $(COMPONENT_MANIFESTFILE
) $(COMPCLASSFILES
)
132 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
133 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
134 cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_JAR
) cvfm
$(@F
) $(<F
) $($(basename $(basename $(@F
)))_CLASSFILES
)
136 # rule for component package manifest
137 $(SAMPLE_CLASS_OUT
)/%/manifest.xml
:
138 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
139 @echo
$(OSEP
)?xml version
="$(QM)1.0$(QM)" encoding
="$(QM)UTF-8$(QM)"?
$(CSEP
) > $@
140 @echo
$(OSEP
)!DOCTYPE manifest
:manifest PUBLIC
"$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP
) >> $@
141 @echo
$(OSEP
)manifest
:manifest xmlns
:manifest
="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP
) >> $@
142 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
143 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_CLASS_OUT)/,,$(@D))).uno.jar$(QM)"/$(CSEP
) >> $@
144 @echo
$(OSEP
)/manifest
:manifest
$(CSEP
) >> $@
146 # rule for component pacakge file
147 $(COMPONENT_PACKAGE
) : $(COMPONENT_JAR
) $(COMPONENT_UNOPKG_MANIFEST
)
148 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
149 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
150 cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)) && $(SDK_ZIP
) ..
/..
/bin
/$(@F
) $(<F
)
151 cd
$(subst /,$(PS
),$(SAMPLE_CLASS_OUT
)/$(subst .
$(UNOOXT_EXT
),,$(@F
))) && $(SDK_ZIP
) ..
/..
/..
/bin
/$(@F
) -u META-INF
/manifest.xml
153 $(COMP_REGISTERFLAG
) : $(COMPONENT_PACKAGE
)
154 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
155 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
156 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
157 $(DEPLOYTOOL
) $(COMPONENT_PACKAGE_URL
)
158 @echo flagged
> $(subst /,$(PS
),$@
)
160 @echo
--------------------------------------------------------------------------------
161 @echo If you want to
install your component automatically
, please set the environment
162 @echo variable SDK_AUTO_DEPLOYMENT
= YES. But note that auto deployment is only
163 @echo possible if no office instance is running.
164 @echo
--------------------------------------------------------------------------------
167 $(APP1_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP1_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP1_NAME
).class
168 $(APP2_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP2_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP2_NAME
).class
169 $(APP3_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP3_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP3_NAME
).class
170 $(APP4_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP4_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP4_NAME
).class
171 $(APP5_JAR
) : $(SAMPLE_CLASS_OUT
)/$(APP5_NAME
).mf
$(SAMPLE_CLASS_OUT
)/$(APP5_NAME
).class
173 $(SAMPLE_NAME
) : $(COMP_REGISTERFLAG
) $(APP1_JAR
) $(APP2_JAR
) $(APP3_JAR
) $(APP4_JAR
) $(APP5_JAR
)
174 @echo
--------------------------------------------------------------------------------
175 @echo When you run the
"$(QM)$(APP5_NAME)$(QM)" example please select the
176 @echo legend or the title to add a
$(APP5_NAME
). The example terminates
177 @echo when the document is closed.
179 @echo Please use the following commands to execute the examples
!
181 @echo
$(MAKE
) $(APP1_NAME
).run
182 @echo
$(MAKE
) $(APP2_NAME
).run
183 @echo
$(MAKE
) $(APP3_NAME
).run
184 @echo
$(MAKE
) $(APP4_NAME
).run
185 @echo
$(MAKE
) $(APP5_NAME
).run
187 @echo The Chart add-in component was installed if SDK_AUTO_DEPLOYMENT
= YES.
188 @echo Load the
"$(QM)AddInChart.ods$(QM)" document in your office to see the new chart type
,
189 @echo and see the example description.
191 @echo
$(MAKE
) AddInChart.ods.load
192 @echo
--------------------------------------------------------------------------------
194 %.run
: $(SAMPLE_CLASS_OUT
)/%.jar
195 $(SDK_JAVA
) -Dcom.sun.star.lib.loader.unopath
="$(OFFICE_PROGRAM_PATH)" -jar
$<
197 AddInChart.ods.load
: $(REGISTERFLAG
)
198 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@
)
202 -$(DELRECURSIVE
) $(subst /,$(PS
),$(SAMPLE_CLASS_OUT
))
203 -$(DELRECURSIVE
) $(subst /,$(PS
),$(SAMPLE_GEN_OUT
))
204 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMPONENT_PACKAGE_URL
)))