csvtool: "pastecol" with "preserving" semantics.
[csv/csv.git] / Makefile
1 PKGNAME     = $(shell oasis query name)
2 PKGVERSION  = $(shell oasis query version)
3 PKG_TARBALL = $(PKGNAME)-$(PKGVERSION).tar.gz
4 OCAMLFORGE_FILE_NO = 1148
5
6 DISTFILES   = LICENSE.txt AUTHORS.txt INSTALL.txt README.txt _oasis \
7   _tags src/META Makefile setup.ml myocamlbuild.ml API.odocl \
8   $(wildcard src/) $(wildcard examples/) $(wildcard tests/)
9
10 WEB = shell.forge.ocamlcore.org:/home/groups/csv/htdocs
11
12 .PHONY: all byte native configure doc test install uninstall reinstall \
13   upload-doc
14
15 all byte native: configure
16         ocaml setup.ml -build
17
18 configure: setup.ml
19         ocaml $< -configure
20
21 setup.ml: _oasis
22         oasis setup -setup-update dynamic
23
24 test doc install uninstall reinstall: all
25         ocaml setup.ml -$@
26
27 upload-doc: doc
28         scp -C -p -r _build/API.docdir $(WEB)
29
30 csvtool: all
31         ./csvtool.native pastecol 1,2,3 2,1,2 \
32           tests/testcsv9.csv tests/testcsv9.csv
33
34 csv.godiva: csv.godiva.in
35         @ sed -e "s/@PACKAGE@/$(PKGNAME)/" $< \
36         | sed -e "s/@VERSION@/$(PKGVERSION)/" \
37         | sed -e "s/@TARBALL@/$(PKG_TARBALL)/" \
38         | sed -e "s/@DOWNLOAD@/$(OCAMLFORGE_FILE_NO)/" > $@
39         @ echo "Updated \"$@\"."
40
41 # Assume the environment variable $GODI_LOCALBASE is set
42 .PHONY: godi tar dist web
43 godi: csv.godiva
44         godiva $<
45
46 # "Force" a tag to be defined for each released tarball
47 dist tar: setup.ml
48         @ if [ -z "$(PKGNAME)" ]; then echo "PKGNAME not defined"; exit 1; fi
49         @ if [ -z "$(PKGVERSION)" ]; then \
50                 echo "PKGVERSION not defined"; exit 1; fi
51         mkdir $(PKGNAME)-$(PKGVERSION)
52         cp -r $(DISTFILES) $(PKGNAME)-$(PKGVERSION)/
53 #       Generate a setup.ml independent of oasis
54         cd $(PKGNAME)-$(PKGVERSION) && oasis setup
55         tar -zcvf $(PKG_TARBALL) $(PKGNAME)-$(PKGVERSION)
56         $(RM) -rf $(PKGNAME)-$(PKGVERSION)
57
58 web: doc
59         $(MAKE) -C doc $@
60
61 .PHONY: clean distclean
62 clean::
63         ocaml setup.ml -clean
64         $(RM) $(PKG_TARBALL)
65
66 distclean:
67         ocaml setup.ml -distclean
68         $(RM) $(wildcard *.ba[0-9] *.bak *~ *.odocl)