Update ooo320-m1
[ooovba.git] / odk / examples / DevelopersGuide / ScriptingFramework / ScriptSelector / Makefile
bloba5a2744f5a712aad00b54f64619e01fd5f2e9bf8
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.5 $
7 # last change: $Author: hr $ $Date: 2007-07-31 13:57:07 $
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 OOoBean 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 SAMPLE_NAME=ScriptSelector
52 SAMPLE_CLASS_OUT = $(OUT_CLASS)/ScriptingFramework/$(SAMPLE_NAME)
53 SAMPLE_GEN_OUT = $(OUT_MISC)/ScriptingFramework
55 SCRIPT_NAME=ScriptSelector
56 SCRIPT_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(SCRIPT_NAME)
57 SCRIPT_GEN_OUT=$(SAMPLE_GEN_OUT)/$(SCRIPT_NAME)
58 SCRIPT_JAR_NAME=$(SCRIPT_NAME).jar
59 SCRIPT_JAR=$(SAMPLE_CLASS_OUT)/$(SCRIPT_JAR_NAME)
60 SCRIPT_PACKAGE = $(OUT_BIN)/$(SCRIPT_NAME).$(UNOOXT_EXT)
61 SCRIPT_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(SCRIPT_NAME).$(UNOOXT_EXT)")
62 SCRIPT_REGISTERFLAG=$(SCRIPT_GEN_OUT)$(PS)devguide_scriptingframework_$(SCRIPT_NAME)_register.flag
64 JAVAFILES = \
65 ScriptSelector/ScriptSelector.java
67 CLASSFILES = $(patsubst %.java,$(SCRIPT_CLASS_OUT)/%.class,$(subst $(SAMPLE_NAME)/,,$(JAVAFILES)))
69 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
70 $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT))
72 # Targets
73 .PHONY: ALL
74 ALL : ScriptSelectorExample
76 include $(SETTINGS)/stdtarget.mk
78 $(CLASSFILES) : $(JAVAFILES)
79 -$(MKDIR) $(subst /,$(PS),$(@D))
80 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SCRIPT_CLASS_OUT) $(JAVAFILES)
82 $(SCRIPT_JAR) : $(CLASSFILES) $(SCRIPT_NAME)/container.gif $(SCRIPT_NAME)/script.gif $(SCRIPT_NAME)/soffice.gif
83 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
84 -$(MKDIR) $(subst /,$(PS),$(@D))
85 $(COPY) $(subst /,$(PS),$(SCRIPT_NAME)/container.gif) $(subst /,$(PS),$(SCRIPT_CLASS_OUT))
86 $(COPY) $(subst /,$(PS),$(SCRIPT_NAME)/script.gif) $(subst /,$(PS),$(SCRIPT_CLASS_OUT))
87 $(COPY) $(subst /,$(PS),$(SCRIPT_NAME)/soffice.gif) $(subst /,$(PS),$(SCRIPT_CLASS_OUT))
88 $(SDK_JAR) cvf $@ -C $(SCRIPT_CLASS_OUT) .
90 # rule for component package file
91 $(SCRIPT_PACKAGE) : $(SCRIPT_JAR) META-INF/manifest.xml $(SCRIPT_NAME)/parcel-descriptor.xml
92 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
93 -$(MKDIR) $(subst /,$(PS),$(@D))
94 $(SDK_ZIP) $@ META-INF/manifest.xml $(SCRIPT_NAME)/parcel-descriptor.xml
95 cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)/..) && $(SDK_ZIP) -u ../../bin/$(@F) $(SAMPLE_NAME)/$(SCRIPT_JAR_NAME)
97 $(SCRIPT_REGISTERFLAG) : $(SCRIPT_PACKAGE)
98 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
99 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
100 -$(MKDIR) $(subst /,$(PS),$(@D))
101 $(DEPLOYTOOL) $(SCRIPT_PACKAGE_URL)
102 @echo flagged > $(subst /,$(PS),$@)
103 else
104 @echo --------------------------------------------------------------------------------
105 @echo If you want to install your component automatically, please set the environment
106 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
107 @echo possible if no office instance is running.
108 @echo --------------------------------------------------------------------------------
109 endif
112 ScriptSelectorExample : $(SCRIPT_REGISTERFLAG)
113 @echo --------------------------------------------------------------------------------
114 @echo The "$(QM)$(SCRIPT_NAME)$(QM)" scripting package was installed in your office installation
115 @echo if SDK_AUTO_DEPLOYMENT = YES. If you want to run the script, start the Office
116 @echo and use the Tools/Macros/Run Macro menu item.
117 @echo You can also load the document "$(QM)$(SCRIPT_NAME).odt$(QM)" and press the button to run
118 @echo the script.
119 @echo -
120 @echo $(MAKE) $(SCRIPT_NAME).odt.load
121 @echo --------------------------------------------------------------------------------
123 $(SCRIPT_NAME).odt.load : $(SCRIPT_REGISTERFLAG)
124 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
126 %.run: $(CLASSFILES)
127 $(SDK_JAVA) -classpath "$(SDK_CLASSPATH)" $(subst /,.,$(PACKAGE)).$(basename $@)
129 %.dbg: $(JAR1_JAR)
130 jdb -classpath "$(SDK_CLASSPATH)" $(subst /,.,$(PACKAGE)).$(basename $@)
132 .PHONY: clean
133 clean :
134 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
135 -$(DELRECURSIVE) $(subst /,$(PS),$(SCRIPT_GEN_OUT))
136 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SCRIPT_PACKAGE_URL)))