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 GUI 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=GUIExamples
46SAMPLE_CLASS_OUT = $(OUT_CLASS)/$(SAMPLE_NAME)
47SAMPLE_GEN_OUT = $(OUT_MISC)/$(SAMPLE_NAME)
48
49
50APP1_NAME=DialogDocument
51APP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar
52APP2_NAME=MessageBox
53APP2_JAR=$(SAMPLE_CLASS_OUT)/$(APP2_NAME).jar
54APP3_NAME=UnoDialogSample
55APP3_JAR=$(SAMPLE_CLASS_OUT)/$(APP3_NAME).jar
56APP4_NAME=UnoDialogSample2
57APP4_JAR=$(SAMPLE_CLASS_OUT)/$(APP4_NAME).jar
58APP5_NAME=UnoMenu
59APP5_JAR=$(SAMPLE_CLASS_OUT)/$(APP5_NAME).jar
60APP6_NAME=UnoMenu2
61APP6_JAR=$(SAMPLE_CLASS_OUT)/$(APP6_NAME).jar
62APP7_NAME=ImageControlSample
63APP7_JAR=$(SAMPLE_CLASS_OUT)/$(APP7_NAME).jar
64
65APP_JAVAFILES  = \
66	RoadmapItemStateChangeListener.java \
67	UnoDialogSample.java \
68	UnoMenu.java
69
70APP_CLASSFILES = $(patsubst %.java,$(SAMPLE_CLASS_OUT)/%.class,$(APP_JAVAFILES))
71#	$(SAMPLE_CLASS_OUT)/UnoDialogSample\&RoadmapItemStateChangeListener.class
72
73APP_CLASSNAMES = $(patsubst %.java,%.class,$(APP_JAVAFILES))
74#APP_CLASSNAMES = $(patsubst $(SAMPLE_CLASS_OUT)/%.class,%.class,$(APP_CLASSFILES))
75
76
77SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
78		$(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT))
79
80
81# Targets
82.PHONY: ALL
83ALL : \
84    GUIExamples
85
86
87include $(SETTINGS)/stdtarget.mk
88
89
90$(APP_CLASSFILES) : $(APP_JAVAFILES)
91	-$(MKDIR) $(subst /,$(PS),$(@D))
92	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $(APP_JAVAFILES)
93
94$(SAMPLE_CLASS_OUT)/%.class : %.java $(APP_CLASSFILES)
95	-$(MKDIR) $(subst /,$(PS),$(@D))
96	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $<
97
98$(SAMPLE_CLASS_OUT)/%.mf :
99	-$(MKDIR) $(subst /,$(PS),$(@D))
100	@echo Main-Class: com.sun.star.lib.loader.Loader> $@
101	$(ECHOLINE)>> $@
102	@echo Name: com/sun/star/lib/loader/Loader.class>> $@
103	@echo Application-Class: $*>> $@
104
105$(SAMPLE_CLASS_OUT)/%.jar : $(SAMPLE_CLASS_OUT)/%.mf $(SAMPLE_CLASS_OUT)/%.class $(APP_CLASSFILES)
106	-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
107	-$(MKDIR) $(subst /,$(PS),$(@D))
108	+cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) cvfm $(@F) $*.mf $*.class $(APP_CLASSNAMES)
109	+$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
110
111$(APP1_JAR) : $(SAMPLE_CLASS_OUT)/$(APP1_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP1_NAME).class
112$(APP2_JAR) : $(SAMPLE_CLASS_OUT)/$(APP2_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP2_NAME).class
113$(APP3_JAR) : $(SAMPLE_CLASS_OUT)/$(APP3_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP3_NAME).class
114$(APP4_JAR) : $(SAMPLE_CLASS_OUT)/$(APP4_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP4_NAME).class
115$(APP5_JAR) : $(SAMPLE_CLASS_OUT)/$(APP5_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP5_NAME).class
116$(APP6_JAR) : $(SAMPLE_CLASS_OUT)/$(APP6_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP6_NAME).class
117$(APP7_JAR) : $(SAMPLE_CLASS_OUT)/$(APP7_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP7_NAME).class
118
119GUIExamples : $(APP1_JAR) $(APP2_JAR) $(APP3_JAR) $(APP4_JAR) $(APP5_JAR) $(APP6_JAR) $(APP7_JAR)
120	@echo --------------------------------------------------------------------------------
121	@echo Please use one of the following commands to execute the examples!
122	@echo -
123	@echo $(MAKE) $(APP1_NAME).run
124	@echo $(MAKE) $(APP2_NAME).run
125	@echo $(MAKE) $(APP3_NAME).run
126	@echo $(MAKE) $(APP4_NAME).run
127	@echo $(MAKE) $(APP5_NAME).run
128	@echo $(MAKE) $(APP6_NAME).run
129	@echo $(MAKE) $(APP7_NAME).run
130	@echo --------
131
132%.run: $(SAMPLE_CLASS_OUT)/%.jar
133	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
134
135$(APP7_NAME).run: $(SAMPLE_CLASS_OUT)/$(APP7_NAME).jar
136	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< .$(PS)oologo.gif
137
138
139.PHONY: clean
140clean :
141	-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
142	-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
143