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 OfficeDevDestopEnvironment example 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
32EXAMPLE_NAME=OfficeDevDesktopEnv
33OUT_APP_CLASS = $(OUT_CLASS)/$(EXAMPLE_NAME)
34
35APP1_NAME=DesktopExample
36APP1_JAR=$(OUT_APP_CLASS)/$(APP1_NAME).jar
37
38APP1_JAVAFILES  = \
39		   CustomizeView.java \
40		   Desk.java \
41		   DocumentView.java \
42		   FunctionHelper.java \
43		   Interceptor.java \
44		   IOnewayLink.java \
45		   IShutdownListener.java \
46		   JavaWindowPeerFake.java \
47		   NativeView.java \
48		   OfficeConnect.java \
49		   OnewayExecutor.java \
50		   StatusListener.java \
51		   StatusView.java \
52		   ViewContainer.java
53
54APP1_CLASSFILES = $(patsubst %.java,$(OUT_APP_CLASS)/%.class,$(APP1_JAVAFILES))
55APP1_CLASSNAMES = $(patsubst %.java,%.class,$(APP1_JAVAFILES)) \
56		CustomizeView$(QUOTE)$$ClickListener.class \
57		DocumentView$(QUOTE)$$1.class \
58		DocumentView$(QUOTE)$$Reactor.class
59
60
61SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
62		$(PATH_SEPARATOR)$(OUT_APP_CLASS))
63
64ifeq "$(OS)" "WIN"
65SUBDIR= nativelib/windows
66else
67SUBDIR= nativelib/unix
68endif
69
70# Targets
71.PHONY: ALL
72ALL : $(SUBDIR) \
73	$(EXAMPLE_NAME)
74
75include $(SETTINGS)/stdtarget.mk
76
77.PHONY : $(SUBDIR)
78$(SUBDIR) :
79	$(MAKE) -C $@
80
81$(APP1_CLASSFILES) : $(APP1_JAVAFILES)
82	-$(MKDIR) $(subst /,$(PS),$(@D))
83	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_APP_CLASS) $(APP1_JAVAFILES)
84
85$(OUT_APP_CLASS)/$(APP1_NAME).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: Desk>> $@
91
92$(APP1_JAR) : $(OUT_APP_CLASS)/$(APP1_NAME).mf $(APP1_CLASSFILES)
93	-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
94	-$(MKDIR) $(subst /,$(PS),$(@D))
95	+cd $(subst /,$(PS),$(OUT_APP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(basename $(@F)).mf $(APP1_CLASSNAMES)
96	+$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
97
98$(EXAMPLE_NAME) : $(APP1_JAR)
99	@echo --------------------------------------------------------------------------------
100	@echo Please use the following command to execute the example!
101	@echo -
102	@echo $(MAKE) DesktopExample.run
103	@echo ------
104	@echo If you want to run the $(JAR1_JAR) file please set your
105	@echo CLASSPATH = $(SDK_CLASSPATH)
106	@echo Start the example with jar -jar $(JAR1_JAR)
107	@echo --------------------------------------------------------------------------------
108
109%.run: $(OUT_APP_CLASS)/%.jar
110	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
111
112.PHONY: clean
113clean :
114	$(MAKE) -C $(SUBDIR) clean
115	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_CLASS))
116