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