1#
2# sample Makefile for Objective Caml
3# Copyright (C) 2001 Jean-Christophe FILLIATRE
4#
5# This library is free software; you can redistribute it and/or
6# modify it under the terms of the GNU Library General Public
7# License version 2, as published by the Free Software Foundation.
8#
9# This library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12#
13# See the GNU Library General Public License version 2 for more details
14# (enclosed in the file LGPL).
15
16# where to install the binaries
17prefix=@prefix@
18exec_prefix=@exec_prefix@
19BINDIR=@bindir@
20
21# where to install the man page
22MANDIR=@mandir@
23
24# other variables set by ./configure
25OCAMLC   = @OCAMLC@
26OCAMLOPT = @OCAMLOPT@
27OCAMLDEP = @OCAMLDEP@
28OCAMLLEX = @OCAMLLEX@
29OCAMLYACC= @OCAMLYACC@
30OCAMLLIB = @OCAMLLIB@
31OCAMLBEST= @OCAMLBEST@
32OCAMLVERSION = @OCAMLVERSION@
33OCAMLWEB = @OCAMLWEB@
34
35INCLUDES =
36BFLAGS = -g $(INCLUDES) camomile.cma
37OFLAGS = $(INCLUDES) camomile.cmxa
38
39# main target
40#############
41
42PROG = unescape
43
44all: $(OCAMLBEST)
45
46# bytecode and native-code compilation
47######################################
48
49CMO = unescape.cmo
50CMX = $(CMO:.cmo=.cmx)
51OBJ = get_enc.o
52
53GENERATED =
54
55byte: $(PROG).byte
56opt: $(PROG).opt
57
58$(PROG).byte: $(OBJ) $(CMO)
59	$(OCAMLC) $(BFLAGS) -o $@ $^
60
61$(PROG).opt: $(OBJ) $(CMX)
62	$(OCAMLOPT) $(OFLAGS) -o $@ $^
63
64# installation
65##############
66
67install:
68	mkdir -p $(BINDIR)
69	cp -f $(PROG).$(OCAMLBEST) $(BINDIR)/$(PROG)
70	mkdir -p $(MANDIR)/man1
71	cp -f $(PROG).1 $(MANDIR)/man1
72
73# generic rules
74###############
75
76.SUFFIXES: .mli .ml .cmi .cmo .cmx .mll .mly
77
78.mli.cmi:
79	$(OCAMLC) -c $(BFLAGS) $<
80
81.ml.cmo:
82	$(OCAMLC) -c $(BFLAGS) $<
83
84.ml.o:
85	$(OCAMLOPT) -c $(OFLAGS) $<
86
87.ml.cmx:
88	$(OCAMLOPT) -c $(OFLAGS) $<
89
90.mll.ml:
91	$(OCAMLLEX) $<
92
93.mly.ml:
94	$(OCAMLYACC) -v $<
95
96.mly.mli:
97	$(OCAMLYACC) -v $<
98.c.o:
99	$(OCAMLC) -c $<
100
101# Emacs tags
102############
103
104tags:
105	find . -name "*.ml*" | sort -r | xargs \
106	etags "--regex=/let[ \t]+\([^ \t]+\)/\1/" \
107	      "--regex=/let[ \t]+rec[ \t]+\([^ \t]+\)/\1/" \
108	      "--regex=/and[ \t]+\([^ \t]+\)/\1/" \
109	      "--regex=/type[ \t]+\([^ \t]+\)/\1/" \
110              "--regex=/exception[ \t]+\([^ \t]+\)/\1/" \
111	      "--regex=/val[ \t]+\([^ \t]+\)/\1/" \
112	      "--regex=/module[ \t]+\([^ \t]+\)/\1/"
113
114# myself
115
116Makefile: Makefile.in config.status
117	./config.status
118
119config.status: configure
120	./config.status --recheck
121
122configure: configure.in
123	autoconf
124
125# clean
126#######
127
128clean::
129	rm -f *.cm[iox] *.o *~
130	rm -f $(GENERATED) parser.output
131	rm -f $(PROG).byte $(PROG).opt
132	rm -f *.aux *.log $(PROG).tex $(PROG).dvi $(PROG).ps
133
134# depend
135########
136
137.depend depend:: $(GENERATED)
138	rm -f .depend
139	$(OCAMLDEP) $(INCLUDES) *.ml *.mli > .depend
140
141include .depend
142