Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / odk / examples / DevelopersGuide / ScriptingFramework / ScriptSelector / Makefile
blob6fa4046bd041d69fa3a9ec721e7ba2d42c65ec77
1 #*************************************************************************
3 # The Contents of this file are made available subject to the terms of
4 # the BSD license.
5 #
6 # Copyright 2000, 2010 Oracle and/or its affiliates.
7 # All rights reserved.
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
11 # are met:
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
17 # 3. Neither the name of Sun Microsystems, Inc. nor the names of its
18 # contributors may be used to endorse or promote products derived
19 # from this software without specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
30 # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
31 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #**************************************************************************
35 # Builds the OOoBean of the Developers Guide
37 PRJ=../../../..
38 SETTINGS=$(PRJ)/settings
40 include $(SETTINGS)/settings.mk
41 include $(SETTINGS)/std.mk
43 # Define non-platform/compiler specific settings
44 SAMPLE_NAME=ScriptSelector
45 SAMPLE_CLASS_OUT = $(OUT_CLASS)/ScriptingFramework/$(SAMPLE_NAME)
46 SAMPLE_GEN_OUT = $(OUT_MISC)/ScriptingFramework
48 SCRIPT_NAME=ScriptSelector
49 SCRIPT_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(SCRIPT_NAME)
50 SCRIPT_GEN_OUT=$(SAMPLE_GEN_OUT)/$(SCRIPT_NAME)
51 SCRIPT_JAR_NAME=$(SCRIPT_NAME).jar
52 SCRIPT_JAR=$(SAMPLE_CLASS_OUT)/$(SCRIPT_JAR_NAME)
53 SCRIPT_PACKAGE = $(OUT_BIN)/$(SCRIPT_NAME).$(UNOOXT_EXT)
54 SCRIPT_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(SCRIPT_NAME).$(UNOOXT_EXT)")
55 SCRIPT_REGISTERFLAG=$(SCRIPT_GEN_OUT)$(PS)devguide_scriptingframework_$(SCRIPT_NAME)_register.flag
57 JAVAFILES = \
58 ScriptSelector/ScriptSelector.java
60 CLASSFILES = $(patsubst %.java,$(SCRIPT_CLASS_OUT)/%.class,$(subst $(SAMPLE_NAME)/,,$(JAVAFILES)))
62 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
63 $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT))
65 # Targets
66 .PHONY: ALL
67 ALL : ScriptSelectorExample
69 include $(SETTINGS)/stdtarget.mk
71 $(CLASSFILES) : $(JAVAFILES)
72 -$(MKDIR) $(subst /,$(PS),$(@D))
73 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SCRIPT_CLASS_OUT) $(JAVAFILES)
75 $(SCRIPT_JAR) : $(CLASSFILES) $(SCRIPT_NAME)/container.gif $(SCRIPT_NAME)/script.gif $(SCRIPT_NAME)/soffice.gif
76 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
77 -$(MKDIR) $(subst /,$(PS),$(@D))
78 $(COPY) $(subst /,$(PS),$(SCRIPT_NAME)/container.gif) $(subst /,$(PS),$(SCRIPT_CLASS_OUT))
79 $(COPY) $(subst /,$(PS),$(SCRIPT_NAME)/script.gif) $(subst /,$(PS),$(SCRIPT_CLASS_OUT))
80 $(COPY) $(subst /,$(PS),$(SCRIPT_NAME)/soffice.gif) $(subst /,$(PS),$(SCRIPT_CLASS_OUT))
81 $(SDK_JAR) cvf $@ -C $(SCRIPT_CLASS_OUT) .
83 # rule for component package file
84 $(SCRIPT_PACKAGE) : $(SCRIPT_JAR) META-INF/manifest.xml $(SCRIPT_NAME)/parcel-descriptor.xml
85 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
86 -$(MKDIR) $(subst /,$(PS),$(@D))
87 $(SDK_ZIP) $@ META-INF/manifest.xml $(SCRIPT_NAME)/parcel-descriptor.xml
88 cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)/..) && $(SDK_ZIP) -u ../../bin/$(@F) $(SAMPLE_NAME)/$(SCRIPT_JAR_NAME)
90 $(SCRIPT_REGISTERFLAG) : $(SCRIPT_PACKAGE)
91 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
92 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
93 -$(MKDIR) $(subst /,$(PS),$(@D))
94 $(DEPLOYTOOL) $(SCRIPT_PACKAGE_URL)
95 @echo flagged > $(subst /,$(PS),$@)
96 else
97 @echo --------------------------------------------------------------------------------
98 @echo If you want to install your component automatically, please set the environment
99 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
100 @echo possible if no office instance is running.
101 @echo --------------------------------------------------------------------------------
102 endif
105 ScriptSelectorExample : $(SCRIPT_REGISTERFLAG)
106 @echo --------------------------------------------------------------------------------
107 @echo The "$(QM)$(SCRIPT_NAME)$(QM)" scripting package was installed in your office installation
108 @echo if SDK_AUTO_DEPLOYMENT = YES. If you want to run the script, start the Office
109 @echo and use the Tools/Macros/Run Macro menu item.
110 @echo You can also load the document "$(QM)$(SCRIPT_NAME).odt$(QM)" and press the button to run
111 @echo the script.
112 @echo -
113 @echo $(MAKE) $(SCRIPT_NAME).odt.load
114 @echo --------------------------------------------------------------------------------
116 $(SCRIPT_NAME).odt.load : $(SCRIPT_REGISTERFLAG)
117 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
119 %.run: $(CLASSFILES)
120 $(SDK_JAVA) -classpath "$(SDK_CLASSPATH)" $(subst /,.,$(PACKAGE)).$(basename $@)
122 %.dbg: $(JAR1_JAR)
123 jdb -classpath "$(SDK_CLASSPATH)" $(subst /,.,$(PACKAGE)).$(basename $@)
125 .PHONY: clean
126 clean :
127 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
128 -$(DELRECURSIVE) $(subst /,$(PS),$(SCRIPT_GEN_OUT))
129 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SCRIPT_PACKAGE_URL)))