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