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 Configuration 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
32SAMPLE_NAME=DevGuideConfigExamples
33SAMPLE_CLASS_OUT = $(OUT_CLASS)/$(SAMPLE_NAME)
34SAMPLE_GEN_OUT = $(OUT_MISC)/$(SAMPLE_NAME)
35
36# some special macro names for separating the example jar stuff
37APP1_NAME=ConfigExamples
38APP1_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP1_NAME)
39APP1_GEN_OUT=$(SAMPLE_GEN_OUT)/$(APP1_NAME)
40APP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar
41APP1_JAR_MANIFEST=$(APP1_GEN_OUT)/$(APP1_NAME).mf
42
43SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
44		$(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)\
45		$(PATH_SEPARATOR)$(APP1_CLASS_OUT))
46
47# Targets
48.PHONY: ALL
49ALL : $(SAMPLE_NAME)
50
51include $(SETTINGS)/stdtarget.mk
52
53# rule for example application class files
54$(APP1_CLASS_OUT)/%.class : %.java
55	-$(MKDIR) $(subst /,$(PS),$(@D))
56	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP1_CLASS_OUT) $<
57
58# rule for client/example application manifest file
59$(APP1_GEN_OUT)/%.mf :
60	-$(MKDIR) $(subst /,$(PS),$(@D))
61	@echo Main-Class: com.sun.star.lib.loader.Loader> $@
62	$(ECHOLINE)>> $@
63	@echo Name: com/sun/star/lib/loader/Loader.class>> $@
64	@echo Application-Class: $*>> $@
65
66# rule for client/example application jar file
67$(APP1_JAR) : $(APP1_JAR_MANIFEST) $(APP1_CLASS_OUT)/$(APP1_NAME).class
68	-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
69	-$(MKDIR) $(subst /,$(PS),$(@D))
70	$(SDK_JAR) cvfm $@  $< -C $(APP1_CLASS_OUT) .
71	+$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
72
73$(SAMPLE_NAME) : $(APP1_JAR)
74	@echo --------------------------------------------------------------------------------
75	@echo Please use the following command to execute the example!
76	@echo -
77	@echo $(MAKE) $(APP1_NAME).run
78	@echo --------------------------------------------------------------------------------
79
80%.run: $(SAMPLE_CLASS_OUT)/%.jar
81	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
82
83.PHONY: clean
84clean :
85	-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
86	-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
87