update dev300-m58
[ooovba.git] / odk / examples / java / Inspector / Makefile
blobd1a3b41a4e3f9f74ae1cd55dd3ac05a043ef09a5
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.23 $
7 # last change: $Author: rt $ $Date: 2008-07-11 14:29:48 $
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 InstanceInspector 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=InstanceInspector
55 SAMPLE_CLASS_OUT=$(OUT_CLASS)/$(SAMPLE_NAME)
56 SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
58 # some special macro names for separating the component jar stuff
59 COMP_NAME=Inspector
60 COMP_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(COMP_NAME)
61 COMP_GEN_OUT=$(SAMPLE_GEN_OUT)/$(COMP_NAME)
62 COMP_RDB_NAME=$(COMP_NAME).uno.rdb
63 COMP_RDB=$(COMP_GEN_OUT)/$(COMP_RDB_NAME)
64 COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
65 COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
66 COMP_JAR_NAME=$(COMP_NAME).uno.jar
67 COMP_JAR=$(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME)
68 COMP_JAR_MANIFEST=$(COMP_GEN_OUT)/$(COMP_NAME).uno.Manifest
69 COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml
70 COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag
72 IDLFILES = InstanceInspector.idl \
73 XInstanceInspector.idl
75 # normally the idl file should be stored in a directory tree fitting the
76 # module structure, for the example we know the module structure
77 PACKAGE = org/openoffice
79 COMP_JAVAFILES = XDialogProvider.java XTreeControlProvider.java XTreePathProvider.java MethodParametersDialog.java HideableMutableTreeNode.java HideableTreeModel.java Introspector.java XUnoNode.java SwingUnoNode.java UnoNode.java XUnoMethodNode.java SwingUnoMethodNode.java UnoMethodNode.java XUnoPropertyNode.java SwingUnoPropertyNode.java UnoPropertyNode.java XUnoFacetteNode.java SwingUnoFacetteNode.java TDocSupplier.java UnoTreeRenderer.java InspectorAddon.java XLanguageSourceCodeGenerator.java SourceCodeGenerator.java InspectorPane.java SwingDialogProvider.java SwingTreeControlProvider.java SwingTreePathProvider.java Inspector.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 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))
93 COMP_IMAGE_FILES= images/containers_16.png \
94 images/content_16.png \
95 images/interfaces_16.png \
96 images/methods_16.png \
97 images/properties_16.png \
98 images/services_16.png
100 # Targets
101 .PHONY: ALL
102 ALL : JavaInspectorExample
104 include $(SETTINGS)/stdtarget.mk
106 # rule for component manifest file
107 $(COMP_GEN_OUT)/%.Manifest :
108 -$(MKDIR) $(subst /,$(PS),$(@D))
109 @echo RegistrationClassName: $(basename $(basename $(@F)))> $@
111 # rule for compiling the IDL files
112 $(SAMPLE_GEN_OUT)/%.urd : %.idl
113 -$(MKDIR) $(subst /,$(PS),$(@D))
114 $(IDLC) -C -I. -I$(IDL_DIR) -O$(SAMPLE_GEN_OUT) $<
116 # rule for creating the component rdb file
117 $(COMP_GEN_OUT)/%.rdb : $(GEN_URDFILES)
118 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
119 -$(MKDIR) $(subst /,$(PS),$(@D))
120 $(REGMERGE) $@ /UCR $(GEN_URDFILES)
122 # rule for creating IDL dependent class files
123 $(GEN_CLASSFILES) : $(COMP_RDB)
124 -$(MKDIR) $(subst /,$(PS),$(@D))
125 $(JAVAMAKER) -BUCR -nD $(GEN_TYPELIST) -O$(SAMPLE_CLASS_OUT) $(COMP_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES)
127 # component as well as application are dependent from the generated types
128 # rule for component class files
129 $(COMP_CLASS_OUT)/%.class : %.java $(GEN_CLASSFILES)
130 -$(MKDIR) $(subst /,$(PS),$(@D))
131 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -sourcepath . -d $(COMP_CLASS_OUT) $<
133 # rule for component jar file
134 $(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES) $(COMP_IMAGE_FILES)
135 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
136 -$(MKDIR) $(subst /,$(PS),$(@D))
137 $(SDK_JAR) cvfm $@ $< -C $(COMP_CLASS_OUT) .
138 +cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) uvf $(@F) $(GEN_CLASSFILENAMES)
139 +$(SDK_JAR) uvf $@ $(COMP_IMAGE_FILES)
141 # rule for component package manifest
142 $(COMP_GEN_OUT)/%/manifest.xml :
143 -$(MKDIR) $(subst /,$(PS),$(@D))
144 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
145 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
146 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
147 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
148 @echo $(SQM) $(SQM)manifest:full-path="$(QM)Addons.xcu$(QM)"/$(CSEP) >> $@
149 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
150 @echo $(SQM) $(SQM)manifest:full-path="$(QM)ProtocolHandler.xcu$(QM)"/$(CSEP) >> $@
151 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-schema$(QM)" >> $@
152 @echo $(SQM) $(SQM)manifest:full-path="$(QM)ObjectInspector.xcs$(QM)"/$(CSEP) >> $@
153 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
154 @echo $(SQM) $(SQM)manifest:full-path="$(QM)ObjectInspector.xcu$(QM)"/$(CSEP) >> $@
155 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-typelibrary;type=RDB$(QM)" >> $@
156 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
157 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
158 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
159 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
161 # rule for component package file
162 $(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) Addons.xcu ProtocolHandler.xcu ObjectInspector.xcu ObjectInspector.xcs $(COMP_UNOPKG_MANIFEST)
163 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
164 -$(MKDIR) $(subst /,$(PS),$(@D))
165 cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) ../../../bin/$(@F) $(COMP_RDB_NAME)
167 cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_JAR_NAME)
168 $(SDK_ZIP) -u $@ Addons.xcu ProtocolHandler.xcu ObjectInspector.xcu ObjectInspector.xcs
169 cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
171 $(COMP_REGISTERFLAG) : $(COMP_PACKAGE)
172 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
173 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
174 -$(MKDIR) $(subst /,$(PS),$(@D))
175 $(DEPLOYTOOL) $(COMP_PACKAGE_URL)
176 @echo flagged > $(subst /,$(PS),$@)
177 else
178 @echo --------------------------------------------------------------------------------
179 @echo If you want to install your component automatically, please set the environment
180 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
181 @echo possible if no office instance is running.
182 @echo --------------------------------------------------------------------------------
183 endif
185 JavaInspectorExample : $(COMP_REGISTERFLAG)
186 @echo --------------------------------------------------------------------------------
187 @echo The InstanceInspector component was installed if SDK_AUTO_DEPLOYMENT = YES.
188 @echo You can use this component inside your office installation, see the example
189 @echo document.
190 @echo -
191 @echo $(MAKE) InstanceInspectorTest.odt.load
192 @echo --------------------------------------------------------------------------------
194 InstanceInspectorTest.odt.load : $(COMP_REGISTERFLAG)
195 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
197 .PHONY: clean
198 clean :
199 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
200 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
201 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))