End of oasisfication
[ocsoap/ocsoap.git] / Makefile.org
1 # $Id: Makefile,v 1.28 2006/05/10 08:35:48 rich Exp $
2
3 include Makefile.config
4
5 OCAMLPACKAGES   := \
6         -package dynlink,pxp-lex-utf8,pxp-engine,netclient,cduce,extlib,calendar,pcre
7
8 OCAMLCFLAGS     := -g -I examples/adwords
9 OCAMLOPTFLAGS   := -I examples/adwords
10
11 OCAMLDEP        := ocamldep
12
13 OCAMLDOCFLAGS := -html -stars -sort $(OCAMLOPTFLAGS)
14
15 all: pa_ocsoapclientstubs.cmo wsdl_validate.opt wsdltointf.opt \
16         oCSoap.cmo oCSoap.cmx META
17 all: examples
18
19 META: META.in
20         sed -e 's/@VERSION@/$(VERSION)/g' < $< > $@
21
22 pa_ocsoapclientstubs.cmo: pa_ocsoapclientstubs.ml4
23         ocamlc -pp "camlp5o pa_extend.cmo q_MLast.cmo -loc loc -impl" \
24           -I +camlp5 -c -impl $<
25
26 wsdl_validate.opt: wsdl.cmx wsdl_validate.cmx
27         ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLPACKAGES) -linkpkg $^ -o $@
28
29 wsdltointf.opt: wsdl.cmx wsdltointf.cmx
30         ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLPACKAGES) -linkpkg $^ -o $@
31
32 wsdl.cdo: wsdl.cmi
33 wsdl.cmi: wsdl.cd
34
35 ADWORDS_WSDL := \
36         examples/adwords/AccountService.wsdl \
37         examples/adwords/AdGroupService.wsdl \
38         examples/adwords/CampaignService.wsdl \
39         examples/adwords/CreativeService.wsdl \
40         examples/adwords/InfoService.wsdl \
41         examples/adwords/KeywordService.wsdl \
42         examples/adwords/ReportService.wsdl \
43         examples/adwords/TrafficEstimatorService.wsdl
44
45 ADWORDS_CMX := \
46         examples/adwords/accountService_types.cmx \
47         examples/adwords/accountService_conv.cmx \
48         examples/adwords/accountService.cmx \
49         examples/adwords/adGroupService_types.cmx \
50         examples/adwords/adGroupService_conv.cmx \
51         examples/adwords/adGroupService.cmx \
52         examples/adwords/campaignService_types.cmx \
53         examples/adwords/campaignService_conv.cmx \
54         examples/adwords/campaignService.cmx \
55         examples/adwords/creativeService_types.cmx \
56         examples/adwords/creativeService_conv.cmx \
57         examples/adwords/creativeService.cmx \
58         examples/adwords/infoService_types.cmx \
59         examples/adwords/infoService_conv.cmx \
60         examples/adwords/infoService.cmx \
61         examples/adwords/keywordService_types.cmx \
62         examples/adwords/keywordService_conv.cmx \
63         examples/adwords/keywordService.cmx \
64         examples/adwords/reportService_types.cmx \
65         examples/adwords/reportService_conv.cmx \
66         examples/adwords/reportService.cmx \
67         examples/adwords/trafficEstimatorService_types.cmx \
68         examples/adwords/trafficEstimatorService_conv.cmx \
69         examples/adwords/trafficEstimatorService.cmx
70
71 examples/adwords/test1.opt: oCSoap.cmx $(ADWORDS_CMX) \
72                 examples/adwords/headers.cmx examples/adwords/test1.cmx
73         ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLPACKAGES) -linkpkg \
74           $^ -o $@
75
76 examples/adwords/test2.opt: oCSoap.cmx $(ADWORDS_CMX) \
77                 examples/adwords/headers.cmx examples/adwords/test2.cmx
78         ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLPACKAGES) -linkpkg \
79           $^ -o $@
80
81 examples/adwords/example.opt: oCSoap.cmx $(ADWORDS_CMX) \
82                 examples/adwords/example.cmx
83         ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLPACKAGES) -linkpkg \
84           $^ -o $@
85
86 examples/adwords/fault.opt: oCSoap.cmx $(ADWORDS_CMX) \
87                 examples/adwords/fault.cmx
88         ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLPACKAGES) -linkpkg \
89           $^ -o $@
90
91 examples/adwords/%Service.cmx: examples/adwords/%Service.intf
92         ocamlfind ocamlopt $(OCAMLOPTFLAGS) -c \
93           -pp "camlp5o ./pa_ocsoapclientstubs.cmo -impl" -c -impl $<
94
95 examples: examples/adwords/test1.opt examples/adwords/test2.opt examples/adwords/example.opt
96
97 .PHONY: examples
98
99 examples/adwords/accountService.intf examples/adwords/accountService_types.ml examples/adwords/accountService_conv.ml: examples/adwords/AccountService.wsdl wsdltointf.opt
100         ./wsdltointf.opt $<
101 examples/adwords/adGroupService.intf examples/adwords/adGroupService_types.ml examples/adwords/adGroupService_conv.ml: examples/adwords/AdGroupService.wsdl wsdltointf.opt
102         ./wsdltointf.opt $<
103 examples/adwords/campaignService.intf examples/adwords/campaignService_types.ml examples/adwords/campaignService_conv.ml: examples/adwords/CampaignService.wsdl wsdltointf.opt
104         ./wsdltointf.opt $<
105 examples/adwords/creativeService.intf examples/adwords/creativeService_types.ml examples/adwords/creativeService_conv.ml: examples/adwords/CreativeService.wsdl wsdltointf.opt
106         ./wsdltointf.opt $<
107 examples/adwords/infoService.intf examples/adwords/infoService_types.ml examples/adwords/infoService_conv.ml: examples/adwords/InfoService.wsdl wsdltointf.opt
108         ./wsdltointf.opt $<
109 examples/adwords/keywordService.intf examples/adwords/keywordService_types.ml examples/adwords/keywordService_conv.ml: examples/adwords/KeywordService.wsdl wsdltointf.opt
110         ./wsdltointf.opt $<
111 examples/adwords/reportService.intf examples/adwords/reportService_types.ml examples/adwords/reportService_conv.ml: examples/adwords/ReportService.wsdl wsdltointf.opt
112         ./wsdltointf.opt $<
113 examples/adwords/trafficEstimatorService.intf examples/adwords/trafficEstimatorService_types.ml examples/adwords/trafficEstimatorService_conv.ml: examples/adwords/TrafficEstimatorService.wsdl wsdltointf.opt
114         ./wsdltointf.opt $<
115
116 #examples/fusionforge/FusionForge.intf examples/fusionforge/FusionForge_types.ml examples/fusionforge/FusionForge_conv.ml: examples/fusionforge/FusionForge.wsdl wsdltointf.opt
117 #       ./wsdltointf.opt $<
118 #
119 #FUSIONFORGE_CMX=\
120 #  examples/fusionforge/FusionForge_types.cmx \
121 #       examples/fusionforge/FusionForge_conv.cmx \
122 #       examples/fusionforge/FusionForge.cmx \
123 #       examples/fusionforge/test.cmx
124 #
125 #examples/fusionforge/test.opt: oCSoap.cmx $(FUSIONFORGE_CMX)
126 #       ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLPACKAGES) -linkpkg $^ -o $@
127 #
128 #examples: examples/fusionforge/test.opt
129
130 # Download fresh WSDL files from Google.
131
132 download_google_wsdl:
133         for f in $(ADWORDS_WSDL); do \
134           b=`basename $$f .wsdl`; \
135           wget --no-check-certificate -O /tmp/wsdl https://adwords.google.com/api/adwords/v2/$$b?wsdl; \
136           if [ $$? -eq 0 ]; then mv /tmp/wsdl $$f; else exit 1; fi; \
137         done
138
139 # Make clean.
140
141 CLEANFILES := core *.bak *~ *.cmi *.cmo *.cma *.a *.o *.cmx *.cmxa *.opt
142
143 clean:
144         for d in . examples/adwords; do (cd $$d; rm -f $(CLEANFILES)); done
145         -$(RM) examples/adwords/*.intf examples/adwords/*_conv.ml \
146           examples/adwords/*_types.ml
147         -$(RM) examples/fusionforge/*.intf examples/fusionforge/*_conv.ml \
148           examples/fusionforge/*_types.ml
149         -$(RM) wsdl.cdo
150
151 distclean: clean
152         $(RM) META
153         $(RM) .depend
154
155 .PHONY: clean distclean
156
157 # Installation.
158
159 INSTALLFILES = META *.cmi *.cmo *.cmx *.o *.mli *.opt
160
161 ifeq ($(DESTDIR),)
162 install:
163         ocamlfind install ocsoap $(INSTALLFILES)
164 else
165 install:
166         ocamlfind install -destdir $(DESTDIR)$(shell ocamlc -where) \
167           ocsoap $(INSTALLFILES)
168 endif
169
170 # Standard rules.
171
172 %.cmi: %.mli
173         ocamlfind ocamlc $(OCAMLCFLAGS) $(OCAMLPACKAGES) -c $<
174
175 %.cmo: %.ml
176         ocamlfind ocamlc $(OCAMLCFLAGS) $(OCAMLPACKAGES) -c $<
177
178 %.cmx: %.ml
179         ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLPACKAGES) -c $<
180
181 %.cmo: %.cdo
182         ocamlfind ocamlc $(OCAMLCFLAGS) -c -package cduce \
183           -pp "$(CDUCE_MKSTUBS)" -impl $<
184
185 %.cmx: %.cdo
186         ocamlfind ocamlopt $(OCAMLOPTFLAGS) -c -package cduce \
187           -pp "$(CDUCE_MKSTUBS)" -impl $<
188
189 %.cdo: %.cd
190         $(CDUCE) --compile $<
191
192 .SUFFIXES: .mli .ml .cmi .cmo .cmx .cd .cdo
193
194 # Build dependencies.
195
196 ifeq ($(wildcard .depend),.depend)
197 include .depend
198 endif
199
200 depend: .depend
201
202 .depend: $(wildcard *.mli) $(wildcard *.ml) \
203         $(wildcard examples/adwords/*.mli) $(wildcard examples/adwords/*.ml)
204         $(OCAMLDEP) $^ > .depend
205         for f in examples/adwords/*.intf; do \
206           $(OCAMLDEP) \
207           -pp "camlp5o ./pa_ocsoapclientstubs.cmo pr_o.cmo -impl" $$f \
208           >> .depend; \
209         done
210
211 # Distribution.
212
213 dist:
214         $(MAKE) check-manifest
215         rm -rf $(PACKAGE)-$(VERSION)
216         mkdir $(PACKAGE)-$(VERSION)
217         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
218         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
219         rm -rf $(PACKAGE)-$(VERSION)
220         ls -l $(PACKAGE)-$(VERSION).tar.gz
221
222 check-manifest:
223         @for d in `find -type d -name CVS | grep -v '^\./debian/'`; \
224         do \
225         b=`dirname $$d`/; \
226         awk -F/ '$$1 != "D" {print $$2}' $$d/Entries | \
227         sed -e "s|^|$$b|" -e "s|^\./||"; \
228         done | sort > .check-manifest; \
229         sort MANIFEST > .orig-manifest; \
230         diff -u .orig-manifest .check-manifest; rv=$$?; \
231         rm -f .orig-manifest .check-manifest; \
232         exit $$rv
233
234 # Developer documentation (in html/ subdirectory).
235
236 doc:
237         rm -rf html
238         mkdir html
239         -ocamlfind ocamldoc $(OCAMLPACKAGES) $(OCAMLDOCFLAGS) \
240           -d html *.mli *.ml
241
242 .PHONY: depend dist check-manifest