1PACKAGE	= ocaml-autoconf
2VERSION	= 1.0
3
4prefix  = /usr/local
5datadir = $(prefix)/share
6mandir  = $(datadir)/man
7
8INSTALL = install
9MKDIR_P = mkdir -p
10
11all: man ocaml.m4.txt
12
13man: ocaml.m4.1
14
15ocaml.m4.1: ocaml.m4.pod
16	pod2man -c "Autoconf macros" --release "$(PACKAGE)-$(VERSION)" $< > $@
17
18ocaml.m4.txt: ocaml.m4.pod
19	pod2text $< > $@
20
21clean:
22	rm -f *~ ocaml.m4.1 ocaml.m4.txt
23
24dist: ocaml.m4.1 ocaml.m4.txt
25	rm -rf $(PACKAGE)-$(VERSION)
26	mkdir $(PACKAGE)-$(VERSION)
27	install -m 0644 \
28	  LICENSE README \
29	  Makefile \
30	  ocaml.m4 \
31	  ocaml.m4.1 ocaml.m4.pod ocaml.m4.txt \
32	  $(PACKAGE)-$(VERSION)/
33	tar -cf - $(PACKAGE)-$(VERSION) | \
34	  gzip --best > $(PACKAGE)-$(VERSION).tar.gz
35	rm -rf $(PACKAGE)-$(VERSION)
36
37install: install-macro install-man
38
39install-macro:
40	$(MKDIR_P) $(DESTDIR)$(datadir)/aclocal/
41	$(INSTALL) -m 0644 ocaml.m4 $(DESTDIR)$(datadir)/aclocal/
42
43install-man:
44	$(MKDIR_P) $(DESTDIR)$(mandir)/man1/
45	$(INSTALL) -m 0644 ocaml.m4.1 $(DESTDIR)$(mandir)/man1/
46
47.PHONY: man install-macro install-man
48