Added option parsing.
[xavierbot.git] / Makefile
1 # $Id: Makefile,v 1.4 2007/06/29 21:43:21 rjones Exp $
2
3 include Makefile.config
4
5 CC      := gcc
6 CFLAGS  := -Wall -Werror
7
8 all: pa_noexternal.cmo init ocamlbotwrapper xavierbot.pl
9
10 ocamlbotwrapper: ocamlbotwrapper.o
11         $(CC) $(CFLAGS) $< -o $@
12
13 ocamlbotwrapper.c: ocamlbotwrapper.c.in Makefile.config
14         sed \
15           -e 's|@OCAML@|$(OCAML)|' \
16           -e 's|@INITSCRIPT@|$(INITSCRIPT)|' \
17           -e 's|@CHROOTDIR@|$(CHROOTDIR)|' \
18           < $< > $@
19
20 init: init.in Makefile.config
21         sed \
22           -e 's|@OCAMLUSER@|$(OCAMLUSER)|' \
23           -e 's|@CHROOTDIR@|$(CHROOTDIR)|' \
24           < $< > $@
25
26 xavierbot.pl: xavierbot.pl.in Makefile.config
27         sed \
28           -e 's|@WRAPPER@|$(WRAPPER)|' \
29           -e 's|@VERSION@|$(VERSION)|' \
30           < $< > $@
31         chmod 0755 $@
32
33 pa_noexternal.cmo: pa_noexternal.ml
34         ocamlfind ocamlc \
35           -pp "camlp4o pa_extend.cmo q_MLast.cmo" -I +camlp4 -c $<
36
37 test check:
38         perl -Tc xavierbot.pl
39
40 clean:
41         rm -f ocamlbotwrapper *.o *.cmo *.cmi *~
42
43 # Use this if you want to run without installing (see also
44 # instructions in Makefile.config):
45
46 permissions:
47         chown root.root ocamlbotwrapper
48         chmod ug+s ocamlbotwrapper
49
50 # Distribution.
51
52 dist:
53         $(MAKE) check-manifest
54         rm -rf $(PACKAGE)-$(VERSION)
55         mkdir $(PACKAGE)-$(VERSION)
56         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
57         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
58         rm -rf $(PACKAGE)-$(VERSION)
59         ls -l $(PACKAGE)-$(VERSION).tar.gz
60
61 check-manifest:
62         @for d in `find -type d -name CVS | grep -v '^\./debian/'`; \
63         do \
64         b=`dirname $$d`/; \
65         awk -F/ '$$1 != "D" {print $$2}' $$d/Entries | \
66         sed -e "s|^|$$b|" -e "s|^\./||"; \
67         done | sort > .check-manifest; \
68         sort MANIFEST > .orig-manifest; \
69         diff -u .orig-manifest .check-manifest; rv=$$?; \
70         rm -f .orig-manifest .check-manifest; \
71         exit $$rv
72
73
74 .PHONY: depend dist check-manifest dpkg doc print_test
75
76 .SUFFIXES:      .cmo .cmi .cmx .ml .mli