Fix the deploy-classes rule to copy to the right location
[remote/remote-ws.git] / Makefile
bloba87d8e0c47e7e129f79dd6e8fbbaa66bfee5d86c
1 ################################################################################
2 # Configuration section
3 ################################################################################
5 ## Location of the server class files
7 # The host and path specifying where the web service application
8 # infrastructure classes should be deployed. Note, that scp is used for
9 # this, so the DEPLOYLOCATION variable should hold a valid scp location.
11 DEPLOYHOST = remote-server
12 DEPLOYPATH = /opt/apache-tomcat-5.5.12/webapps/axis/WEB-INF/classes/
14 DEPLOYLOCATION = $(DEPLOYHOST):$(DEPLOYPATH)
16 ## Webservice address information
18 # Information about the location of the webservice.
20 SERVICEHOST = amigos30.diku.dk
21 SERVICEPORT = 8080
22 SERVICEPATH = axis/services
24 SERVICELOCATION = http://$(SERVICEHOST):$(SERVICEPORT)/$(SERVICEPATH)
26 ## Webservice admin credential information
28 # Information about the location and credentials for accessing the
29 # webservice framework with the AdminClient. Test the information using
30 # the service-test rule.
32 ADMINHOST = amigos30.diku.dk
33 ADMINUSER = admin
34 ADMINPASS = secret
36 ## Configuration for running the SimpleAxisServer
38 # This server is used for locally generating the WSDL files from the
39 # server package.
41 AXISHOST = localhost
42 AXISPORT = 8080
44 AXISLOCATION = http://$(AXISHOST):$(AXISPORT)/axis/services
46 ################################################################################
47 # Build section
48 ################################################################################
50 JAVAC = javac
51 JAVA = java
52 JAR = jar
53 SCP = scp
55 LIBDIR = lib
56 WSDDDIR = wsdd
57 BUILDDIR = build
58 SERVERSRCDIR = src
59 CLIENTSRCDIR = $(BUILDDIR)/src
60 SERVERBINDIR = $(BUILDDIR)/server
61 CLIENTBINDIR = $(BUILDDIR)/client
62 WSDLDIR = $(BUILDDIR)/wsdl
63 AXIS_PATH = $(BUILDDIR)/axis
65 CLASSPATH = $(shell find $(PWD)/$(LIBDIR) -name "*.jar" | tr '\n' ':')$(PWD)/$(SERVERJAR)
67 COMPILE = $(JAVAC)
68 JAVA2WSDL = $(JAVA) org.apache.axis.wsdl.Java2WSDL
69 WSDL2JAVA = $(JAVA) org.apache.axis.wsdl.WSDL2Java
70 ADMINCLIENT = $(JAVA) org.apache.axis.client.AdminClient
71 AXISSERVER = $(JAVA) org.apache.axis.transport.http.SimpleAxisServer
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 AXISLOG = $(AXIS_PATH)/log
85 export CLASSPATH
86 export AXIS_PATH
88 all: client
90 clean:
91 $(RM) -r $(BUILDDIR) $(SERVERJAR) $(CLIENTJAR) server-config.wsdd
93 ## Rules for building the server and client class files
95 # This requires the immediate step of building WSDL files from the
96 # server Java classes. The client Java classes is then generated from
97 # the WSDL files.
99 wsdl: $(WSDLFILES) simpleaxisserver-stop
100 client-src: $(CLIENTSRC) simpleaxisserver-stop
101 client: $(CLIENTJAR) simpleaxisserver-stop
102 server: $(SERVERJAR)
104 $(SERVERJAR): $(SERVERSRC)
105 @$(RM) -r $(SERVERBINDIR)
106 @mkdir -p $(SERVERBINDIR)
107 $(COMPILE) -d $(SERVERBINDIR) $(SERVERSRC)
108 $(JAR) cf $@ -C $(SERVERBINDIR) .
110 $(CLIENTJAR): $(CLIENTSRC)
111 @$(RM) -r $(CLIENTBINDIR)
112 @mkdir -p $(CLIENTBINDIR)
113 $(COMPILE) -d $(CLIENTBINDIR) $(shell find $(CLIENTSRCDIR) -name "*.java")
114 $(JAR) cf $@ -C $(CLIENTBINDIR) .
116 $(CLIENTSRCDIR)/%-stamp: $(WSDLDIR)/%.wsdl
117 $(WSDL2JAVA) -o $(CLIENTSRCDIR) -pdiku.distlab.remote.$(*F) $<
118 touch $@
120 $(WSDLDIR)/%.wsdl: $(WSDDDIR)/%.wsdd $(SERVERJAR)
121 @mkdir -p $(WSDLDIR) $(AXIS_PATH)
122 test -e $(AXISLOG) || $(AXISSERVER) -p $(AXISPORT) >> $(AXISLOG) &
123 $(ADMINCLIENT) -h $(AXISHOST) -p $(AXISPORT) $<
124 wget -q -O - $(AXISLOCATION)/$(*F)?wsdl | \
125 sed 's#http://.*:$(AXISPORT)/axis/services/#$(SERVICELOCATION)/#' \
126 > $@
129 ## Deployment rules
131 # Rules for deploying the Re-Mote webservices and for testing the setup.
133 deploy-test:
134 $(ADMINCLIENT) -h $(ADMINHOST) -u $(ADMINUSER) -w $(ADMINPASS) list
136 deploy-wsdd: $(SERVERJAR)
137 $(ADMINCLIENT) -h $(ADMINHOST) -u $(ADMINUSER) -w $(ADMINPASS) $(WSDDFILES)
139 deploy-classes: $(SERVERJAR)
140 $(SCP) -r $(SERVERBINDIR)/* $(WSDDDIR) $(DEPLOYLOCATION)
142 deploy: deploy-classes deploy-wsdd
144 ## WSDL / SimpleAxisServer rules
146 # Rules to startup a simple axis server and get WSDL files.
148 simpleaxisserver-stop:
149 test ! -e $(AXISLOG) || $(ADMINCLIENT) -h $(AXISHOST) -p $(AXISPORT) quit
150 @$(RM) -r $(AXIS_PATH)