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