1#############################################################################
2# Software Testing Automation Framework (STAF)                              #
3# (C) Copyright IBM Corp. 2002                                              #
4#                                                                           #
5# This software is licensed under the Eclipse Public License (EPL) V1.0.    #
6#############################################################################
7
8ifndef APACHE_XERCES_ROOT
9  $(error You must set APACHE_XERCES_ROOT to the full pathname containing xercesImpl.jar and xmlParserAPIs.jar)
10endif
11ifndef NEKOHTML_ROOT
12  $(error You must set NEKOHTML_ROOT to the full pathname containing nekohtml.jar)
13endif
14ifndef COMMONS_HTTPCLIENT_ROOT
15  $(error You must set COMMONS_HTTPCLIENT_ROOT to the full pathname containing commons-httpclient-<VERSION>.jar)
16endif
17ifndef COMMONS_CODEC_ROOT
18  $(error You must set COMMONS_CODEC_ROOT to the full pathname containing commons-codec-<VERSION>.jar)
19endif
20ifndef COMMONS_LOGGING_ROOT
21  $(error You must set COMMONS_LOGGING_ROOT to the full pathname containing commons-logging-<VERSION>.jar and commons-logging-api-<VERSION>.jar)
22endif
23
24# Find the commons-httpclient-<VERSION>.jar file in the root directory for Commons HttpClient
25COMMONS_HTTPCLIENT_JAR = $(wildcard $(COMMONS_HTTPCLIENT_ROOT)/commons-httpclient-*.jar)
26COMMONS_HTTPCLIENT_JAR_FILE = $(notdir $(COMMONS_HTTPCLIENT_JAR))
27
28# Find the commons-codec-<VERSION>.jar file in the root directory for Commons Codec
29COMMONS_CODEC_JAR = $(wildcard $(COMMONS_CODEC_ROOT)/commons-codec-*.jar)
30COMMONS_CODEC_JAR_FILE = $(notdir $(COMMONS_CODEC_JAR))
31
32# Find the commons-logging-api-<VERSION>.jar file in the root directory for Commons Logging
33COMMONS_LOGGING_API_JAR = $(wildcard $(COMMONS_LOGGING_ROOT)/commons-logging-api-*.jar )
34COMMONS_LOGGING_API_JAR_FILE = $(notdir $(COMMONS_LOGGING_API_JAR))
35
36# Find the commons-logging-<VERSION>.jar file in the root directory for Commons Logging
37# using wildcard ?.* in jar file name so as to only get this file and not
38# commons-logging-api-<VERSION>.jar or commons-logging-adapters-<VERSION>.jar
39COMMONS_LOGGING_JAR = $(wildcard $(COMMONS_LOGGING_ROOT)/commons-logging-?.*.jar)
40COMMONS_LOGGING_JAR_FILE = $(notdir $(COMMONS_LOGGING_JAR))
41
42HTTP_MANIFEST = $(O)/services/http/MANIFEST.MF
43
44# Define the targets
45
46http_class_targets =\
47  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/HTTP.class \
48  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/utility/ServiceUtilities.class \
49  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/SessionList.class \
50  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/WebSession.class \
51  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/InvalidSessionIDException.class \
52  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/InvalidElementIDException.class \
53  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/InvalidCookieIDException.class \
54  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/CookieAccess.class \
55  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/html/Parameter.class \
56  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/html/ParameterFactory.class \
57  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/html/WebElement.class \
58  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/html/WebLink.class \
59  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/html/WebForm.class \
60  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/html/HTMLParser.class \
61  $(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/html/InvalidParameterValueException.class \
62  $(HTTP_MANIFEST)
63
64http_jar_targets =\
65  $(O)/services/http/STAF-INF/jars/xercesImpl.jar \
66  $(O)/services/http/STAF-INF/jars/xmlParserAPIs.jar \
67  $(O)/services/http/STAF-INF/jars/nekohtml.jar \
68  $(O)/services/http/STAF-INF/jars/$(COMMONS_LOGGING_JAR_FILE) \
69  $(O)/services/http/STAF-INF/jars/$(COMMONS_LOGGING_API_JAR_FILE) \
70  $(O)/services/http/STAF-INF/jars/$(COMMONS_CODEC_JAR_FILE) \
71  $(O)/services/http/STAF-INF/jars/$(COMMONS_HTTPCLIENT_JAR_FILE)
72
73http_targets += $(http_class_targets)\
74                $(http_jar_targets)\
75                $(REL)/lib/STAFHTTP.jar
76Targets += $(http_targets)
77CleanupTargets += cleanup_http
78
79$(http_targets): SUBSYS_REL := services/http
80SUBSYS_REL := services/http
81
82# Include inference rules
83include $(InferenceRules)
84
85$(http_targets): $(REL)/lib/JSTAF.zip
86
87HTTP_CLASSPATH = $(OS_O)/services/http$(OS_PS)$(OS_REL)/lib/JSTAF.zip$(OS_PS)$(APACHE_XERCES_ROOT)/xercesImpl.jar$(OS_PS)$(APACHE_XERCES_ROOT)/xmlParserAPIs.jar$(OS_PS)$(COMMONS_LOGGING_JAR)$(OS_PS)$(COMMONS_LOGGING_API_JAR)$(OS_PS)$(NEKOHTML_ROOT)/nekohtml.jar$(OS_PS)$(COMMONS_CODEC_JAR)$(OS_PS)$(COMMONS_HTTPCLIENT_JAR)$(OS_PS)$(JAVA_CLASSPATH)
88
89define HTTP_JAVA_COMPILE_IT
90   @echo "*** Compiling HTTP Service Java Sources ***"
91   @$(CREATE_PATH)
92   @$(JAVAC) -d $(OS_O)/services/http/STAF-INF/classes -classpath '$(HTTP_CLASSPATH)' $(OS_SRC)/services/http/*.java
93endef
94
95$(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/%.class: $(SRC)/services/http/%.java
96	$(HTTP_JAVA_COMPILE_IT)
97
98$(O)/services/http/STAF-INF/classes/com/ibm/staf/service/http/html/%.class: $(SRC)/services/http/%.java
99	$(HTTP_JAVA_COMPILE_IT)
100
101$(O)/services/http/STAF-INF/classes/com/ibm/staf/service/utility/%.class: $(SRC)/services/http/%.java
102	$(HTTP_JAVA_COMPILE_IT)
103
104# HTTP Java targets
105
106$(O)/services/http/STAF-INF/jars/xercesImpl.jar: $(APACHE_XERCES_ROOT)/xercesImpl.jar
107	$(COPY_FILE)
108$(O)/services/http/STAF-INF/jars/xmlParserAPIs.jar: $(APACHE_XERCES_ROOT)/xmlParserAPIs.jar
109	$(COPY_FILE)
110$(O)/services/http/STAF-INF/jars/nekohtml.jar: $(NEKOHTML_ROOT)/nekohtml.jar
111	$(COPY_FILE)
112$(O)/services/http/STAF-INF/jars/$(COMMONS_LOGGING_JAR_FILE): $(COMMONS_LOGGING_JAR)
113	$(COPY_FILE)
114$(O)/services/http/STAF-INF/jars/$(COMMONS_LOGGING_API_JAR_FILE): $(COMMONS_LOGGING_API_JAR)
115	$(COPY_FILE)
116$(O)/services/http/STAF-INF/jars/$(COMMONS_CODEC_JAR_FILE): $(COMMONS_CODEC_JAR)
117	$(COPY_FILE)
118$(O)/services/http/STAF-INF/jars/$(COMMONS_HTTPCLIENT_JAR_FILE): $(COMMONS_HTTPCLIENT_JAR)
119	$(COPY_FILE)
120
121# Create the MANIFEST.MF file dynamically for the HTTP service because the
122# names of the jar files in the "Packaged-Jars:" line in the manifest can
123# vary depending on the version of HttpClient, Commons Logging, and Commons
124# Codec being used to build the HTTP service
125
126$(HTTP_MANIFEST): $(SRC)/services/http/*.java $(COMMONS_LOGGING_JAR) $(COMMONS_LOGGING_API_JAR) $(COMMONS_HTTPCLIENT_JAR) $(COMMONS_CODEC_JAR)
127	@echo "*** Creating $(@F) for HTTP Service ***"
128	-@echo "Manifest-Version: 1.0" > $(HTTP_MANIFEST)
129	-@echo "" >> $(HTTP_MANIFEST)
130	-@echo "Name: staf/service/info" >> $(HTTP_MANIFEST)
131	-@echo "Service-Class: com.ibm.staf.service.http.HTTP" >> $(HTTP_MANIFEST)
132	-@echo "Packaged-Jars: $(COMMONS_HTTPCLIENT_JAR_FILE) nekohtml.jar xercesImpl.jar $(COMMONS_CODEC_JAR_FILE) $(COMMONS_LOGGING_JAR_FILE) $(COMMONS_LOGGING_API_JAR_FILE) xmlParserAPIs.jar" >> $(HTTP_MANIFEST)
133
134# Create the jar file for the HTTP Service
135
136$(REL)/lib/STAFHTTP.jar: $(http_class_targets) $(http_jar_targets)
137	@echo "*** Creating $(@F) ***"
138	@cd $(O)/services/http; $(JAR) cfm '$(OS_@)' MANIFEST.MF STAF-INF
139
140cleanup_http:
141	-@$(DEL) $(O)/services/http/* $(OUT_ERR_TO_DEV_NULL)
142