Update ooo320-m1
[ooovba.git] / odk / examples / java / EmbedDocument / EmbeddedObject / Makefile
bloba5a637c7c647b45633c1b26f635295030fcf0d59
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.3 $
7 # last change: $Author: rt $ $Date: 2008-07-11 14:28:54 $
9 # The Contents of this file are made available subject to the terms of
10 # the BSD license.
12 # Copyright (c) 2003 by Sun Microsystems, Inc.
13 # All rights reserved.
15 # Redistribution and use in source and binary forms, with or without
16 # modification, are permitted provided that the following conditions
17 # are met:
18 # 1. Redistributions of source code must retain the above copyright
19 # notice, this list of conditions and the following disclaimer.
20 # 2. Redistributions in binary form must reproduce the above copyright
21 # notice, this list of conditions and the following disclaimer in the
22 # documentation and/or other materials provided with the distribution.
23 # 3. Neither the name of Sun Microsystems, Inc. nor the names of its
24 # contributors may be used to endorse or promote products derived
25 # from this software without specific prior written permission.
27 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
34 # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36 # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #**************************************************************************
41 PRJ=../../../..
42 SETTINGS=$(PRJ)/settings
44 include $(SETTINGS)/settings.mk
45 include $(SETTINGS)/std.mk
46 # include $(SETTINGS)/dk.mk
48 # Define non-platform/compiler specific settings
50 # we use the sample directory name for separating this example
51 # from others in the output directory
52 SAMPLE_NAME=EmbeddedObject
53 SAMPLE_CLASS_OUT=$(OUT_CLASS)/$(SAMPLE_NAME)
54 SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
56 COMP_NAME=OwnEmbeddedObject
57 COMP_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(COMP_NAME)
58 COMP_GEN_OUT=$(SAMPLE_GEN_OUT)/$(COMP_NAME)
59 COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
60 COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
61 COMP_JAR_NAME=$(COMP_NAME).uno.jar
62 COMP_JAR=$(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME)
63 COMP_JAR_MANIFEST=$(COMP_GEN_OUT)/$(COMP_NAME).Manifest
64 COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml
65 COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag
67 PACKAGE = org/openoffice/examples/embedding
69 COMP_JAVAFILES =\
70 OwnEmbeddedObject.java\
71 OwnEmbeddedObjectFactory.java\
72 EditorFrame.java
74 COMP_CLASSFILES = $(patsubst %.java,$(COMP_CLASS_OUT)/%.class,$(COMP_JAVAFILES))
76 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
77 $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)\
78 $(PATH_SEPARATOR)$(COMP_CLASS_OUT))
81 # Targets
82 .PHONY: ALL
83 ALL : $(COMP_NAME)
85 include $(SETTINGS)/stdtarget.mk
87 $(COMP_GEN_OUT)/%.Manifest :
88 -$(MKDIR) $(subst \\,\,$(subst /,$(PS),$(@D)))
89 @echo RegistrationClassName: $(subst /,.,$(PACKAGE)).$(COMP_NAME)Factory> $@
91 # component as well as application are dependent from the generated types
92 # rule for component class files
93 $(COMP_CLASS_OUT)/%.class : $(COMP_JAVAFILES)
94 -$(MKDIR) $(subst /,$(PS),$(@D))
95 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP_CLASS_OUT) $(COMP_JAVAFILES)
97 # rule for component jar file
98 $(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES)
99 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
100 -$(MKDIR) $(subst /,$(PS),$(@D))
101 $(SDK_JAR) cvfm $@ $< -C $(COMP_CLASS_OUT) .
103 # rule for component package manifest
104 $(COMP_GEN_OUT)/%/manifest.xml :
105 -$(MKDIR) $(subst /,$(PS),$(@D))
106 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
107 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
108 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
109 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).uno.jar$(QM)"/$(CSEP) >> $@
110 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
111 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(SAMPLE_NAME).xcu$(QM)"/$(CSEP) >> $@
112 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
114 # rule for component package file
115 $(COMP_PACKAGE) : $(COMP_JAR) $(COMP_UNOPKG_MANIFEST)
116 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
117 -$(MKDIR) $(subst /,$(PS),$(@D))
118 $(SDK_ZIP) $@ $(COMP_JAR_NAME) $(SAMPLE_NAME).xcu
119 cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) $@ $(COMP_JAR_NAME)
120 cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u $@ META-INF/manifest.xml
122 $(COMP_REGISTERFLAG) : $(COMP_PACKAGE)
123 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
124 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
125 -$(MKDIR) $(subst \\,\,$(subst /,$(PS),$(@D)))
126 $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
127 @echo flagged > $(subst /,$(PS),$@)
128 else
129 @echo --------------------------------------------------------------------------------
130 @echo If you want to install your component automatically, please set the environment
131 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
132 @echo possible if no office instance is running.
133 @echo --------------------------------------------------------------------------------
134 endif
136 $(COMP_NAME) : $(COMP_REGISTERFLAG)
137 @echo ------
138 @echo The $(COMP_NAME) component was installed if SDK_AUTO_DEPLOYMENT = YES.
139 @echo Load the "$(QM)$(SAMPLE_NAME).odt$(QM)" document to see how this component works.
140 @echo You can use this component inside your office installation, see the example
141 @echo description.
142 @echo -
143 @echo $(MAKE) $(SAMPLE_NAME).odt.load
144 @echo --------------------------------------------------------------------------------
146 $(SAMPLE_NAME).odt.load : $(COMP_REGISTERFLAG)
147 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
149 .PHONY: clean
150 clean :
151 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
152 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
153 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))