1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22#*************************************************************************
23#
24#  The Contents of this file are made available subject to the terms of
25#  the BSD license.
26#
27#  Copyright 2000, 2010 Oracle and/or its affiliates.
28#  All rights reserved.
29#
30#  Redistribution and use in source and binary forms, with or without
31#  modification, are permitted provided that the following conditions
32#  are met:
33#  1. Redistributions of source code must retain the above copyright
34#     notice, this list of conditions and the following disclaimer.
35#  2. Redistributions in binary form must reproduce the above copyright
36#     notice, this list of conditions and the following disclaimer in the
37#     documentation and/or other materials provided with the distribution.
38#  3. Neither the name of Sun Microsystems, Inc. nor the names of its
39#     contributors may be used to endorse or promote products derived
40#     from this software without specific prior written permission.
41#
42#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
45#  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
46#  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
47#  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
48#  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
49#  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
50#  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
51#  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
52#  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53#
54#**************************************************************************
55
56# Builds the Drawing examples of the Developers Guide.
57
58PRJ=../../..
59SETTINGS=$(PRJ)/settings
60
61include $(SETTINGS)/settings.mk
62include $(SETTINGS)/std.mk
63include $(SETTINGS)/dk.mk
64
65# Define non-platform/compiler specific settings
66SAMPLE_NAME=DrawingExamples
67SAMPLE_CLASS_OUT = $(OUT_CLASS)/$(SAMPLE_NAME)
68SAMPLE_GEN_OUT = $(OUT_MISC)/$(SAMPLE_NAME)
69
70APP1_NAME=ChangeOrderDemo
71APP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar
72APP2_NAME=ControlAndSelectDemo
73APP2_JAR=$(SAMPLE_CLASS_OUT)/$(APP2_NAME).jar
74APP3_NAME=CustomShowDemo
75APP3_JAR=$(SAMPLE_CLASS_OUT)/$(APP3_NAME).jar
76APP4_NAME=DrawingDemo
77APP4_JAR=$(SAMPLE_CLASS_OUT)/$(APP4_NAME).jar
78APP5_NAME=DrawViewDemo
79APP5_JAR=$(SAMPLE_CLASS_OUT)/$(APP5_NAME).jar
80APP6_NAME=FillAndLineStyleDemo
81APP6_JAR=$(SAMPLE_CLASS_OUT)/$(APP6_NAME).jar
82APP7_NAME=GluePointDemo
83APP7_JAR=$(SAMPLE_CLASS_OUT)/$(APP7_NAME).jar
84APP8_NAME=GraphicExportDemo
85APP8_JAR=$(SAMPLE_CLASS_OUT)/$(APP8_NAME).jar
86APP9_NAME=LayerDemo
87APP9_JAR=$(SAMPLE_CLASS_OUT)/$(APP9_NAME).jar
88APP10_NAME=ObjectTransformationDemo
89APP10_JAR=$(SAMPLE_CLASS_OUT)/$(APP10_NAME).jar
90APP11_NAME=Organigram
91APP11_JAR=$(SAMPLE_CLASS_OUT)/$(APP11_NAME).jar
92APP12_NAME=PresentationDemo
93APP12_JAR=$(SAMPLE_CLASS_OUT)/$(APP12_NAME).jar
94APP13_NAME=StyleDemo
95APP13_JAR=$(SAMPLE_CLASS_OUT)/$(APP13_NAME).jar
96APP14_NAME=TextDemo
97APP14_JAR=$(SAMPLE_CLASS_OUT)/$(APP14_NAME).jar
98
99APP_JAVAFILES  = \
100	Helper.java \
101	PageHelper.java \
102	ShapeHelper.java
103
104APP_CLASSFILES = $(patsubst %.java,$(SAMPLE_CLASS_OUT)/%.class,$(APP_JAVAFILES))
105APP_CLASSNAMES = $(patsubst %.java,%.class,$(APP_JAVAFILES))
106
107SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
108		$(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT))
109
110
111# Targets
112.PHONY: ALL
113ALL : \
114    DrawingExamples
115
116include $(SETTINGS)/stdtarget.mk
117
118$(APP_CLASSFILES) : $(APP_JAVAFILES)
119	-$(MKDIR) $(subst /,$(PS),$(@D))
120	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $(APP_JAVAFILES)
121
122$(SAMPLE_CLASS_OUT)/%.class : %.java $(APP_CLASSFILES)
123	-$(MKDIR) $(subst /,$(PS),$(@D))
124	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $<
125
126$(SAMPLE_CLASS_OUT)/%.mf :
127	-$(MKDIR) $(subst /,$(PS),$(@D))
128	@echo Main-Class: com.sun.star.lib.loader.Loader> $@
129	$(ECHOLINE)>> $@
130	@echo Name: com/sun/star/lib/loader/Loader.class>> $@
131	@echo Application-Class: $*>> $@
132
133$(SAMPLE_CLASS_OUT)/%.jar : $(SAMPLE_CLASS_OUT)/%.mf $(SAMPLE_CLASS_OUT)/%.class $(APP_CLASSFILES)
134	-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
135	-$(MKDIR) $(subst /,$(PS),$(@D))
136	+cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) cvfm $(@F) $*.mf $*.class $(APP_CLASSNAMES)
137	+$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
138
139$(APP1_JAR) : $(SAMPLE_CLASS_OUT)/$(APP1_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP1_NAME).class
140$(APP2_JAR) : $(SAMPLE_CLASS_OUT)/$(APP2_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP2_NAME).class
141$(APP3_JAR) : $(SAMPLE_CLASS_OUT)/$(APP3_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP3_NAME).class
142$(APP4_JAR) : $(SAMPLE_CLASS_OUT)/$(APP4_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP4_NAME).class
143$(APP5_JAR) : $(SAMPLE_CLASS_OUT)/$(APP5_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP5_NAME).class
144$(APP6_JAR) : $(SAMPLE_CLASS_OUT)/$(APP6_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP6_NAME).class
145$(APP7_JAR) : $(SAMPLE_CLASS_OUT)/$(APP7_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP7_NAME).class
146$(APP8_JAR) : $(SAMPLE_CLASS_OUT)/$(APP8_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP8_NAME).class
147$(APP9_JAR) : $(SAMPLE_CLASS_OUT)/$(APP9_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP9_NAME).class
148$(APP10_JAR) : $(SAMPLE_CLASS_OUT)/$(APP10_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP10_NAME).class
149$(APP11_JAR) : $(SAMPLE_CLASS_OUT)/$(APP11_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP11_NAME).class
150$(APP12_JAR) : $(SAMPLE_CLASS_OUT)/$(APP12_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP12_NAME).class
151$(APP13_JAR) : $(SAMPLE_CLASS_OUT)/$(APP13_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP13_NAME).class
152$(APP14_JAR) : $(SAMPLE_CLASS_OUT)/$(APP14_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP14_NAME).class
153
154DrawingExamples : $(APP1_JAR) $(APP2_JAR) $(APP3_JAR) $(APP4_JAR) $(APP5_JAR) $(APP6_JAR) $(APP7_JAR) $(APP8_JAR) $(APP9_JAR) $(APP10_JAR) $(APP11_JAR) $(APP12_JAR) $(APP13_JAR) $(APP14_JAR)
155	@echo --------------------------------------------------------------------------------
156	@echo Please use one of the following commands to execute the examples!
157	@echo -
158	@echo $(MAKE) $(APP1_NAME).run
159	@echo $(MAKE) $(APP2_NAME).run
160	@echo $(MAKE) $(APP3_NAME).run
161	@echo $(MAKE) $(APP4_NAME).run
162	@echo $(MAKE) $(APP5_NAME).run
163	@echo $(MAKE) $(APP6_NAME).run
164	@echo $(MAKE) $(APP7_NAME).run
165	@echo $(MAKE) $(APP8_NAME).run
166	@echo $(MAKE) $(APP9_NAME).run
167	@echo $(MAKE) $(APP10_NAME).run
168	@echo $(MAKE) $(APP11_NAME).run
169	@echo $(MAKE) $(APP12_NAME).run
170	@echo $(MAKE) $(APP13_NAME).run
171	@echo $(MAKE) $(APP14_NAME).run
172	@echo --------
173	@echo The $(APP5_NAME) and the $(APP8_NAME) needs parameters. Please use the
174	@echo following command to start the demo if you do not want the default parameters
175	@echo specified in the this makefile:
176	@echo --- $(APP5_NAME) ---
177	@echo java -Dcom.sun.star.lib.loader.unopath="$(QM)$(OFFICE_PROGRAM_PATH)$(QM)" -jar $(APP5_NAME).jar "$(QM)SourceUrl$(QM)"
178	@echo --- $(APP8_NAME) ---
179	@echo java -Dcom.sun.star.lib.loader.unopath="$(QM)$(OFFICE_PROGRAM_PATH)$(QM)" -jar $(APP8_NAME).jar "$(QM)SourceUrl$(QM)" "$(QM)DestinationUrl$(QM)" "$(QM)index$(QM)"
180	@echo --------------------------------------------------------------------------------
181
182%.run: $(SAMPLE_CLASS_OUT)/%.jar
183	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
184
185$(APP5_NAME).run: $(APP5_JAR)
186	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< SimplePresentation.odp
187
188$(APP8_NAME).run: $(APP8_JAR)
189	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT)/export)
190	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< SimplePresentation.odp "$(SAMPLE_GEN_OUT)/export/MyTestExport.gif" 2
191
192
193.PHONY: clean
194clean :
195	-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
196	-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
197