Update ooo320-m1
[ooovba.git] / odk / examples / DevelopersGuide / Components / dialogcomponent / Makefile
blob454d5fefcd7f6d95b9392415124cd96277ed5ea1
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.4 $
7 # last change: $Author: rt $ $Date: 2008-07-11 14:20:32 $
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 dialog component 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
52 # we use the sample directory name dor separating this example
53 # from others in the output directory
54 SAMPLE_NAME=DialogComponentSample
55 SAMPLE_CLASS_OUT=$(OUT_CLASS)/$(SAMPLE_NAME)
56 SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
58 COMP_NAME=DialogComponent
59 COMP_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(COMP_NAME)
60 COMP_GEN_OUT=$(SAMPLE_GEN_OUT)/$(COMP_NAME)
61 COMP_RDB_NAME=$(COMP_NAME).uno.rdb
62 COMP_RDB=$(COMP_GEN_OUT)/$(COMP_RDB_NAME)
63 COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
64 COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
65 COMP_JAR_NAME=$(COMP_NAME).uno.jar
66 COMP_JAR=$(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME)
67 COMP_JAR_MANIFEST=$(COMP_GEN_OUT)/$(COMP_NAME).uno.Manifest
68 COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml
69 COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag
71 IDLFILES = XTestDialogHandler.idl \
72 TestDialogHandler.idl
74 # normally the idl file should be stored in a directory tree fitting the module structure,
75 # for the example we know the module structure
76 PACKAGE = com/sun/star/test
77 #PACKAGE = org/openoffice
79 COMP_JAVAFILES = DialogComponent.java
80 COMP_CLASSFILES = $(patsubst %.java,$(COMP_CLASS_OUT)/%.class,$(COMP_JAVAFILES))
82 GEN_CLASSFILES = $(patsubst %.idl,$(SAMPLE_CLASS_OUT)/$(PACKAGE)/%.class,$(IDLFILES))
83 GEN_TYPELIST = $(subst /,.,$(patsubst %.idl,-T$(PACKAGE)/% ,$(IDLFILES)))
84 GEN_URDFILES = $(patsubst %.idl,$(SAMPLE_GEN_OUT)/%.urd,$(IDLFILES))
86 # the generated types are necessary for the component and the application jar
87 GEN_CLASSFILENAMES = $(subst $(SAMPLE_CLASS_OUT)/,,$(GEN_CLASSFILES))
89 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
90 $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)\
91 $(PATH_SEPARATOR)$(COMP_CLASS_OUT)\
92 $(PATH_SEPARATOR)$(APP1_CLASS_OUT))
95 # Targets
96 .PHONY: ALL
97 ALL : DialogComponentExample
99 include $(SETTINGS)/stdtarget.mk
101 $(COMP_GEN_OUT)/%.Manifest :
102 -$(MKDIR) $(subst /,$(PS),$(@D))
103 @echo UNO-Type-Path: $(basename $(notdir $*)).uno.jar> $@
104 @echo RegistrationClassName: $(basename $*)>> $@
106 $(SAMPLE_GEN_OUT)/%.urd : %.idl
107 -$(MKDIR) $(subst /,$(PS),$(@D))
108 $(IDLC) -C -I. -I$(IDL_DIR) -O$(SAMPLE_GEN_OUT) $<
110 $(COMP_GEN_OUT)/%.rdb : $(GEN_URDFILES)
111 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
112 -$(MKDIR) $(subst /,$(PS),$(@D))
113 $(REGMERGE) $@ /UCR $(GEN_URDFILES)
115 $(GEN_CLASSFILES) : $(COMP_RDB)
116 -$(MKDIR) $(subst /,$(PS),$(@D))
117 $(JAVAMAKER) -BUCR -nD $(GEN_TYPELIST) -O$(SAMPLE_CLASS_OUT) $(COMP_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES)
119 # component as well as application are dependent from the generated types
120 # rule for component class files
121 $(COMP_CLASS_OUT)/%.class : %.java $(GEN_CLASSFILES)
122 -$(MKDIR) $(subst /,$(PS),$(@D))
123 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP_CLASS_OUT) $<
125 # rule for component jar file
126 $(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES)
127 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
128 -$(MKDIR) $(subst /,$(PS),$(@D))
129 $(SDK_JAR) cvfm $@ $< -C $(COMP_CLASS_OUT) .
130 +cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) uvf $(@F) $(GEN_CLASSFILENAMES)
132 # rule for component package manifest
133 $(COMP_GEN_OUT)/%/manifest.xml :
134 -$(MKDIR) $(subst /,$(PS),$(@D))
135 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
136 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
137 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
138 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-typelibrary;type=RDB$(QM)" >> $@
139 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
140 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
141 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
142 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
144 # rule for component package file
145 $(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST)
146 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
147 -$(MKDIR) $(subst /,$(PS),$(@D))
148 cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) ../../../bin/$(@F) $(COMP_RDB_NAME)
149 cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_JAR_NAME)
150 cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
152 $(COMP_REGISTERFLAG) : $(COMP_PACKAGE)
153 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
154 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
155 -$(MKDIR) $(subst /,$(PS),$(@D))
156 $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
157 @echo flagged > $(subst /,$(PS),$@)
158 else
159 @echo --------------------------------------------------------------------------------
160 @echo If you want to install your component automatically, please set the environment
161 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
162 @echo possible if no office instance is running.
163 @echo --------------------------------------------------------------------------------
164 endif
166 DialogComponentExample : $(COMP_REGISTERFLAG)
167 # TODO: adapt
168 @echo --------------------------------------------------------------------------------
169 @echo The PropTest was installed if SDK_AUTO_DEPLOYMENT = YES.
170 @echo Load the "$(QM)PropertySet.odt$(QM)" document to see how this component works. You can
171 @echo use this component inside your office installation, see the example description.
172 @echo -
173 @echo $(MAKE) DialogComponent.odt.load
174 @echo --------------------------------------------------------------------------------
176 DialogComponent.odt.load : $(COMP_REGISTERFLAG)
177 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
179 .PHONY: clean
180 clean :
181 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
182 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
183 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))