Update ooo320-m1
[ooovba.git] / odk / examples / java / ToDo / Makefile
blobde7f0f01d09cd415af4d184c84a18fe8a7beb515
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.21 $
7 # last change: $Author: rt $ $Date: 2008-07-11 14:31:23 $
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 # Builds the Java Calc Addin example of the SDK.
43 PRJ=../../..
44 SETTINGS=$(PRJ)/settings
46 include $(SETTINGS)/settings.mk
47 include $(SETTINGS)/std.mk
48 include $(SETTINGS)/dk.mk
50 # Define non-platform/compiler specific settings
51 COMP_NAME=ToDo
52 COMP_CLASS_OUT=$(OUT_CLASS)/$(COMP_NAME)
53 COMP_GEN_OUT=$(OUT_MISC)/$(COMP_NAME)
54 COMP_RDB_NAME=$(COMP_NAME).uno.rdb
55 COMP_RDB=$(COMP_GEN_OUT)/$(COMP_RDB_NAME)
56 COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
57 COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
58 COMP_JAR_NAME=$(COMP_NAME).uno.jar
59 COMP_JAR=$(COMP_CLASS_OUT)/$(COMP_JAR_NAME)
60 COMP_JAR_MANIFEST=$(COMP_CLASS_OUT)/$(COMP_NAME).uno.Manifest
61 COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml
62 COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag
64 IDLFILES = XToDo.idl \
65 ToDo.idl
67 # normally the idl file should be stored in a directory tree fitting the module
68 # structure, for the example we know the module structure
69 PACKAGE = org/openoffice
71 COMP_JAVAFILES = ToDo.java
72 COMP_CLASSFILES = $(patsubst %.java,$(COMP_CLASS_OUT)/%.class,$(COMP_JAVAFILES))
74 GEN_CLASSFILES = $(patsubst %.idl,$(COMP_CLASS_OUT)/$(PACKAGE)/%.class,$(IDLFILES))
75 GEN_TYPELIST = $(subst /,.,$(patsubst %.idl,-T$(PACKAGE)/% ,$(IDLFILES)))
76 GEN_URDFILES = $(patsubst %.idl,$(COMP_GEN_OUT)/%.urd,$(IDLFILES))
79 $(COMP_NAME)_CLASSFILES = $(COMP_NAME).class \
80 $(COMP_NAME)$(QUOTE)$$$(COMP_NAME)Impl.class
82 $(COMP_NAME)_CLASSFILES += $(subst $(COMP_CLASS_OUT)/,,$(GEN_CLASSFILES))
84 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
85 $(PATH_SEPARATOR)$(COMP_CLASS_OUT))
88 # Targets
89 .PHONY: ALL
90 ALL : JavaToDoExample
92 include $(SETTINGS)/stdtarget.mk
94 $(COMP_CLASS_OUT)/%.Manifest :
95 -$(MKDIR) $(subst /,$(PS),$(@D))
96 @echo UNO-Type-Path: $(basename $*).uno.jar> $@
97 @echo RegistrationClassName: $(basename $(basename $(@F)))>> $@
99 $(COMP_GEN_OUT)/%.urd : %.idl
100 -$(MKDIR) $(subst /,$(PS),$(@D))
101 $(IDLC) -C -I. -I$(IDL_DIR) -O$(COMP_GEN_OUT) $<
103 $(COMP_GEN_OUT)/%.rdb : $(GEN_URDFILES)
104 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
105 -$(MKDIR) $(subst /,$(PS),$(@D))
106 $(REGMERGE) $@ /UCR $(GEN_URDFILES)
108 $(GEN_CLASSFILES) : $(COMP_RDB)
109 -$(MKDIR) $(subst /,$(PS),$(@D))
110 $(JAVAMAKER) -BUCR -nD $(GEN_TYPELIST) -O$(COMP_CLASS_OUT) $(COMP_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES)
112 $(COMP_CLASSFILES) : $(COMP_JAVAFILES) $(GEN_CLASSFILES)
113 -$(MKDIR) $(subst /,$(PS),$(@D))
114 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP_CLASS_OUT) $(COMP_JAVAFILES)
116 # rule for component jar file
117 $(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES)
118 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
119 -$(MKDIR) $(subst /,$(PS),$(@D))
120 cd $(subst /,$(PS),$(COMP_CLASS_OUT)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES)
122 # rule for component package manifest
123 $(COMP_GEN_OUT)/%/manifest.xml :
124 -$(MKDIR) $(subst /,$(PS),$(@D))
125 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
126 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
127 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
128 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-typelibrary;type=RDB$(QM)" >> $@
129 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_MISC)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
130 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
131 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_MISC)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
132 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
134 # rule for component package file
135 $(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST)
136 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
137 -$(MKDIR) $(subst /,$(PS),$(@D))
138 cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) ../../bin/$(@F) $(COMP_RDB_NAME)
139 cd $(subst /,$(PS),$(COMP_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_JAR_NAME)
140 cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) META-INF/manifest.xml
142 $(COMP_REGISTERFLAG) : $(COMP_PACKAGE)
143 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
144 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
145 -$(MKDIR) $(subst /,$(PS),$(@D))
146 $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
147 @echo flagged > $(subst /,$(PS),$@)
148 else
149 @echo --------------------------------------------------------------------------------
150 @echo If you want to install your component automatically, please set the environment
151 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
152 @echo possible if no office instance is running.
153 @echo --------------------------------------------------------------------------------
154 endif
156 JavaToDoExample : $(COMP_REGISTERFLAG)
157 @echo --------------------------------------------------------------------------------
158 @echo The $(COMP_NAME) Java component was installed if SDK_AUTO_DEPLOYMENT = YES.
159 @echo Please load the "$(QM)ToDo.ods$(QM)" document to see how this component works, see
160 @echo the example description.
161 @echo -
162 @echo $(MAKE) ToDo.ods.load
163 @echo --------------------------------------------------------------------------------
165 ToDo.ods.load : $(COMP_REGISTERFLAG)
166 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
168 .PHONY: clean
169 clean :
170 -$(DELRECURSIVE) $(subst /,$(PS),$(COMP_CLASS_OUT))
171 -$(DELRECURSIVE) $(subst /,$(PS),$(COMP_GEN_OUT))
172 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))