xref: /trunk/main/odk/examples/DevelopersGuide/Forms/Makefile (revision fc9fd3f14a55d77b35643a64034752a178b2a5b0)
1#*************************************************************************
2#
3#  The Contents of this file are made available subject to the terms of
4#  the BSD license.
5#
6#  Copyright 2000, 2010 Oracle and/or its affiliates.
7#  All rights reserved.
8#
9#  Redistribution and use in source and binary forms, with or without
10#  modification, are permitted provided that the following conditions
11#  are met:
12#  1. Redistributions of source code must retain the above copyright
13#     notice, this list of conditions and the following disclaimer.
14#  2. Redistributions in binary form must reproduce the above copyright
15#     notice, this list of conditions and the following disclaimer in the
16#     documentation and/or other materials provided with the distribution.
17#  3. Neither the name of Sun Microsystems, Inc. nor the names of its
18#     contributors may be used to endorse or promote products derived
19#     from this software without specific prior written permission.
20#
21#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24#  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25#  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26#  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27#  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28#  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29#  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
30#  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
31#  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32#
33#**************************************************************************
34
35# Builds the Forms example of the Developers Guide.
36
37PRJ=../../..
38SETTINGS=$(PRJ)/settings
39
40include $(SETTINGS)/settings.mk
41include $(SETTINGS)/std.mk
42include $(SETTINGS)/dk.mk
43
44# Define non-platform/compiler specific settings
45SAMPLE_NAME=FormsExamples
46SAMPLE_CLASS_OUT=$(OUT_CLASS)/$(SAMPLE_NAME)
47SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME)
48
49APP1_NAME=DataAwareness
50APP1_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP1_NAME)
51APP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar
52APP2_NAME=ValueBinding
53APP2_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP2_NAME)
54APP2_JAR=$(SAMPLE_CLASS_OUT)/$(APP2_NAME).jar
55APP3_NAME=SpreadsheetValueBinding
56APP3_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP3_NAME)
57APP3_JAR=$(SAMPLE_CLASS_OUT)/$(APP3_NAME).jar
58APP4_NAME=ControlValidation
59APP4_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP4_NAME)
60APP4_JAR=$(SAMPLE_CLASS_OUT)/$(APP4_NAME).jar
61
62COMMON_CLASS_OUT = $(SAMPLE_CLASS_OUT)/common
63COMMON_JAVAFILES  = \
64    ButtonOperator.java \
65    ComponentTreeTraversal.java \
66    ControlLock.java \
67    DocumentHelper.java \
68    DocumentType.java \
69    DocumentViewHelper.java \
70    FLTools.java \
71    FormLayer.java \
72    GridFieldValidator.java \
73    InteractionRequest.java \
74    KeyGenerator.java \
75    SalesFilter.java \
76    UNO.java \
77    SpreadsheetView.java \
78    WaitForInput.java \
79    DocumentBasedExample.java \
80    TableCellTextBinding.java \
81    SpreadsheetDocument.java \
82    NumericValidator.java \
83    TextValidator.java \
84    BooleanValidator.java \
85    ListSelectionValidator.java \
86    DateValidator.java \
87    TimeValidator.java \
88    ControlValidator.java \
89    SingleControlValidation.java \
90    HsqlDatabase.java \
91    RowSet.java \
92    URLHelper.java
93
94COMMON_CLASSFILES = $(patsubst %.java,$(COMMON_CLASS_OUT)/%.class,$(COMMON_JAVAFILES))
95
96SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
97        $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)\
98        $(PATH_SEPARATOR)$(COMMON_CLASS_OUT))
99
100
101# Targets
102.PHONY: ALL
103ALL : \
104    FormsExample
105
106include $(SETTINGS)/stdtarget.mk
107
108$(COMMON_CLASSFILES) : $(COMMON_JAVAFILES)
109    -$(MKDIR) $(subst /,$(PS),$(@D))
110    $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMMON_CLASS_OUT) $^
111
112# rule for client/example application manifest file
113$(SAMPLE_GEN_OUT)/%.mf :
114    -$(MKDIR) $(subst /,$(PS),$(@D))
115    @echo Main-Class: com.sun.star.lib.loader.Loader> $@
116    $(ECHOLINE)>> $@
117    @echo Name: com/sun/star/lib/loader/Loader.class>> $@
118    @echo Application-Class: $*>> $@
119
120$(APP1_CLASS_OUT)/$(APP1_NAME).class : $(APP1_NAME).java $(COMMON_CLASSFILES)
121    -$(MKDIR) $(subst /,$(PS),$(@D))
122    $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP1_CLASS_OUT) $<
123
124$(APP2_CLASS_OUT)/$(APP2_NAME).class : $(APP2_NAME).java $(COMMON_CLASSFILES)
125    -$(MKDIR) $(subst /,$(PS),$(@D))
126    $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP2_CLASS_OUT) $<
127
128$(APP3_CLASS_OUT)/$(APP3_NAME).class : $(APP3_NAME).java $(COMMON_CLASSFILES)
129    -$(MKDIR) $(subst /,$(PS),$(@D))
130    $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP3_CLASS_OUT) $<
131
132$(APP4_CLASS_OUT)/$(APP4_NAME).class : $(APP4_NAME).java $(COMMON_CLASSFILES)
133    -$(MKDIR) $(subst /,$(PS),$(@D))
134    $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP4_CLASS_OUT) $<
135
136$(APP1_JAR) : $(SAMPLE_GEN_OUT)/$(APP1_NAME).mf $(APP1_CLASS_OUT)/$(APP1_NAME).class $(COMMON_CLASSFILES)
137    -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
138    -$(MKDIR) $(subst /,$(PS),$(@D))
139    +$(SDK_JAR) cvfm $@ $< -C $(APP1_CLASS_OUT) .
140    +$(SDK_JAR) uvf $@ -C $(COMMON_CLASS_OUT) .
141    +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
142
143$(APP2_JAR) : $(SAMPLE_GEN_OUT)/$(APP2_NAME).mf $(APP2_CLASS_OUT)/$(APP2_NAME).class $(COMMON_CLASSFILES)
144    -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
145    -$(MKDIR) $(subst /,$(PS),$(@D))
146    +$(SDK_JAR) cvfm $@ $< -C $(APP2_CLASS_OUT) .
147    +$(SDK_JAR) uvf $@ -C $(COMMON_CLASS_OUT) .
148    +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
149
150$(APP3_JAR) : $(SAMPLE_GEN_OUT)/$(APP3_NAME).mf $(APP3_CLASS_OUT)/$(APP3_NAME).class $(COMMON_CLASSFILES)
151    -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
152    -$(MKDIR) $(subst /,$(PS),$(@D))
153    +$(SDK_JAR) cvfm $@ $< -C $(APP3_CLASS_OUT) .
154    +$(SDK_JAR) uvf $@ -C $(COMMON_CLASS_OUT) .
155    +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
156
157$(APP4_JAR) : $(SAMPLE_GEN_OUT)/$(APP4_NAME).mf $(APP4_CLASS_OUT)/$(APP4_NAME).class $(COMMON_CLASSFILES)
158    -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
159    -$(MKDIR) $(subst /,$(PS),$(@D))
160    +$(SDK_JAR) cvfm $@ $< -C $(APP4_CLASS_OUT) .
161    +$(SDK_JAR) uvf $@ -C $(COMMON_CLASS_OUT) .
162    +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
163
164FormsExample : $(APP1_JAR)  $(APP2_JAR)  $(APP3_JAR)  $(APP4_JAR)
165    @echo --------------------------------------------------------------------------------
166    @echo "$(QM)$(APP1_NAME)$(QM)" demonstrates various things around data aware controls.
167    @echo "$(QM)$(APP2_NAME)$(QM)" demonstrates the use of value bindings for form controls.
168    @echo "$(QM)$(APP3_NAME)$(QM)" demonstrates the usage of the com.sun.star.table.CellValueBinding service
169    @echo "$(QM)$(APP4_NAME)$(QM)" demonstrates the form control validation API
170
171    @echo Please use one of the following commands to run an example:
172    @echo -
173    @echo $(MAKE) $(APP1_NAME).run
174    @echo $(MAKE) $(APP2_NAME).run
175    @echo $(MAKE) $(APP3_NAME).run
176    @echo $(MAKE) $(APP4_NAME).run
177    @echo -
178    @echo Note: The data awareness example needs a running data source whith name
179    @echo $(SQM)      $(SQM)"$(QM)OO_SDK_Demo_DB$(QM)". Make sure that you have created such a data source,
180    @echo -
181    @echo The document "$(QM)ProgrammaticScriptAssignment.odt$(QM)" demonstrates
182    @echo how you can programmatically create form controls, and associated
183    @echo scripts with certain events.
184    @echo -
185    @echo $(MAKE) ProgrammaticScriptAssignment.odt.load
186    @echo --------------------------------------------------------------------------------
187
188ProgrammaticScriptAssignment.odt.load : $(COMP_REGISTERFLAG)
189    "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@)
190
191%.run: $(SAMPLE_CLASS_OUT)/%.jar
192    $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
193
194.PHONY: clean
195clean :
196    -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
197    -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
198