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 
24 PRJ=../../..
25 SETTINGS=$(PRJ)/settings
26 
27 include $(SETTINGS)/settings.mk
28 include $(SETTINGS)/std.mk
29 include $(SETTINGS)/dk.mk
30 
31 # Define non-platform/compiler specific settings
32 SAMPLE_NAME=GUIExamples
33 SAMPLE_CLASS_OUT = $(OUT_CLASS)/$(SAMPLE_NAME)
34 SAMPLE_GEN_OUT = $(OUT_MISC)/$(SAMPLE_NAME)
35 
36 
37 APP1_NAME=DialogDocument
38 APP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar
39 APP2_NAME=MessageBox
40 APP2_JAR=$(SAMPLE_CLASS_OUT)/$(APP2_NAME).jar
41 APP3_NAME=UnoDialogSample
42 APP3_JAR=$(SAMPLE_CLASS_OUT)/$(APP3_NAME).jar
43 APP4_NAME=UnoDialogSample2
44 APP4_JAR=$(SAMPLE_CLASS_OUT)/$(APP4_NAME).jar
45 APP5_NAME=UnoMenu
46 APP5_JAR=$(SAMPLE_CLASS_OUT)/$(APP5_NAME).jar
47 APP6_NAME=UnoMenu2
48 APP6_JAR=$(SAMPLE_CLASS_OUT)/$(APP6_NAME).jar
49 APP7_NAME=ImageControlSample
50 APP7_JAR=$(SAMPLE_CLASS_OUT)/$(APP7_NAME).jar
51 
52 APP_JAVAFILES  = \
53 	RoadmapItemStateChangeListener.java \
54 	UnoDialogSample.java \
55 	UnoMenu.java
56 
57 APP_CLASSFILES = $(patsubst %.java,$(SAMPLE_CLASS_OUT)/%.class,$(APP_JAVAFILES))
58 #	$(SAMPLE_CLASS_OUT)/UnoDialogSample\&RoadmapItemStateChangeListener.class
59 
60 APP_CLASSNAMES = $(patsubst %.java,%.class,$(APP_JAVAFILES))
61 #APP_CLASSNAMES = $(patsubst $(SAMPLE_CLASS_OUT)/%.class,%.class,$(APP_CLASSFILES))
62 
63 
64 SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
65 		$(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT))
66 
67 
68 # Targets
69 .PHONY: ALL
70 ALL : \
71     GUIExamples
72 
73 
74 include $(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 
106 GUIExamples : $(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
127 clean :
128 	-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
129 	-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
130