Update ooo320-m1
[ooovba.git] / odk / examples / DevelopersGuide / BasicAndDialogs / CreatingDialogs / Makefile
blob6716bed3be4a8278de4e2a68eaec8ed0bf3261ed
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.8 $
7 # last change: $Author: obo $ $Date: 2007-01-25 11:02:46 $
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 CreatingDialogs example of the Developers Guide.
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 EXAMPLE_NAME=BaDCreatingDialogsExample
52 OUT_COMP_CLASS = $(OUT_CLASS)/$(EXAMPLE_NAME)
54 COMPONENT_NAME=SampleDialog
55 COMPONENT_PACKAGE = $(OUT_BIN)/$(COMPONENT_NAME).$(UNOOXT_EXT)
56 COMPONENT_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).$(UNOOXT_EXT)")
57 COMPONENT_JAR_NAME = $(COMPONENT_NAME).uno.jar
58 COMPONENT_JAR = $(OUT_CLASS)/$(COMPONENT_JAR_NAME)
59 COMPONENT_MANIFESTFILE = $(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest
60 COMPONENT_UNOPKG_MANIFEST = $(OUT_COMP_CLASS)/$(COMPONENT_NAME)/META-INF/manifest.xml
61 REGISTERFLAG = $(OUT_MISC)/devguide_basicanddialogs_creatingdialogs_register_component.flag
63 # often the java files are structured in a hierarchy similar to the package,
64 # for the example we know the package
65 PACKAGE = com.sun.star.comp.sdk.examples
67 JAVAFILES = \
68 SampleDialog.java
70 CLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(JAVAFILES))
72 $(COMPONENT_NAME)_CLASSFILES = SampleDialog.class \
74 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
75 $(PATH_SEPARATOR)$(OUT_COMP_CLASS))
78 # Targets
79 .PHONY: ALL
80 ALL: $(EXAMPLE_NAME)
82 include $(SETTINGS)/stdtarget.mk
84 $(OUT_COMP_CLASS)/%.Manifest :
85 -$(MKDIR) $(subst /,$(PS),$(@D))
86 @echo RegistrationClassName: $(PACKAGE).$(basename $(basename $(@F)))> $@
88 $(OUT_COMP_CLASS)/%.class : %.java
89 -$(MKDIR) $(subst /,$(PS),$(@D))
90 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $<
92 # rule for component jar file
93 $(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(CLASSFILES)
94 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
95 -$(MKDIR) $(subst /,$(PS),$(@D))
96 $(SDK_JAR) cvfm $@ $< -C $(OUT_COMP_CLASS) .
98 # rule for component package manifest
99 $(OUT_COMP_CLASS)/%/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)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
103 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
104 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
105 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_CLASS)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
106 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
108 # rule for component package file
109 $(COMPONENT_PACKAGE) : $(COMPONENT_JAR) $(COMPONENT_UNOPKG_MANIFEST)
110 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
111 -$(MKDIR) $(subst /,$(PS),$(@D))
112 cd $(subst /,$(PS),$(OUT_CLASS)) && $(SDK_ZIP) ../bin/$(@F) $(<F)
113 cd $(subst /,$(PS),$(OUT_COMP_CLASS)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
115 $(REGISTERFLAG) : $(COMPONENT_PACKAGE)
116 ifneq "$(SDK_AUTO_DEPLOYMENT)" ""
117 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
118 -$(MKDIR) $(subst /,$(PS),$(@D))
119 $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL)
120 @echo flagged > $(subst /,$(PS),$@)
121 else
122 @echo --------------------------------------------------------------------------------
123 @echo If you want to install your component automatically, please set the environment
124 @echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only
125 @echo possible if no office instance is running.
126 @echo --------------------------------------------------------------------------------
127 endif
129 $(EXAMPLE_NAME) : $(REGISTERFLAG)
130 @echo --------------------------------------------------------------------------------
131 @echo The SampleDialog Java component was installed if SDK_AUTO_DEPLOYMENT = YES.
132 @echo Please load the "$(QM)CreatingDialogs.odt$(QM)" document to use the component or use it
133 @echo by yourself in your office installation, see the example description.
134 @echo -
135 @echo $(MAKE) CreatingDialogs.odt.load
136 @echo --------------------------------------------------------------------------------
138 CreatingDialogs.odt.load : $(REGISTERFLAG)
139 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
141 .PHONY: clean
142 clean :
143 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS))
144 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL)))
145 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG)))