merge the formfield patch from ooo-build
[ooovba.git] / odk / examples / DevelopersGuide / OfficeDev / Linguistic / Makefile
blob9058fefedce07074f7882c7b088785b3c15b4ddc
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.9 $
7 # last change: $Author: obo $ $Date: 2007-01-25 11:07:08 $
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 OfficeDevLinguistic 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 EXAMPLE_NAME=OfficeDevLinguisticExample
52 OUT_COMP_CLASS = $(OUT_CLASS)/$(EXAMPLE_NAME)
54 COMPONENT1_NAME=SampleHyphenator
55 COMPONENT1_PACKAGE = $(OUT_BIN)/$(COMPONENT1_NAME).$(UNOOXT_EXT)
56 COMPONENT1_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT1_NAME).$(UNOOXT_EXT)")
57 COMPONENT1_JAR_NAME = $(COMPONENT1_NAME).uno.jar
58 COMPONENT1_JAR = $(OUT_COMP_CLASS)/$(COMPONENT1_JAR_NAME)
59 COMPONENT1_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMPONENT1_NAME).uno.Manifest
60 COMPONENT1_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT1_NAME)/META-INF/manifest.xml
62 COMPONENT2_NAME=SampleSpellChecker
63 COMPONENT2_PACKAGE = $(OUT_BIN)/$(COMPONENT2_NAME).$(UNOOXT_EXT)
64 COMPONENT2_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT2_NAME).$(UNOOXT_EXT)")
65 COMPONENT2_JAR_NAME = $(COMPONENT2_NAME).uno.jar
66 COMPONENT2_JAR = $(OUT_COMP_CLASS)/$(COMPONENT2_JAR_NAME)
67 COMPONENT2_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMPONENT2_NAME).uno.Manifest
68 COMPONENT2_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT2_NAME)/META-INF/manifest.xml
70 COMPONENT3_NAME=SampleThesaurus
71 COMPONENT3_PACKAGE = $(OUT_BIN)/$(COMPONENT3_NAME).$(UNOOXT_EXT)
72 COMPONENT3_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT3_NAME).$(UNOOXT_EXT)")
73 COMPONENT3_JAR_NAME = $(COMPONENT3_NAME).uno.jar
74 COMPONENT3_JAR = $(OUT_COMP_CLASS)/$(COMPONENT3_JAR_NAME)
75 COMPONENT3_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMPONENT3_NAME).uno.Manifest
76 COMPONENT3_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT3_NAME)/META-INF/manifest.xml
78 APP1_NAME=LinguisticExamples
79 APP1_JAR=$(OUT_COMP_CLASS)/$(APP1_NAME).jar
81 REGISTERFLAG = $(OUT_MISC)/devguide_officedevlinguistic_register_component.flag
83 JAVAFILES = \
84 OneInstanceFactory.java \
85 PropChgHelper.java \
86 PropChgHelper_Hyph.java \
87 PropChgHelper_Spell.java \
88 XHyphenatedWord_impl.java \
89 XMeaning_impl.java \
90 XPossibleHyphens_impl.java \
91 XSpellAlternatives_impl.java \
92 SampleHyphenator.java \
93 SampleSpellChecker.java \
94 SampleThesaurus.java
96 CLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(JAVAFILES))
98 $(COMPONENT1_NAME)_CLASSFILES = XHyphenatedWord_impl.class \
99 XPossibleHyphens_impl.class \
100 PropChgHelper.class \
101 PropChgHelper_Hyph.class \
102 OneInstanceFactory.class \
103 $(COMPONENT1_NAME).class
105 $(COMPONENT2_NAME)_CLASSFILES = XSpellAlternatives_impl.class \
106 PropChgHelper_Spell.class \
107 PropChgHelper.class \
108 OneInstanceFactory.class \
109 $(COMPONENT2_NAME).class
111 $(COMPONENT3_NAME)_CLASSFILES = XMeaning_impl.class \
112 OneInstanceFactory.class \
113 $(COMPONENT3_NAME).class
115 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
116 $(PATH_SEPARATOR)$(OUT_COMP_CLASS))
118 .PHONY: ALL
119 ALL : $(EXAMPLE_NAME)
121 include $(SETTINGS)/stdtarget.mk
123 $(OUT_COMP_CLASS)/%.Manifest :
124 -$(MKDIR) $(subst /,$(PS),$(@D))
125 @echo RegistrationClassName: $(basename $(basename $(@F)))> $@
127 $(CLASSFILES) : $(JAVAFILES)
128 -$(MKDIR) $(subst /,$(PS),$(@D))
129 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $(JAVAFILES)
131 # NOTE: because of gnu make problems with full qualified paths, the pattern
132 # rules for the component jars and the packages doesn't work proper and we
133 # defined explicit rules
135 #$(OUT_COMP_CLASS)/%.jar : $(OUT_COMP_CLASS)/%.Manifest $(CLASSFILES)
136 # -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
137 # -$(MKDIR) $(subst /,$(PS),$(@D))
138 # cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES)
140 # rule for component package manifest
141 $(OUT_COMP_CLASS)/%/manifest.xml :
142 -$(MKDIR) $(subst /,$(PS),$(@D))
143 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
144 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
145 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
146 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
147 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
148 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
150 #$(OUT_BIN)/%.uno.pkg : $(OUT_COMP_CLASS)/%.uno.jar $(OUT_COMP_CLASS)/%/META-INF/manifest.xml
151 # -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
152 # -$(MKDIR) $(subst /,$(PS),$(@D))
153 # cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(<F)
154 # cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
156 $(COMPONENT1_JAR) : $(COMPONENT1_MANIFESTFILE) $(CLASSFILES)
157 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
158 -$(MKDIR) $(subst /,$(PS),$(@D))
159 cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES)
161 $(COMPONENT1_PACKAGE) : $(COMPONENT1_JAR) $(COMPONENT1_UNOPKG_MANIFEST)
162 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
163 -$(MKDIR) $(subst /,$(PS),$(@D))
164 cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(<F)
165 cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
167 $(COMPONENT2_JAR) : $(COMPONENT2_MANIFESTFILE) $(CLASSFILES)
168 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
169 -$(MKDIR) $(subst /,$(PS),$(@D))
170 cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES)
172 $(COMPONENT2_PACKAGE) : $(COMPONENT2_JAR) $(COMPONENT2_UNOPKG_MANIFEST)
173 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
174 -$(MKDIR) $(subst /,$(PS),$(@D))
175 cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(<F)
176 cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
178 $(COMPONENT3_JAR) : $(COMPONENT3_MANIFESTFILE) $(CLASSFILES)
179 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
180 -$(MKDIR) $(subst /,$(PS),$(@D))
181 cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES)
183 $(COMPONENT3_PACKAGE) : $(COMPONENT3_JAR) $(COMPONENT3_UNOPKG_MANIFEST)
184 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
185 -$(MKDIR) $(subst /,$(PS),$(@D))
186 cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_ZIP) ../../bin/$(@F) $(<F)
187 cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
189 $(REGISTERFLAG) : $(COMPONENT1_PACKAGE) $(COMPONENT2_PACKAGE) $(COMPONENT3_PACKAGE)
190 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
191 -$(MKDIR) $(subst /,$(PS),$(@D))
192 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
193 $(DEPLOYTOOL) $(COMPONENT1_PACKAGE_URL)
194 $(DEPLOYTOOL) $(COMPONENT2_PACKAGE_URL)
195 $(DEPLOYTOOL) $(COMPONENT3_PACKAGE_URL)
196 @echo flagged > $(subst /,$(PS),$@)
197 else
198 @echo --------------------------------------------------------------------------------
199 @echo If you want to install your component automatically, please set the environment
200 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
201 @echo possible if no office instance is running.
202 @echo --------------------------------------------------------------------------------
203 endif
205 $(OUT_COMP_CLASS)/%.class : %.java
206 -$(MKDIR) $(subst /,$(PS),$(@D))
207 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $<
209 $(OUT_COMP_CLASS)/%.mf :
210 -$(MKDIR) $(subst /,$(PS),$(@D))
211 @echo Main-Class: com.sun.star.lib.loader.Loader> $@
212 $(ECHOLINE)>> $@
213 @echo Name: com/sun/star/lib/loader/Loader.class>> $@
214 @echo Application-Class: $*>> $@
216 $(APP1_JAR) : $(OUT_COMP_CLASS)/$(APP1_NAME).mf $(OUT_COMP_CLASS)/$(APP1_NAME).class
217 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
218 -$(MKDIR) $(subst /,$(PS),$(@D))
219 +cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(basename $(@F)).mf $(basename $(@F)).class $(basename $(@F))$(QUOTE)$$Client.class
220 +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
223 $(EXAMPLE_NAME) : $(REGISTERFLAG) $(APP1_JAR)
224 @echo --------------------------------------------------------------------------------
225 @echo Please use the following command to execute the example!
226 @echo -
227 @echo $(MAKE) $(APP1_NAME).run
228 @echo --------
229 @echo Before you can run the examples the components "$(QM)$(COMPONENT1_NAME)$(QM)",
230 @echo "$(QM)$(COMPONENT2_NAME)$(QM)" and "$(QM)$(COMPONENT3_NAME)$(QM)" must be deployed.
231 @echo The components will be automatically deployed if SDK_AUTO_DEPLOYMENT = YES.
232 @echo --------------------------------------------------------------------------------
234 %.run: $(OUT_COMP_CLASS)/%.jar
235 $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
237 .PHONY: clean
238 clean :
239 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS))
240 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT1_PACKAGE_URL)))
241 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT2_PACKAGE_URL)))
242 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT3_PACKAGE_URL)))
243 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG)))