Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / odk / examples / DevelopersGuide / ScriptingFramework / SayHello / Makefile
blob0df943224fe1530518aad6a24bc0900a4d2b4388
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=SayHello
45 SAMPLE_CLASS_OUT = $(OUT_CLASS)/ScriptingFramework/$(SAMPLE_NAME)
46 SAMPLE_GEN_OUT = $(OUT_MISC)/ScriptingFramework
48 SCRIPT_NAME=SayHello
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_scriptpkg.flag
57 JAVAFILES = \
58 SayHello/SayHello.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 : \
68 SayHelloExample
70 include $(SETTINGS)/stdtarget.mk
72 $(CLASSFILES) : $(JAVAFILES)
73 -$(MKDIR) $(subst /,$(PS),$(@D))
74 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SCRIPT_CLASS_OUT) $(JAVAFILES)
76 $(SCRIPT_JAR) : $(CLASSFILES)
77 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
78 -$(MKDIR) $(subst /,$(PS),$(@D))
79 $(SDK_JAR) cvf $@ $(CLASSNAMES) -C $(SCRIPT_CLASS_OUT) .
81 # rule for component package file
82 $(SCRIPT_PACKAGE) : $(SCRIPT_JAR) META-INF/manifest.xml $(SCRIPT_NAME)/parcel-descriptor.xml
83 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
84 -$(MKDIR) $(subst /,$(PS),$(@D))
85 $(SDK_ZIP) $@ META-INF/manifest.xml $(SCRIPT_NAME)/parcel-descriptor.xml
86 cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)/..) && $(SDK_ZIP) -u ../../bin/$(@F) $(SAMPLE_NAME)/$(SCRIPT_JAR_NAME)
88 $(SCRIPT_REGISTERFLAG) : $(SCRIPT_PACKAGE)
89 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
90 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
91 -$(MKDIR) $(subst /,$(PS),$(@D))
92 $(DEPLOYTOOL) $(SCRIPT_PACKAGE_URL)
93 @echo flagged > $(subst /,$(PS),$@)
94 else
95 @echo --------------------------------------------------------------------------------
96 @echo If you want to install your component automatically, please set the environment
97 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
98 @echo possible if no office instance is running.
99 @echo --------------------------------------------------------------------------------
100 endif
103 SayHelloExample : $(SCRIPT_REGISTERFLAG)
104 @echo --------------------------------------------------------------------------------
105 @echo The "$(QM)$(SCRIPT_NAME)$(QM)" scripting package was installed in your office installation
106 @echo if SDK_AUTO_DEPLOYMENT = YES. If you want to run the script, start the Office
107 @echo and use the Tools/Macros/Run Macro menu item.
108 @echo You can also load the document "$(QM)$(SCRIPT_NAME).odt$(QM)" and press the button to run the
109 @echo script.
110 @echo -
111 @echo $(MAKE) $(SCRIPT_NAME).odt.load
112 @echo --------------------------------------------------------------------------------
114 $(SCRIPT_NAME).odt.load : $(SCRIPT_REGISTERFLAG)
115 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
117 %.run: $(CLASSFILES)
118 $(SDK_JAVA) -classpath "$(SDK_CLASSPATH)" $(subst /,.,$(PACKAGE)).$(basename $@)
120 %.dbg: $(JAR1_JAR)
121 jdb -classpath "$(SDK_CLASSPATH)" $(subst /,.,$(PACKAGE)).$(basename $@)
123 .PHONY: clean
124 clean :
125 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
126 -$(DELRECURSIVE) $(subst /,$(PS),$(SCRIPT_GEN_OUT))
127 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SCRIPT_PACKAGE_URL)))