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