1 #************************************************************** 2 # 3 # Licensed to the Apache Software Foundation (ASF) under one 4 # or more contributor license agreements. See the NOTICE file 5 # distributed with this work for additional information 6 # regarding copyright ownership. The ASF licenses this file 7 # to you under the Apache License, Version 2.0 (the 8 # "License"); you may not use this file except in compliance 9 # with the License. You may obtain a copy of the License at 10 # 11 # http://www.apache.org/licenses/LICENSE-2.0 12 # 13 # Unless required by applicable law or agreed to in writing, 14 # software distributed under the License is distributed on an 15 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 # KIND, either express or implied. See the License for the 17 # specific language governing permissions and limitations 18 # under the License. 19 # 20 #************************************************************** 21 22 # Builds the OOoBean of the Developers Guide 23 24 PRJ=../../../.. 25 SETTINGS=$(PRJ)/settings 26 27 include $(SETTINGS)/settings.mk 28 include $(SETTINGS)/std.mk 29 include $(SETTINGS)/dk.mk 30 31 # Define non-platform/compiler specific settings 32 SAMPLE_NAME=SayHello 33 SAMPLE_CLASS_OUT = $(OUT_CLASS)/ScriptingFramework/$(SAMPLE_NAME) 34 SAMPLE_GEN_OUT = $(OUT_MISC)/ScriptingFramework 35 36 SCRIPT_NAME=SayHello 37 SCRIPT_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(SCRIPT_NAME) 38 SCRIPT_GEN_OUT=$(SAMPLE_GEN_OUT)/$(SCRIPT_NAME) 39 SCRIPT_JAR_NAME=$(SCRIPT_NAME).jar 40 SCRIPT_JAR=$(SAMPLE_CLASS_OUT)/$(SCRIPT_JAR_NAME) 41 SCRIPT_PACKAGE = $(OUT_BIN)/$(SCRIPT_NAME).$(UNOOXT_EXT) 42 SCRIPT_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(SCRIPT_NAME).$(UNOOXT_EXT)") 43 SCRIPT_REGISTERFLAG=$(SCRIPT_GEN_OUT)$(PS)devguide_scriptingframework_$(SCRIPT_NAME)_register_scriptpkg.flag 44 45 JAVAFILES = \ 46 SayHello/SayHello.java 47 48 CLASSFILES = $(patsubst %.java,$(SCRIPT_CLASS_OUT)/%.class,$(subst $(SAMPLE_NAME)/,,$(JAVAFILES))) 49 50 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ 51 $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)) 52 53 # Targets 54 .PHONY: ALL 55 ALL : \ 56 SayHelloExample 57 58 include $(SETTINGS)/stdtarget.mk 59 60 $(CLASSFILES) : $(JAVAFILES) 61 -$(MKDIR) $(subst /,$(PS),$(@D)) 62 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SCRIPT_CLASS_OUT) $(JAVAFILES) 63 64 $(SCRIPT_JAR) : $(CLASSFILES) 65 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 66 -$(MKDIR) $(subst /,$(PS),$(@D)) 67 $(SDK_JAR) cvf $@ $(CLASSNAMES) -C $(SCRIPT_CLASS_OUT) . 68 69 # rule for component package file 70 $(SCRIPT_PACKAGE) : $(SCRIPT_JAR) META-INF/manifest.xml $(SCRIPT_NAME)/parcel-descriptor.xml 71 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 72 -$(MKDIR) $(subst /,$(PS),$(@D)) 73 $(SDK_ZIP) $@ META-INF/manifest.xml $(SCRIPT_NAME)/parcel-descriptor.xml 74 cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)/..) && $(SDK_ZIP) -u ../../bin/$(@F) $(SAMPLE_NAME)/$(SCRIPT_JAR_NAME) 75 76 $(SCRIPT_REGISTERFLAG) : $(SCRIPT_PACKAGE) 77 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" 78 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 79 -$(MKDIR) $(subst /,$(PS),$(@D)) 80 $(DEPLOYTOOL) $(SCRIPT_PACKAGE_URL) 81 @echo flagged > $(subst /,$(PS),$@) 82 else 83 @echo -------------------------------------------------------------------------------- 84 @echo If you want to install your component automatically, please set the environment 85 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only 86 @echo possible if no office instance is running. 87 @echo -------------------------------------------------------------------------------- 88 endif 89 90 91 SayHelloExample : $(SCRIPT_REGISTERFLAG) 92 @echo -------------------------------------------------------------------------------- 93 @echo The "$(QM)$(SCRIPT_NAME)$(QM)" scripting package was installed in your office installation 94 @echo if SDK_AUTO_DEPLOYMENT = YES. If you want to run the script, start the Office 95 @echo and use the Tools/Macros/Run Macro menu item. 96 @echo You can also load the document "$(QM)$(SCRIPT_NAME).odt$(QM)" and press the button to run the 97 @echo script. 98 @echo - 99 @echo $(MAKE) $(SCRIPT_NAME).odt.load 100 @echo -------------------------------------------------------------------------------- 101 102 $(SCRIPT_NAME).odt.load : $(SCRIPT_REGISTERFLAG) 103 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@) 104 105 %.run: $(CLASSFILES) 106 $(SDK_JAVA) -classpath "$(SDK_CLASSPATH)" $(subst /,.,$(PACKAGE)).$(basename $@) 107 108 %.dbg: $(JAR1_JAR) 109 jdb -classpath "$(SDK_CLASSPATH)" $(subst /,.,$(PACKAGE)).$(basename $@) 110 111 .PHONY: clean 112 clean : 113 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) 114 -$(DELRECURSIVE) $(subst /,$(PS),$(SCRIPT_GEN_OUT)) 115 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SCRIPT_PACKAGE_URL))) 116 117