merge the formfield patch from ooo-build
[ooovba.git] / odk / examples / DevelopersGuide / Components / Addons / JobsAddon / Makefile
blob0472aa0156125d075644c5d50b494ce29a3a3f6d
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.7 $
7 # last change: $Author: obo $ $Date: 2007-01-25 11:03:33 $
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 DevGuide Jobs Addon component example of the SDK.
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 COMPONENT_NAME=AsyncJob
52 OUT_COMP_CLASS=$(OUT_CLASS)/$(COMPONENT_NAME)
53 OUT_COMP_MISC=$(OUT_MISC)/$(COMPONENT_NAME)
54 COMPONENT_PACKAGE=$(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT)
55 COMPONENT_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)")
56 COMPONENT_JAR_NAME=$(COMPONENT_NAME).uno.jar
57 COMPONENT_JAR=$(OUT_CLASS)/$(COMPONENT_JAR_NAME)
58 COMPONENT_MANIFESTFILE=$(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest
59 COMPONENT_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT_NAME)/META-INF/manifest.xml
60 REGISTERFLAG=$(OUT_COMP_MISC)$(PS)java_$(COMPONENT_NAME)_register_component.flag
62 JAVAFILES = AsyncJob.java
64 CLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(JAVAFILES))
66 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
67 $(PATH_SEPARATOR)$(OUT_COMP_CLASS))
70 # Targets
71 .PHONY: ALL
72 ALL : DevGuideJobsAddon
74 include $(SETTINGS)/stdtarget.mk
76 $(OUT_COMP_CLASS)/%.Manifest :
77 -$(MKDIR) $(subst /,$(PS),$(@D))
78 @echo RegistrationClassName: $(basename $(basename $(@F)))> $@
80 $(CLASSFILES) : $(JAVAFILES)
81 -$(MKDIR) $(subst /,$(PS),$(@D))
82 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $(JAVAFILES)
84 # rule for component jar file
85 $(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(CLASSFILES)
86 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
87 -$(MKDIR) $(subst /,$(PS),$(@D))
88 $(SDK_JAR) cvfm $@ $< -C $(OUT_COMP_CLASS) .
90 # rule for component package manifest
91 $(OUT_COMP_CLASS)/%/manifest.xml :
92 -$(MKDIR) $(subst /,$(PS),$(@D))
93 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
94 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
95 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
96 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
97 @echo $(SQM) $(SQM)manifest:full-path="$(QM)Addons.xcu$(QM)"/$(CSEP) >> $@
98 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
99 @echo $(SQM) $(SQM)manifest:full-path="$(QM)Jobs.xcu$(QM)"/$(CSEP) >> $@
100 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
101 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
102 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
104 # rule for component package file
105 $(COMPONENT_PACKAGE) : $(COMPONENT_JAR) Addons.xcu Jobs.xcu $(COMPONENT_UNOPKG_MANIFEST)
106 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
107 -$(MKDIR) $(subst /,$(PS),$(@D))
108 cd $(subst /,$(PS),$(OUT_CLASS)) && $(SDK_ZIP) ../bin/$(@F) $(<F)
109 $(SDK_ZIP) -u $@ Addons.xcu Jobs.xcu
110 cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
113 $(REGISTERFLAG) : $(COMPONENT_PACKAGE)
114 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
115 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
116 -$(MKDIR) $(subst /,$(PS),$(@D))
117 $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL)
118 @echo flagged > $(subst /,$(PS),$@)
119 else
120 @echo --------------------------------------------------------------------------------
121 @echo If you want to install your component automatically, please set the environment
122 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
123 @echo possible if no office instance is running.
124 @echo --------------------------------------------------------------------------------
125 endif
127 DevGuideJobsAddon : $(REGISTERFLAG)
128 @echo --------------------------------------------------------------------------------
129 @echo The "$(QM)AsyncJob$(QM)" addon component was installed if SDK_AUTO_DEPLOYMENT = YES.
130 @echo You can use this component inside your office installation, see the example
131 @echo description.
132 @echo --------------------------------------------------------------------------------
134 %.run: $(OUT_COMP_CLASS)/%.class
135 $(SDK_JAVA) -classpath "$(SDK_CLASSPATH)" $(basename $@)
137 .PHONY: clean
138 clean :
139 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS))
140 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_MISC))
141 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL)))
142 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_JAR)))