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 Drawing examples 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=DrawingExamples
46SAMPLE_CLASS_OUT = $(OUT_CLASS)/$(SAMPLE_NAME)
47SAMPLE_GEN_OUT = $(OUT_MISC)/$(SAMPLE_NAME)
48
49APP1_NAME=ChangeOrderDemo
50APP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar
51APP2_NAME=ControlAndSelectDemo
52APP2_JAR=$(SAMPLE_CLASS_OUT)/$(APP2_NAME).jar
53APP3_NAME=CustomShowDemo
54APP3_JAR=$(SAMPLE_CLASS_OUT)/$(APP3_NAME).jar
55APP4_NAME=DrawingDemo
56APP4_JAR=$(SAMPLE_CLASS_OUT)/$(APP4_NAME).jar
57APP5_NAME=DrawViewDemo
58APP5_JAR=$(SAMPLE_CLASS_OUT)/$(APP5_NAME).jar
59APP6_NAME=FillAndLineStyleDemo
60APP6_JAR=$(SAMPLE_CLASS_OUT)/$(APP6_NAME).jar
61APP7_NAME=GluePointDemo
62APP7_JAR=$(SAMPLE_CLASS_OUT)/$(APP7_NAME).jar
63APP8_NAME=GraphicExportDemo
64APP8_JAR=$(SAMPLE_CLASS_OUT)/$(APP8_NAME).jar
65APP9_NAME=LayerDemo
66APP9_JAR=$(SAMPLE_CLASS_OUT)/$(APP9_NAME).jar
67APP10_NAME=ObjectTransformationDemo
68APP10_JAR=$(SAMPLE_CLASS_OUT)/$(APP10_NAME).jar
69APP11_NAME=Organigram
70APP11_JAR=$(SAMPLE_CLASS_OUT)/$(APP11_NAME).jar
71APP12_NAME=PresentationDemo
72APP12_JAR=$(SAMPLE_CLASS_OUT)/$(APP12_NAME).jar
73APP13_NAME=StyleDemo
74APP13_JAR=$(SAMPLE_CLASS_OUT)/$(APP13_NAME).jar
75APP14_NAME=TextDemo
76APP14_JAR=$(SAMPLE_CLASS_OUT)/$(APP14_NAME).jar
77
78APP_JAVAFILES  = \
79	Helper.java \
80	PageHelper.java \
81	ShapeHelper.java
82
83APP_CLASSFILES = $(patsubst %.java,$(SAMPLE_CLASS_OUT)/%.class,$(APP_JAVAFILES))
84APP_CLASSNAMES = $(patsubst %.java,%.class,$(APP_JAVAFILES))
85
86SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
87		$(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT))
88
89
90# Targets
91.PHONY: ALL
92ALL : \
93    DrawingExamples
94
95include $(SETTINGS)/stdtarget.mk
96
97$(APP_CLASSFILES) : $(APP_JAVAFILES)
98	-$(MKDIR) $(subst /,$(PS),$(@D))
99	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $(APP_JAVAFILES)
100
101$(SAMPLE_CLASS_OUT)/%.class : %.java $(APP_CLASSFILES)
102	-$(MKDIR) $(subst /,$(PS),$(@D))
103	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $<
104
105$(SAMPLE_CLASS_OUT)/%.mf :
106	-$(MKDIR) $(subst /,$(PS),$(@D))
107	@echo Main-Class: com.sun.star.lib.loader.Loader> $@
108	$(ECHOLINE)>> $@
109	@echo Name: com/sun/star/lib/loader/Loader.class>> $@
110	@echo Application-Class: $*>> $@
111
112$(SAMPLE_CLASS_OUT)/%.jar : $(SAMPLE_CLASS_OUT)/%.mf $(SAMPLE_CLASS_OUT)/%.class $(APP_CLASSFILES)
113	-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
114	-$(MKDIR) $(subst /,$(PS),$(@D))
115	+cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) cvfm $(@F) $*.mf $*.class $(APP_CLASSNAMES)
116	+$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
117
118$(APP1_JAR) : $(SAMPLE_CLASS_OUT)/$(APP1_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP1_NAME).class
119$(APP2_JAR) : $(SAMPLE_CLASS_OUT)/$(APP2_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP2_NAME).class
120$(APP3_JAR) : $(SAMPLE_CLASS_OUT)/$(APP3_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP3_NAME).class
121$(APP4_JAR) : $(SAMPLE_CLASS_OUT)/$(APP4_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP4_NAME).class
122$(APP5_JAR) : $(SAMPLE_CLASS_OUT)/$(APP5_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP5_NAME).class
123$(APP6_JAR) : $(SAMPLE_CLASS_OUT)/$(APP6_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP6_NAME).class
124$(APP7_JAR) : $(SAMPLE_CLASS_OUT)/$(APP7_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP7_NAME).class
125$(APP8_JAR) : $(SAMPLE_CLASS_OUT)/$(APP8_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP8_NAME).class
126$(APP9_JAR) : $(SAMPLE_CLASS_OUT)/$(APP9_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP9_NAME).class
127$(APP10_JAR) : $(SAMPLE_CLASS_OUT)/$(APP10_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP10_NAME).class
128$(APP11_JAR) : $(SAMPLE_CLASS_OUT)/$(APP11_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP11_NAME).class
129$(APP12_JAR) : $(SAMPLE_CLASS_OUT)/$(APP12_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP12_NAME).class
130$(APP13_JAR) : $(SAMPLE_CLASS_OUT)/$(APP13_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP13_NAME).class
131$(APP14_JAR) : $(SAMPLE_CLASS_OUT)/$(APP14_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP14_NAME).class
132
133DrawingExamples : $(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)
134	@echo --------------------------------------------------------------------------------
135	@echo Please use one of the following commands to execute the examples!
136	@echo -
137	@echo $(MAKE) $(APP1_NAME).run
138	@echo $(MAKE) $(APP2_NAME).run
139	@echo $(MAKE) $(APP3_NAME).run
140	@echo $(MAKE) $(APP4_NAME).run
141	@echo $(MAKE) $(APP5_NAME).run
142	@echo $(MAKE) $(APP6_NAME).run
143	@echo $(MAKE) $(APP7_NAME).run
144	@echo $(MAKE) $(APP8_NAME).run
145	@echo $(MAKE) $(APP9_NAME).run
146	@echo $(MAKE) $(APP10_NAME).run
147	@echo $(MAKE) $(APP11_NAME).run
148	@echo $(MAKE) $(APP12_NAME).run
149	@echo $(MAKE) $(APP13_NAME).run
150	@echo $(MAKE) $(APP14_NAME).run
151	@echo --------
152	@echo The $(APP5_NAME) and the $(APP8_NAME) needs parameters. Please use the
153	@echo following command to start the demo if you do not want the default parameters
154	@echo specified in the this makefile:
155	@echo --- $(APP5_NAME) ---
156	@echo java -Dcom.sun.star.lib.loader.unopath="$(QM)$(OFFICE_PROGRAM_PATH)$(QM)" -jar $(APP5_NAME).jar "$(QM)SourceUrl$(QM)"
157	@echo --- $(APP8_NAME) ---
158	@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)"
159	@echo --------------------------------------------------------------------------------
160
161%.run: $(SAMPLE_CLASS_OUT)/%.jar
162	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
163
164$(APP5_NAME).run: $(APP5_JAR)
165	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< SimplePresentation.odp
166
167$(APP8_NAME).run: $(APP8_JAR)
168	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT)/export)
169	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< SimplePresentation.odp "$(SAMPLE_GEN_OUT)/export/MyTestExport.gif" 2
170
171
172.PHONY: clean
173clean :
174	-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
175	-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
176