MoteData: no need to import classes from the same package
[remote/remote-ws.git] / Makefile
blob83373bf231073fb7a946c435348fc5d7ee5cfad9
1 ################################################################################
2 # Configuration section
3 ################################################################################
5 # Note, the following configuration settings can be put in a file called
6 # Makefile.local that is automatically sourced by this Makefile. See
7 # contrib/Makefile.local.* for examples.
9 ## Webservice address information
11 # Information about the location of the webservice. It will be used when
12 # generating the client stubs from the WSDL files.
14 SERVICEHOST = localhost
15 SERVICEPORT = 8080
16 SERVICEPATH = axis/services
18 ## Webservice admin service information
20 # Information about the location and credentials for accessing the
21 # webservice framework with the AdminClient. Test the information using
22 # the deploy-test rule, which will try to contact the server and list
23 # the available webservices.
25 # To use the AdminClient program's default values, leave the variables
26 # empty.
28 ADMINHOST = localhost
29 ADMINPORT = 8080
30 ADMINUSER =
31 ADMINPASS =
33 ## Location of the server class files
35 # The host and path specifying where the web service application
36 # infrastructure jar files should be deployed. Note, that scp is used for
37 # this, so the DEPLOYLOCATION variable should hold a valid scp location.
39 # Leave DEPLOYHOST empty to deploy files locally.
41 DEPLOYHOST =
42 DEPLOYPATH = /path/to/tomcatX.X/webapps/axis/WEB-INF/lib/
44 ################################################################################
45 # Build section
46 ################################################################################
48 JAVAC = javac
49 JAVA = java
50 JAR = jar
51 JAVADOC = javadoc
52 SCP = scp
53 CTAGS = ctags
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 DOCDIR = $(BUILDDIR)/doc
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
72 SERVERSRC = $(shell find $(SERVERSRCDIR) -name "*.java")
73 SERVERJAR = $(LIBDIR)/remote-ws-server.jar
75 WSDDFILES = $(shell find $(WSDDDIR) -name "*.wsdd")
76 SERVICES = $(patsubst $(WSDDDIR)/%.wsdd,%,$(WSDDFILES))
78 WSDLFILES = $(patsubst %,$(WSDLDIR)/%.wsdl,$(SERVICES))
79 CLIENTSRC = $(patsubst %,$(CLIENTSRCDIR)/%-stamp,$(SERVICES))
80 CLIENTJAR = $(LIBDIR)/remote-ws-client.jar
82 DOCTITLE = "Re-Mote Web Services"
84 ## Handle local configuration settings
86 # ... and assemble the location variables
88 -include Makefile.local
90 SERVICELOCATION = http://$(SERVICEHOST):$(SERVICEPORT)/$(SERVICEPATH)
91 DEPLOYLOCATION = $(DEPLOYHOST)$(if $(DEPLOYHOST),:)$(DEPLOYPATH)
93 ## Export the CLASSPATH to avoid setting it on the command line
95 # This can potentially overwrite local CLASSPATH configuration but as
96 # far as remote-ws is concerned it should be self contained.
98 export CLASSPATH
100 ## Basic build rules
102 all: client
104 clean:
105 $(RM) -r $(BUILDDIR) $(SERVERJAR) $(CLIENTJAR) tags
107 tags:
108 $(CTAGS) $(SERVERSRC)
110 strip-space:
111 perl -p -i -e 's/[ \t]*$$//' $(SERVERSRC) $(WSDDFILES)
113 doc:
114 $(JAVADOC) -doctitle $(DOCTITLE) -windowtitle $(DOCTITLE) \
115 -d $(DOCDIR) $(SERVERSRC)
117 .PHONY: all doc clean strip-space
119 ## Rules for building the server and client class files
121 # This requires the immediate step of building WSDL files from the
122 # server Java classes. The client Java classes is then generated from
123 # the WSDL files.
125 wsdl: $(WSDLFILES)
126 client-src: $(CLIENTSRC)
127 client: $(CLIENTJAR)
128 server: $(SERVERJAR)
130 $(SERVERJAR): $(SERVERSRC)
131 @$(RM) -r $(SERVERBINDIR)
132 @mkdir -p $(SERVERBINDIR)
133 $(COMPILE) -d $(SERVERBINDIR) $(SERVERSRC)
134 $(JAR) cf $@ -C $(SERVERBINDIR) .
136 $(CLIENTJAR): $(CLIENTSRC)
137 @$(RM) -r $(CLIENTBINDIR)
138 @mkdir -p $(CLIENTBINDIR)
139 $(COMPILE) -d $(CLIENTBINDIR) $(shell find $(CLIENTSRCDIR) -name "*.java")
140 $(JAR) cf $@ -C $(CLIENTBINDIR) .
142 $(CLIENTSRCDIR)/%-stamp: $(WSDLDIR)/%.wsdl
143 $(WSDL2JAVA) -o $(CLIENTSRCDIR) -pdiku.distlab.remote.$(*F) $<
144 touch $@
146 $(WSDLDIR)/%.wsdl: $(WSDDDIR)/%.wsdd $(SERVERJAR)
147 @mkdir -p $(WSDLDIR)
148 $(JAVA2WSDL) -l $(SERVICELOCATION)/$(*F) -o $(WSDLDIR)/$(*F).wsdl \
149 -p"$(*F)=$(*F).remote.distlab.diku" \
150 "$(*F).$$(sed -n 's/.*className.*value="[^.]*\.\(.*\)".*/\1/p' < $<)"
152 $(BUILDDIR)/undeploy.wsdd:
153 @mkdir -p $(CLIENTBINDIR)
154 { echo '<undeployment xmlns="http://xml.apache.org/axis/wsdd/">'; \
155 for i in $(SERVICES); do echo "<service name=\"$$i\"/>"; done; \
156 echo '</undeployment>'; } > $@
158 ## Deployment rules
160 # Rules for deploying the Re-Mote webservices and for testing the setup.
162 RUNADMINCLIENT = $(ADMINCLIENT) \
163 $(if $(ADMINHOST),-h $(ADMINHOST)) \
164 $(if $(ADMINPORT),-p $(ADMINPORT)) \
165 $(if $(ADMINUSER),-u $(ADMINUSER)) \
166 $(if $(ADMINPASS),-w $(ADMINPASS))
168 deploy-test:
169 $(RUNADMINCLIENT) list
171 deploy-wsdd:
172 $(RUNADMINCLIENT) $(WSDDFILES)
174 deploy-jar: $(SERVERJAR)
175 $(SCP) $< $(DEPLOYLOCATION)
177 deploy: deploy-jar deploy-wsdd
179 undeploy: $(BUILDDIR)/undeploy.wsdd
180 $(RUNADMINCLIENT) $<