merge the formfield patch from ooo-build
[ooovba.git] / odk / examples / DevelopersGuide / Components / Addons / ProtocolHandlerAddon_java / Makefile
blob430644cf6cb2eb77721fe6245e07a97a3f42ece9
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.7 $
7 # last change: $Author: obo $ $Date: 2007-01-25 11:04:00 $
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 ProtoclHandlerAddon Java 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=ProtocolHandlerAddon_java
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
61 REGISTERFLAG=$(OUT_COMP_MISC)$(PS)java_$(COMPONENT_NAME)_register_component.flag
63 JAVAFILES = ProtocolHandlerAddon.java
65 CLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(JAVAFILES))
67 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
68 $(PATH_SEPARATOR)$(OUT_COMP_CLASS))
71 # Targets
72 .PHONY: ALL
73 ALL : DevGuideProtocolHandlerAddon
75 include $(SETTINGS)/stdtarget.mk
77 $(OUT_COMP_CLASS)/%.Manifest :
78 -$(MKDIR) $(subst /,$(PS),$(@D))
79 @echo RegistrationClassName: ProtocolHandlerAddon> $@
81 $(CLASSFILES) : $(JAVAFILES)
82 -$(MKDIR) $(subst /,$(PS),$(@D))
83 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $(JAVAFILES)
85 # rule for component jar file
86 $(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(CLASSFILES)
87 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
88 -$(MKDIR) $(subst /,$(PS),$(@D))
89 $(SDK_JAR) cvfm $@ $< -C $(OUT_COMP_CLASS) .
91 # rule for component package manifest
92 $(OUT_COMP_CLASS)/%/manifest.xml :
93 -$(MKDIR) $(subst /,$(PS),$(@D))
94 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
95 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
96 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
97 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
98 @echo $(SQM) $(SQM)manifest:full-path="$(QM)Addons.xcu$(QM)"/$(CSEP) >> $@
99 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
100 @echo $(SQM) $(SQM)manifest:full-path="$(QM)ProtocolHandler.xcu$(QM)"/$(CSEP) >> $@
101 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
102 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
103 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
105 # rule for component package file
106 $(COMPONENT_PACKAGE) : $(COMPONENT_JAR) Addons.xcu ProtocolHandler.xcu $(COMPONENT_UNOPKG_MANIFEST)
107 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
108 -$(MKDIR) $(subst /,$(PS),$(@D))
109 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_MISC))
110 $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_MISC))
111 cd $(subst /,$(PS),$(OUT_COMP_MISC)) && $(SDK_ZIP) ../../bin/$(@F) $(<F)
112 $(SDK_ZIP) -u $@ Addons.xcu ProtocolHandler.xcu
113 cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
115 $(REGISTERFLAG) : $(COMPONENT_PACKAGE)
116 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
117 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
118 -$(MKDIR) $(subst /,$(PS),$(@D))
119 $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL)
120 @echo flagged > $(subst /,$(PS),$@)
121 else
122 @echo --------------------------------------------------------------------------------
123 @echo If you want to install your component automatically, please set the environment
124 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
125 @echo possible if no office instance is running.
126 @echo --------------------------------------------------------------------------------
127 endif
129 DevGuideProtocolHandlerAddon : $(REGISTERFLAG)
130 @echo --------------------------------------------------------------------------------
131 @echo The "$(QM)ProtocolHandler$(QM)" addon component was installed if SDK_AUTO_DEPLOYMENT = YES.
132 @echo You can use this component inside your office installation, see the example
133 @echo description.
134 @echo --------------------------------------------------------------------------------
136 %.run: $(OUT_COMP_CLASS)/%.class
137 $SDJ_JAVA) -classpath "$(SDK_CLASSPATH)" $(basename $@)
139 .PHONY: clean
140 clean :
141 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS))
142 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_MISC))
143 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL)))
144 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_JAR)))