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 JagielskiPRJ=../../../.. 23*b1cdbd2cSJim JagielskiSETTINGS=$(PRJ)/settings 24*b1cdbd2cSJim Jagielski 25*b1cdbd2cSJim Jagielskiinclude $(SETTINGS)/settings.mk 26*b1cdbd2cSJim Jagielskiinclude $(SETTINGS)/std.mk 27*b1cdbd2cSJim Jagielski# include $(SETTINGS)/dk.mk 28*b1cdbd2cSJim Jagielski 29*b1cdbd2cSJim Jagielski# Define non-platform/compiler specific settings 30*b1cdbd2cSJim Jagielski 31*b1cdbd2cSJim Jagielski# we use the sample directory name for separating this example 32*b1cdbd2cSJim Jagielski# from others in the output directory 33*b1cdbd2cSJim JagielskiSAMPLE_NAME=EmbeddedObject 34*b1cdbd2cSJim JagielskiSAMPLE_CLASS_OUT=$(OUT_CLASS)/$(SAMPLE_NAME) 35*b1cdbd2cSJim JagielskiSAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME) 36*b1cdbd2cSJim Jagielski 37*b1cdbd2cSJim JagielskiCOMP_NAME=OwnEmbeddedObject 38*b1cdbd2cSJim JagielskiCOMP_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(COMP_NAME) 39*b1cdbd2cSJim JagielskiCOMP_GEN_OUT=$(SAMPLE_GEN_OUT)/$(COMP_NAME) 40*b1cdbd2cSJim JagielskiCOMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) 41*b1cdbd2cSJim JagielskiCOMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") 42*b1cdbd2cSJim JagielskiCOMP_JAR_NAME=$(COMP_NAME).uno.jar 43*b1cdbd2cSJim JagielskiCOMP_JAR=$(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME) 44*b1cdbd2cSJim JagielskiCOMP_JAR_MANIFEST=$(COMP_GEN_OUT)/$(COMP_NAME).Manifest 45*b1cdbd2cSJim JagielskiCOMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml 46*b1cdbd2cSJim JagielskiCOMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag 47*b1cdbd2cSJim JagielskiCOMP_COMPONENTS=$(COMP_NAME).components 48*b1cdbd2cSJim Jagielski 49*b1cdbd2cSJim JagielskiPACKAGE = org/openoffice/examples/embedding 50*b1cdbd2cSJim Jagielski 51*b1cdbd2cSJim JagielskiCOMP_JAVAFILES =\ 52*b1cdbd2cSJim Jagielski OwnEmbeddedObject.java\ 53*b1cdbd2cSJim Jagielski OwnEmbeddedObjectFactory.java\ 54*b1cdbd2cSJim Jagielski EditorFrame.java 55*b1cdbd2cSJim Jagielski 56*b1cdbd2cSJim JagielskiCOMP_CLASSFILES = $(patsubst %.java,$(COMP_CLASS_OUT)/%.class,$(COMP_JAVAFILES)) 57*b1cdbd2cSJim Jagielski 58*b1cdbd2cSJim JagielskiSDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ 59*b1cdbd2cSJim Jagielski $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)\ 60*b1cdbd2cSJim Jagielski $(PATH_SEPARATOR)$(COMP_CLASS_OUT)) 61*b1cdbd2cSJim Jagielski 62*b1cdbd2cSJim Jagielski 63*b1cdbd2cSJim Jagielski# Targets 64*b1cdbd2cSJim Jagielski.PHONY: ALL 65*b1cdbd2cSJim JagielskiALL : $(COMP_NAME) 66*b1cdbd2cSJim Jagielski 67*b1cdbd2cSJim Jagielskiinclude $(SETTINGS)/stdtarget.mk 68*b1cdbd2cSJim Jagielski 69*b1cdbd2cSJim Jagielski$(COMP_GEN_OUT)/%.Manifest : 70*b1cdbd2cSJim Jagielski -$(MKDIR) $(subst \\,\,$(subst /,$(PS),$(@D))) 71*b1cdbd2cSJim Jagielski @echo RegistrationClassName: $(subst /,.,$(PACKAGE)).$(COMP_NAME)Factory> $@ 72*b1cdbd2cSJim Jagielski 73*b1cdbd2cSJim Jagielski# component as well as application are dependent from the generated types 74*b1cdbd2cSJim Jagielski# rule for component class files 75*b1cdbd2cSJim Jagielski$(COMP_CLASS_OUT)/%.class : $(COMP_JAVAFILES) 76*b1cdbd2cSJim Jagielski -$(MKDIR) $(subst /,$(PS),$(@D)) 77*b1cdbd2cSJim Jagielski $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP_CLASS_OUT) $(COMP_JAVAFILES) 78*b1cdbd2cSJim Jagielski 79*b1cdbd2cSJim Jagielski# rule for component jar file 80*b1cdbd2cSJim Jagielski$(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES) 81*b1cdbd2cSJim Jagielski -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 82*b1cdbd2cSJim Jagielski -$(MKDIR) $(subst /,$(PS),$(@D)) 83*b1cdbd2cSJim Jagielski $(SDK_JAR) cvfm $@ $< -C $(COMP_CLASS_OUT) . 84*b1cdbd2cSJim Jagielski 85*b1cdbd2cSJim Jagielski# rule for component package manifest 86*b1cdbd2cSJim Jagielski$(COMP_GEN_OUT)/%/manifest.xml : 87*b1cdbd2cSJim Jagielski -$(MKDIR) $(subst /,$(PS),$(@D)) 88*b1cdbd2cSJim Jagielski @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ 89*b1cdbd2cSJim Jagielski @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@ 90*b1cdbd2cSJim Jagielski @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@ 91*b1cdbd2cSJim Jagielski @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(SAMPLE_NAME).xcu$(QM)"/$(CSEP) >> $@ 92*b1cdbd2cSJim Jagielski @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@ 93*b1cdbd2cSJim Jagielski @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@ 94*b1cdbd2cSJim Jagielski @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ 95*b1cdbd2cSJim Jagielski 96*b1cdbd2cSJim Jagielski# rule for component package file 97*b1cdbd2cSJim Jagielski$(COMP_PACKAGE) : $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_NAME).components 98*b1cdbd2cSJim Jagielski -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 99*b1cdbd2cSJim Jagielski -$(MKDIR) $(subst /,$(PS),$(@D)) 100*b1cdbd2cSJim Jagielski $(SDK_ZIP) $@ $(SAMPLE_NAME).xcu 101*b1cdbd2cSJim Jagielski $(SDK_ZIP) $@ -u $(COMP_NAME).components 102*b1cdbd2cSJim Jagielski cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u $@ $(COMP_JAR_NAME) 103*b1cdbd2cSJim Jagielski cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u $@ META-INF/manifest.xml 104*b1cdbd2cSJim Jagielski 105*b1cdbd2cSJim Jagielski$(COMP_REGISTERFLAG) : $(COMP_PACKAGE) 106*b1cdbd2cSJim Jagielskiifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" 107*b1cdbd2cSJim Jagielski -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 108*b1cdbd2cSJim Jagielski -$(MKDIR) $(subst \\,\,$(subst /,$(PS),$(@D))) 109*b1cdbd2cSJim Jagielski $(DEPLOYTOOL) $(COMP_PACKAGE_URL) 110*b1cdbd2cSJim Jagielski @echo flagged > $(subst /,$(PS),$@) 111*b1cdbd2cSJim Jagielskielse 112*b1cdbd2cSJim Jagielski @echo -------------------------------------------------------------------------------- 113*b1cdbd2cSJim Jagielski @echo If you want to install your component automatically, please set the environment 114*b1cdbd2cSJim Jagielski @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only 115*b1cdbd2cSJim Jagielski @echo possible if no office instance is running. 116*b1cdbd2cSJim Jagielski @echo -------------------------------------------------------------------------------- 117*b1cdbd2cSJim Jagielskiendif 118*b1cdbd2cSJim Jagielski 119*b1cdbd2cSJim Jagielski$(COMP_NAME) : $(COMP_REGISTERFLAG) 120*b1cdbd2cSJim Jagielski @echo ------ 121*b1cdbd2cSJim Jagielski @echo The $(COMP_NAME) component was installed if SDK_AUTO_DEPLOYMENT = YES. 122*b1cdbd2cSJim Jagielski @echo Load the "$(QM)$(SAMPLE_NAME).odt$(QM)" document to see how this component works. 123*b1cdbd2cSJim Jagielski @echo You can use this component inside your office installation, see the example 124*b1cdbd2cSJim Jagielski @echo description. 125*b1cdbd2cSJim Jagielski @echo - 126*b1cdbd2cSJim Jagielski @echo $(MAKE) $(SAMPLE_NAME).odt.load 127*b1cdbd2cSJim Jagielski @echo -------------------------------------------------------------------------------- 128*b1cdbd2cSJim Jagielski 129*b1cdbd2cSJim Jagielski$(SAMPLE_NAME).odt.load : $(COMP_REGISTERFLAG) 130*b1cdbd2cSJim Jagielski "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@) 131*b1cdbd2cSJim Jagielski 132*b1cdbd2cSJim Jagielski.PHONY: clean 133*b1cdbd2cSJim Jagielskiclean : 134*b1cdbd2cSJim Jagielski -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) 135*b1cdbd2cSJim Jagielski -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT)) 136*b1cdbd2cSJim Jagielski -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) 137