1*b1cdbd2cSJim Jagielski#**************************************************************
2*b1cdbd2cSJim Jagielski#
3*b1cdbd2cSJim Jagielski#  Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski#  or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski#  distributed with this work for additional information
6*b1cdbd2cSJim Jagielski#  regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski#  to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski#  "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski#  with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski#
11*b1cdbd2cSJim Jagielski#    http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski#
13*b1cdbd2cSJim Jagielski#  Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski#  software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski#  KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski#  specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski#  under the License.
19*b1cdbd2cSJim Jagielski#
20*b1cdbd2cSJim Jagielski#**************************************************************
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski# Builds the Drawing examples of the Developers Guide.
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim JagielskiPRJ=../../..
25*b1cdbd2cSJim JagielskiSETTINGS=$(PRJ)/settings
26*b1cdbd2cSJim Jagielski
27*b1cdbd2cSJim Jagielskiinclude $(SETTINGS)/settings.mk
28*b1cdbd2cSJim Jagielskiinclude $(SETTINGS)/std.mk
29*b1cdbd2cSJim Jagielskiinclude $(SETTINGS)/dk.mk
30*b1cdbd2cSJim Jagielski
31*b1cdbd2cSJim Jagielski# Define non-platform/compiler specific settings
32*b1cdbd2cSJim JagielskiSAMPLE_NAME=DrawingExamples
33*b1cdbd2cSJim JagielskiSAMPLE_CLASS_OUT = $(OUT_CLASS)/$(SAMPLE_NAME)
34*b1cdbd2cSJim JagielskiSAMPLE_GEN_OUT = $(OUT_MISC)/$(SAMPLE_NAME)
35*b1cdbd2cSJim Jagielski
36*b1cdbd2cSJim JagielskiAPP1_NAME=ChangeOrderDemo
37*b1cdbd2cSJim JagielskiAPP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar
38*b1cdbd2cSJim JagielskiAPP2_NAME=ControlAndSelectDemo
39*b1cdbd2cSJim JagielskiAPP2_JAR=$(SAMPLE_CLASS_OUT)/$(APP2_NAME).jar
40*b1cdbd2cSJim JagielskiAPP3_NAME=CustomShowDemo
41*b1cdbd2cSJim JagielskiAPP3_JAR=$(SAMPLE_CLASS_OUT)/$(APP3_NAME).jar
42*b1cdbd2cSJim JagielskiAPP4_NAME=DrawingDemo
43*b1cdbd2cSJim JagielskiAPP4_JAR=$(SAMPLE_CLASS_OUT)/$(APP4_NAME).jar
44*b1cdbd2cSJim JagielskiAPP5_NAME=DrawViewDemo
45*b1cdbd2cSJim JagielskiAPP5_JAR=$(SAMPLE_CLASS_OUT)/$(APP5_NAME).jar
46*b1cdbd2cSJim JagielskiAPP6_NAME=FillAndLineStyleDemo
47*b1cdbd2cSJim JagielskiAPP6_JAR=$(SAMPLE_CLASS_OUT)/$(APP6_NAME).jar
48*b1cdbd2cSJim JagielskiAPP7_NAME=GluePointDemo
49*b1cdbd2cSJim JagielskiAPP7_JAR=$(SAMPLE_CLASS_OUT)/$(APP7_NAME).jar
50*b1cdbd2cSJim JagielskiAPP8_NAME=GraphicExportDemo
51*b1cdbd2cSJim JagielskiAPP8_JAR=$(SAMPLE_CLASS_OUT)/$(APP8_NAME).jar
52*b1cdbd2cSJim JagielskiAPP9_NAME=LayerDemo
53*b1cdbd2cSJim JagielskiAPP9_JAR=$(SAMPLE_CLASS_OUT)/$(APP9_NAME).jar
54*b1cdbd2cSJim JagielskiAPP10_NAME=ObjectTransformationDemo
55*b1cdbd2cSJim JagielskiAPP10_JAR=$(SAMPLE_CLASS_OUT)/$(APP10_NAME).jar
56*b1cdbd2cSJim JagielskiAPP11_NAME=Organigram
57*b1cdbd2cSJim JagielskiAPP11_JAR=$(SAMPLE_CLASS_OUT)/$(APP11_NAME).jar
58*b1cdbd2cSJim JagielskiAPP12_NAME=PresentationDemo
59*b1cdbd2cSJim JagielskiAPP12_JAR=$(SAMPLE_CLASS_OUT)/$(APP12_NAME).jar
60*b1cdbd2cSJim JagielskiAPP13_NAME=StyleDemo
61*b1cdbd2cSJim JagielskiAPP13_JAR=$(SAMPLE_CLASS_OUT)/$(APP13_NAME).jar
62*b1cdbd2cSJim JagielskiAPP14_NAME=TextDemo
63*b1cdbd2cSJim JagielskiAPP14_JAR=$(SAMPLE_CLASS_OUT)/$(APP14_NAME).jar
64*b1cdbd2cSJim Jagielski
65*b1cdbd2cSJim JagielskiAPP_JAVAFILES  = \
66*b1cdbd2cSJim Jagielski	Helper.java \
67*b1cdbd2cSJim Jagielski	PageHelper.java \
68*b1cdbd2cSJim Jagielski	ShapeHelper.java
69*b1cdbd2cSJim Jagielski
70*b1cdbd2cSJim JagielskiAPP_CLASSFILES = $(patsubst %.java,$(SAMPLE_CLASS_OUT)/%.class,$(APP_JAVAFILES))
71*b1cdbd2cSJim JagielskiAPP_CLASSNAMES = $(patsubst %.java,%.class,$(APP_JAVAFILES))
72*b1cdbd2cSJim Jagielski
73*b1cdbd2cSJim JagielskiSDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
74*b1cdbd2cSJim Jagielski		$(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT))
75*b1cdbd2cSJim Jagielski
76*b1cdbd2cSJim Jagielski
77*b1cdbd2cSJim Jagielski# Targets
78*b1cdbd2cSJim Jagielski.PHONY: ALL
79*b1cdbd2cSJim JagielskiALL : \
80*b1cdbd2cSJim Jagielski    DrawingExamples
81*b1cdbd2cSJim Jagielski
82*b1cdbd2cSJim Jagielskiinclude $(SETTINGS)/stdtarget.mk
83*b1cdbd2cSJim Jagielski
84*b1cdbd2cSJim Jagielski$(APP_CLASSFILES) : $(APP_JAVAFILES)
85*b1cdbd2cSJim Jagielski	-$(MKDIR) $(subst /,$(PS),$(@D))
86*b1cdbd2cSJim Jagielski	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $(APP_JAVAFILES)
87*b1cdbd2cSJim Jagielski
88*b1cdbd2cSJim Jagielski$(SAMPLE_CLASS_OUT)/%.class : %.java $(APP_CLASSFILES)
89*b1cdbd2cSJim Jagielski	-$(MKDIR) $(subst /,$(PS),$(@D))
90*b1cdbd2cSJim Jagielski	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $<
91*b1cdbd2cSJim Jagielski
92*b1cdbd2cSJim Jagielski$(SAMPLE_CLASS_OUT)/%.mf :
93*b1cdbd2cSJim Jagielski	-$(MKDIR) $(subst /,$(PS),$(@D))
94*b1cdbd2cSJim Jagielski	@echo Main-Class: com.sun.star.lib.loader.Loader> $@
95*b1cdbd2cSJim Jagielski	$(ECHOLINE)>> $@
96*b1cdbd2cSJim Jagielski	@echo Name: com/sun/star/lib/loader/Loader.class>> $@
97*b1cdbd2cSJim Jagielski	@echo Application-Class: $*>> $@
98*b1cdbd2cSJim Jagielski
99*b1cdbd2cSJim Jagielski$(SAMPLE_CLASS_OUT)/%.jar : $(SAMPLE_CLASS_OUT)/%.mf $(SAMPLE_CLASS_OUT)/%.class $(APP_CLASSFILES)
100*b1cdbd2cSJim Jagielski	-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
101*b1cdbd2cSJim Jagielski	-$(MKDIR) $(subst /,$(PS),$(@D))
102*b1cdbd2cSJim Jagielski	+cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) cvfm $(@F) $*.mf $*.class $(APP_CLASSNAMES)
103*b1cdbd2cSJim Jagielski	+$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
104*b1cdbd2cSJim Jagielski
105*b1cdbd2cSJim Jagielski$(APP1_JAR) : $(SAMPLE_CLASS_OUT)/$(APP1_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP1_NAME).class
106*b1cdbd2cSJim Jagielski$(APP2_JAR) : $(SAMPLE_CLASS_OUT)/$(APP2_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP2_NAME).class
107*b1cdbd2cSJim Jagielski$(APP3_JAR) : $(SAMPLE_CLASS_OUT)/$(APP3_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP3_NAME).class
108*b1cdbd2cSJim Jagielski$(APP4_JAR) : $(SAMPLE_CLASS_OUT)/$(APP4_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP4_NAME).class
109*b1cdbd2cSJim Jagielski$(APP5_JAR) : $(SAMPLE_CLASS_OUT)/$(APP5_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP5_NAME).class
110*b1cdbd2cSJim Jagielski$(APP6_JAR) : $(SAMPLE_CLASS_OUT)/$(APP6_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP6_NAME).class
111*b1cdbd2cSJim Jagielski$(APP7_JAR) : $(SAMPLE_CLASS_OUT)/$(APP7_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP7_NAME).class
112*b1cdbd2cSJim Jagielski$(APP8_JAR) : $(SAMPLE_CLASS_OUT)/$(APP8_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP8_NAME).class
113*b1cdbd2cSJim Jagielski$(APP9_JAR) : $(SAMPLE_CLASS_OUT)/$(APP9_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP9_NAME).class
114*b1cdbd2cSJim Jagielski$(APP10_JAR) : $(SAMPLE_CLASS_OUT)/$(APP10_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP10_NAME).class
115*b1cdbd2cSJim Jagielski$(APP11_JAR) : $(SAMPLE_CLASS_OUT)/$(APP11_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP11_NAME).class
116*b1cdbd2cSJim Jagielski$(APP12_JAR) : $(SAMPLE_CLASS_OUT)/$(APP12_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP12_NAME).class
117*b1cdbd2cSJim Jagielski$(APP13_JAR) : $(SAMPLE_CLASS_OUT)/$(APP13_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP13_NAME).class
118*b1cdbd2cSJim Jagielski$(APP14_JAR) : $(SAMPLE_CLASS_OUT)/$(APP14_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP14_NAME).class
119*b1cdbd2cSJim Jagielski
120*b1cdbd2cSJim JagielskiDrawingExamples : $(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*b1cdbd2cSJim Jagielski	@echo --------------------------------------------------------------------------------
122*b1cdbd2cSJim Jagielski	@echo Please use one of the following commands to execute the examples!
123*b1cdbd2cSJim Jagielski	@echo -
124*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP1_NAME).run
125*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP2_NAME).run
126*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP3_NAME).run
127*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP4_NAME).run
128*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP5_NAME).run
129*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP6_NAME).run
130*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP7_NAME).run
131*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP8_NAME).run
132*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP9_NAME).run
133*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP10_NAME).run
134*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP11_NAME).run
135*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP12_NAME).run
136*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP13_NAME).run
137*b1cdbd2cSJim Jagielski	@echo $(MAKE) $(APP14_NAME).run
138*b1cdbd2cSJim Jagielski	@echo --------
139*b1cdbd2cSJim Jagielski	@echo The $(APP5_NAME) and the $(APP8_NAME) needs parameters. Please use the
140*b1cdbd2cSJim Jagielski	@echo following command to start the demo if you do not want the default parameters
141*b1cdbd2cSJim Jagielski	@echo specified in the this makefile:
142*b1cdbd2cSJim Jagielski	@echo --- $(APP5_NAME) ---
143*b1cdbd2cSJim Jagielski	@echo java -Dcom.sun.star.lib.loader.unopath="$(QM)$(OFFICE_PROGRAM_PATH)$(QM)" -jar $(APP5_NAME).jar "$(QM)SourceUrl$(QM)"
144*b1cdbd2cSJim Jagielski	@echo --- $(APP8_NAME) ---
145*b1cdbd2cSJim Jagielski	@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*b1cdbd2cSJim Jagielski	@echo --------------------------------------------------------------------------------
147*b1cdbd2cSJim Jagielski
148*b1cdbd2cSJim Jagielski%.run: $(SAMPLE_CLASS_OUT)/%.jar
149*b1cdbd2cSJim Jagielski	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
150*b1cdbd2cSJim Jagielski
151*b1cdbd2cSJim Jagielski$(APP5_NAME).run: $(APP5_JAR)
152*b1cdbd2cSJim Jagielski	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< SimplePresentation.odp
153*b1cdbd2cSJim Jagielski
154*b1cdbd2cSJim Jagielski$(APP8_NAME).run: $(APP8_JAR)
155*b1cdbd2cSJim Jagielski	-$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT)/export)
156*b1cdbd2cSJim Jagielski	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< SimplePresentation.odp "$(SAMPLE_GEN_OUT)/export/MyTestExport.gif" 2
157*b1cdbd2cSJim Jagielski
158*b1cdbd2cSJim Jagielski
159*b1cdbd2cSJim Jagielski.PHONY: clean
160*b1cdbd2cSJim Jagielskiclean :
161*b1cdbd2cSJim Jagielski	-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
162*b1cdbd2cSJim Jagielski	-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
163