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 Java NotesAccess example of the SDK.
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=NotesAccessExample
33OUT_APP_CLASS = $(OUT_CLASS)/$(EXAMPLE_NAME)
34
35APP_NAME=NotesAccess
36APP_JAR=$(OUT_APP_CLASS)/$(APP_NAME).jar
37
38JAVAFILES  = \
39	NotesAccess.java
40
41CLASSFILES = $(patsubst %.java,$(OUT_APP_CLASS)/%.class,$(JAVAFILES))
42
43SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
44		$(PATH_SEPARATOR)$(OUT_APP_CLASS))
45
46
47# Targets
48.PHONY: ALL
49ALL : \
50    JavaNotesAccessExample
51
52include $(SETTINGS)/stdtarget.mk
53
54NotesAPIs :
55	@echo --------------------------------------------------------------------------------
56	@echo This example uses external APIs from Lotus Notes/Domino. You can download a
57	@echo trial version from "$(QM)http://www.lotus.com/downloads$(QM)". After installation
58	@echo please do the following:
59	@echo  1. Add the install path to the PATH or LD_LIBRARY_PATH of this shell.
60	@echo     e.g "$(QM)PATH=C:\Program Files\lotus\notes;...$(QM)"
61	@echo  2. Add the "$(QM)Notes.jar$(QM)" to your CLASSPATH
62	@echo     e.g. "$(QM)CLASSPATH=C:\Program Files\lotus\notes\Notes.jar;$(QM)"
63	@echo --------------------------------------------------------------------------------
64
65
66$(CLASSFILES) : $(JAVAFILES)
67	-$(MKDIR) $(subst /,$(PS),$(@D))
68	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_APP_CLASS) $(JAVAFILES)
69
70$(OUT_APP_CLASS)/%.mf :
71	-$(MKDIR) $(subst /,$(PS),$(@D))
72	@echo Class-Path: Notes.jar> $@
73	@echo Main-Class: com.sun.star.lib.loader.Loader>> $@
74	$(ECHOLINE)>> $@
75	@echo Name: com/sun/star/lib/loader/Loader.class>> $@
76	@echo Application-Class: $*>> $@
77
78$(APP_JAR) : $(OUT_APP_CLASS)/$(APP_NAME).mf $(OUT_APP_CLASS)/$(APP_NAME).class
79	-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
80	-$(MKDIR) $(subst /,$(PS),$(@D))
81	+cd $(subst /,$(PS),$(OUT_APP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(APP_NAME).mf $(APP_NAME).class
82	+$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
83
84JavaNotesAccessExample : NotesAPIs $(APP_JAR)
85	@echo --------------------------------------------------------------------------------
86	@echo NOTE: Before you run this example make sure that the exaternal "$(QM)Notes.jar$(QM)" can
87	@echo be found besides "$(QM)$(APP_JAR)"$(QM)
88	@echo and that the PATH variable includes the Notes installation directory.
89	@echo -
90	@echo Please use the following command to execute the example!
91	@echo -
92	@echo $(MAKE) NotesAccess.run
93	@echo --------------------------------------------------------------------------------
94
95%.run: $(APP_JAR)
96	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< "$(QM)$(QM)" "$(QM)$(QM)" "$(QM)$(QM)" Stocks.nsf
97
98.PHONY: clean
99clean :
100	-$(DELRECURSIVE) $(subst \\,\,$(subst /,$(PS),$(OUT_APP_CLASS)))
101