Use constants to make indexes in credential array more readable
[remote/remote-ws.git] / Makefile
blobc9227edcf3e64838272c99b4da0de34e860a0fd1
1 ################################################################################
2 # Configuration section
3 ################################################################################
5 ## Webservice address information
7 # Information about the location of the webservice. It will be used when
8 # generating the client stubs from the WSDL files.
10 SERVICEHOST = amigos30.diku.dk
11 SERVICEPORT = 8080
12 SERVICEPATH = axis/services
14 SERVICELOCATION = http://$(SERVICEHOST):$(SERVICEPORT)/$(SERVICEPATH)
16 ## Webservice admin service information
18 # Information about the location and credentials for accessing the
19 # webservice framework with the AdminClient. Test the information using
20 # the deploy-test rule, which will try to contact the server and list
21 # the available webservices.
23 # To use the AdminClient program's default values, leave the variables
24 # empty.
26 ADMINHOST = amigos30.diku.dk
27 ADMINPORT = 8080
28 ADMINUSER =
29 ADMINPASS =
31 ## Location of the server class files
33 # The host and path specifying where the web service application
34 # infrastructure classes should be deployed. Note, that scp is used for
35 # this, so the DEPLOYLOCATION variable should hold a valid scp location.
37 # Leave DEPLOYHOST empty to deploy files locally.
39 DEPLOYHOST = remote-server
40 DEPLOYPATH = /opt/apache-tomcat-5.5.12/webapps/axis/WEB-INF/classes/
43 DEPLOYLOCATION = $(DEPLOYHOST)$(if $(DEPLOYHOST),:)$(DEPLOYPATH)
45 ################################################################################
46 # Build section
47 ################################################################################
49 JAVAC = javac
50 JAVA = java
51 JAR = jar
52 JAVADOC = javadoc
53 SCP = scp
54 CTAGS = ctags
56 LIBDIR = lib
57 WSDDDIR = wsdd
58 BUILDDIR = build
59 SERVERSRCDIR = src
60 CLIENTSRCDIR = $(BUILDDIR)/src
61 SERVERBINDIR = $(BUILDDIR)/server
62 CLIENTBINDIR = $(BUILDDIR)/client
63 WSDLDIR = $(BUILDDIR)/wsdl
64 DOCDIR = $(BUILDDIR)/doc
66 CLASSPATH = $(shell find $(PWD)/$(LIBDIR) -name "*.jar" | tr '\n' ':')$(PWD)/$(SERVERJAR)
68 COMPILE = $(JAVAC)
69 JAVA2WSDL = $(JAVA) org.apache.axis.wsdl.Java2WSDL
70 WSDL2JAVA = $(JAVA) org.apache.axis.wsdl.WSDL2Java
71 ADMINCLIENT = $(JAVA) org.apache.axis.client.AdminClient
73 SERVERSRC = $(shell find $(SERVERSRCDIR) -name "*.java")
74 SERVERJAR = $(LIBDIR)/remote-ws-server.jar
76 WSDDFILES = $(shell find $(WSDDDIR) -name "*.wsdd")
77 SERVICES = $(patsubst $(WSDDDIR)/%.wsdd,%,$(WSDDFILES))
79 WSDLFILES = $(patsubst %,$(WSDLDIR)/%.wsdl,$(SERVICES))
80 CLIENTSRC = $(patsubst %,$(CLIENTSRCDIR)/%-stamp,$(SERVICES))
81 CLIENTJAR = $(LIBDIR)/remote-ws-client.jar
83 DOCTITLE = "Re-Mote Web Services"
85 export CLASSPATH
87 all: client
89 clean:
90 $(RM) -r $(BUILDDIR) $(SERVERJAR) $(CLIENTJAR) tags
92 tags:
93 $(CTAGS) $(SERVERSRC)
95 strip-space:
96 perl -p -i -e 's/[ \t]*$$//' $(SERVERSRC) $(WSDDFILES)
98 doc:
99 $(JAVADOC) -doctitle $(DOCTITLE) -windowtitle $(DOCTITLE) \
100 -d $(DOCDIR) $(SERVERSRC)
102 .PHONY: doc
104 ## Rules for building the server and client class files
106 # This requires the immediate step of building WSDL files from the
107 # server Java classes. The client Java classes is then generated from
108 # the WSDL files.
110 wsdl: $(WSDLFILES)
111 client-src: $(CLIENTSRC)
112 client: $(CLIENTJAR)
113 server: $(SERVERJAR)
115 $(SERVERJAR): $(SERVERSRC)
116 @$(RM) -r $(SERVERBINDIR)
117 @mkdir -p $(SERVERBINDIR)
118 $(COMPILE) -d $(SERVERBINDIR) $(SERVERSRC)
119 $(JAR) cf $@ -C $(SERVERBINDIR) .
121 $(CLIENTJAR): $(CLIENTSRC)
122 @$(RM) -r $(CLIENTBINDIR)
123 @mkdir -p $(CLIENTBINDIR)
124 $(COMPILE) -d $(CLIENTBINDIR) $(shell find $(CLIENTSRCDIR) -name "*.java")
125 $(JAR) cf $@ -C $(CLIENTBINDIR) .
127 $(CLIENTSRCDIR)/%-stamp: $(WSDLDIR)/%.wsdl
128 $(WSDL2JAVA) -o $(CLIENTSRCDIR) -pdiku.distlab.remote.$(*F) $<
129 touch $@
131 $(WSDLDIR)/%.wsdl: $(WSDDDIR)/%.wsdd $(SERVERJAR)
132 @mkdir -p $(WSDLDIR)
133 $(JAVA2WSDL) -l $(SERVICELOCATION)/$(*F) -o $(WSDLDIR)/$(*F).wsdl \
134 -p"$(*F)=$(*F).remote.distlab.diku" \
135 "$(*F).$$(sed -n 's/.*className.*value="[^.]*\.\(.*\)".*/\1/p' < $<)"
137 $(BUILDDIR)/undeploy.wsdd:
138 @mkdir -p $(CLIENTBINDIR)
139 { echo '<undeployment xmlns="http://xml.apache.org/axis/wsdd/">'; \
140 for i in $(SERVICES); do echo "<service name=\"$$i\"/>"; done; \
141 echo '</undeployment>'; } > $@
143 ## Deployment rules
145 # Rules for deploying the Re-Mote webservices and for testing the setup.
147 RUNADMINCLIENT = $(ADMINCLIENT) \
148 $(if $(ADMINHOST),-h $(ADMINHOST)) \
149 $(if $(ADMINPORT),-p $(ADMINPORT)) \
150 $(if $(ADMINUSER),-u $(ADMINUSER)) \
151 $(if $(ADMINPASS),-w $(ADMINPASS))
153 deploy-test:
154 $(RUNADMINCLIENT) list
156 deploy-wsdd:
157 $(RUNADMINCLIENT) $(WSDDFILES)
159 deploy-jar: $(SERVERJAR)
160 $(SCP) $< $(DEPLOYLOCATION)
162 deploy: deploy-jar deploy-wsdd
164 undeploy: $(BUILDDIR)/undeploy.wsdd
165 $(RUNADMINCLIENT) $<