Start generating C code.
[wrappi.git] / generator-lib / Makefile.am
1 # wrappi
2 # Copyright (C) 2011 Red Hat Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program 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.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 OCAMLPACKAGES = -package unix,camlp4.lib
19
20 OCAMLCFLAGS = \
21         -g -warn-error CDEFLMPSUVYZX \
22         $(OCAMLPACKAGES)
23 OCAMLOPTFLAGS = $(OCAMLCFLAGS)
24
25 # In alphabetical order.
26 SOURCES = \
27         config.ml \
28         wrappi_globals.mli \
29         wrappi_globals.ml \
30         wrappi_types.mli \
31         wrappi_types.ml \
32         wrappi_utils.mli \
33         wrappi_utils.ml
34
35 # In dependency order.
36 OBJECTS = \
37         config.cmo \
38         wrappi_utils.cmo \
39         wrappi_types.cmo \
40         wrappi_globals.cmo
41
42 noinst_SCRIPTS = generator_lib.cma
43
44 generator_lib.cma: $(OBJECTS)
45         $(OCAMLFIND) ocamlc -a $^ -o generator_lib.cma
46
47 %.cmi: %.mli
48         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
49 %.cmo: %.ml
50         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
51 %.cmx: %.ml
52         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
53
54 CLEANFILES = *.cmi *.cmo *.cmx *.cma *.cmxa *~
55
56 depend: .depend
57
58 .depend: $(SOURCES)
59         rm -f $@ $@-t
60         $(OCAMLFIND) ocamldep $^ | \
61           $(SED) -e 's/ *$$//' | \
62           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
63           LANG=C sort > $@-t
64         mv $@-t $@
65
66 include .depend
67
68 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly