merge the formfield patch from ooo-build
[ooovba.git] / odk / examples / DevelopersGuide / Components / SimpleLicense / Makefile
blobf8899bd5f5d3d9066e721f14dcef69a43e323b69
1 #*************************************************************************
3 # $RCSfile: Makefile,v $
5 # $Revision: 1.3 $
7 # last change: $Author: rt $ $Date: 2008-07-11 14:19:45 $
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 License Test 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=LicenseTest
55 SAMPLE_CLASS_OUT=$(OUT_CLASS)/$(SAMPLE_NAME)
56 SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
58 COMP_NAME=LicenseTest
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
70 COMP_LOCAL_FILES = description.xml registration/license_de.txt registration/license_en_US.txt
72 IDLFILES = LicenseTest.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 = org/openoffice
78 COMP_JAVAFILES = LicenseTest.java
79 COMP_CLASSFILES = $(patsubst %.java,$(COMP_CLASS_OUT)/%.class,$(COMP_JAVAFILES))
81 GEN_CLASSFILES = $(patsubst %.idl,$(SAMPLE_CLASS_OUT)/$(PACKAGE)/%.class,$(IDLFILES))
82 GEN_TYPELIST = $(subst /,.,$(patsubst %.idl,-T$(PACKAGE)/% ,$(IDLFILES)))
83 GEN_URDFILES = $(patsubst %.idl,$(SAMPLE_GEN_OUT)/%.urd,$(IDLFILES))
85 # the generated types are necessary for the component and the application jar
86 GEN_CLASSFILENAMES = $(subst $(SAMPLE_CLASS_OUT)/,,$(GEN_CLASSFILES))
88 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
89 $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)\
90 $(PATH_SEPARATOR)$(COMP_CLASS_OUT)\
91 $(PATH_SEPARATOR)$(APP1_CLASS_OUT))
94 # Targets
95 .PHONY: ALL
96 ALL : JavaLicenseTestExample
98 include $(SETTINGS)/stdtarget.mk
100 $(COMP_GEN_OUT)/%.Manifest :
101 -$(MKDIR) $(subst /,$(PS),$(@D))
102 @echo UNO-Type-Path: $(basename $(notdir $*)).uno.jar> $@
103 @echo RegistrationClassName: $(basename $*)>> $@
105 $(SAMPLE_GEN_OUT)/%.urd : %.idl
106 -$(MKDIR) $(subst /,$(PS),$(@D))
107 $(IDLC) -C -I. -I$(IDL_DIR) -O$(SAMPLE_GEN_OUT) $<
109 $(COMP_GEN_OUT)/%.rdb : $(GEN_URDFILES)
110 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
111 -$(MKDIR) $(subst /,$(PS),$(@D))
112 $(REGMERGE) $@ /UCR $(GEN_URDFILES)
114 $(GEN_CLASSFILES) : $(COMP_RDB)
115 -$(MKDIR) $(subst /,$(PS),$(@D))
116 $(JAVAMAKER) -BUCR -nD $(GEN_TYPELIST) -O$(SAMPLE_CLASS_OUT) $(COMP_RDB) -X$(URE_TYPES) -X$(OFFICE_TYPES)
118 # component as well as application are dependent from the generated types
119 # rule for component class files
120 $(COMP_CLASS_OUT)/%.class : %.java $(GEN_CLASSFILES)
121 -$(MKDIR) $(subst /,$(PS),$(@D))
122 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP_CLASS_OUT) $<
124 # rule for component jar file
125 $(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES)
126 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
127 -$(MKDIR) $(subst /,$(PS),$(@D))
128 $(SDK_JAR) cvfm $@ $< -C $(COMP_CLASS_OUT) .
129 +cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) uvf $(@F) $(GEN_CLASSFILENAMES)
131 # rule for component package manifest
132 $(COMP_GEN_OUT)/%/manifest.xml :
133 -$(MKDIR) $(subst /,$(PS),$(@D))
134 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
135 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
136 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
137 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-typelibrary;type=RDB$(QM)" >> $@
138 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@
139 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@
140 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@
141 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
143 # rule for component package file
144 $(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_LOCAL_FILES)
145 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
146 -$(MKDIR) $(subst /,$(PS),$(@D))
147 cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) ../../../bin/$(@F) $(COMP_RDB_NAME)
148 cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_JAR_NAME)
149 cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
150 $(SDK_ZIP) -u $@ $(COMP_LOCAL_FILES)
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 JavaLicenseTestExample : $(COMP_REGISTERFLAG)
167 @echo --------------------------------------------------------------------------------
168 @echo The $(COMP_NAME) component was installed if SDK_AUTO_DEPLOYMENT = YES.
169 @echo This extension demonstrates the $(QM)Simple License$(QM) feature.
170 @echo --------------------------------------------------------------------------------
172 .PHONY: clean
173 clean :
174 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
175 -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
176 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))