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 ConverterServlet 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
32COMPONENT_NAME=ConverterServletExample
33OUT_COMP_CLASS=$(OUT_CLASS)/$(COMPONENT_NAME)
34
35JAVAFILES  = \
36	ConverterServlet.java
37
38CLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(JAVAFILES))
39
40SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
41		$(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/cos.jar\
42		$(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/servlet.jar\
43		$(PATH_SEPARATOR)$(OUT_COMP_CLASS))
44
45# Targets
46.PHONY: ALL
47ALL : \
48    ConverterServletExample
49
50include $(SETTINGS)/stdtarget.mk
51
52$(OFFICE_CLASSES_DIR)/cos.jar :
53	@echo --------------------------------------------------------------------------------
54	@echo You need the servlet support Java archive "$(QM)cos.jar$(QM)" for this example.
55	@echo You can download it from "$(QM)http://www.servlets.com/cos/index.html$(QM)"
56	@echo and then please copy it into your "$(QM)$(OFFICE_CLASSES_DIR)$(QM)" directory.
57	@echo --------------------------------------------------------------------------------
58
59$(OFFICE_CLASSES_DIR)/servlet.jar :
60	@echo --------------------------------------------------------------------------------
61	@echo You need the servlet API "$(QM)servlet.jar$(QM)" for this example.
62	@echo You can download it from "$(QM)http://java.sun.com/products/servlet/index.html$(QM)"
63	@echo and then please copy it into your "$(QM)$(OFFICE_CLASSES_DIR)$(QM)" directory.
64	@echo --------------------------------------------------------------------------------
65
66$(CLASSFILES) : $(JAVAFILES) $(OFFICE_CLASSES_DIR)/cos.jar $(OFFICE_CLASSES_DIR)/servlet.jar
67	-$(MKDIR) $(subst /,$(PS),$(@D))
68	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $(JAVAFILES)
69
70ConverterServletExample : $(CLASSFILES)
71	@echo --------------------------------------------------------------------------------
72	@echo Please see the README file for more information how to use the converter
73	@echo servlet.
74	@echo --------------------------------------------------------------------------------
75
76%.run: $(OUT_COMP_CLASS)/%.class
77	$(JAVA) -classpath "$(SDK_CLASSPATH)" $(basename $@)
78
79.PHONY: clean
80clean :
81	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS))
82