Begin generating C implementation code.
[wrappi.git] / generator / 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         -I ../generator-lib $(OCAMLPACKAGES)
23 OCAMLOPTFLAGS = $(OCAMLCFLAGS)
24
25 # In alphabetical order.
26 SOURCES = \
27         wrappi_boilerplate.mli \
28         wrappi_boilerplate.ml \
29         wrappi_c_impl.mli \
30         wrappi_c_impl.ml \
31         wrappi_c.mli \
32         wrappi_c.ml \
33         wrappi_main.ml \
34         wrappi_pr.mli \
35         wrappi_pr.ml
36
37 # In dependency order.
38 OBJECTS = \
39         wrappi_pr.cmo \
40         wrappi_boilerplate.cmo \
41         wrappi_c_impl.cmo \
42         wrappi_c.cmo \
43         wrappi_main.cmo
44
45 noinst_SCRIPTS = generator
46
47 generator: $(OBJECTS) ../generator-lib/generator_lib.cma ../APIs/apis.cma
48         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -linkpkg \
49           ../generator-lib/generator_lib.cma ../APIs/apis.cma \
50           $(OBJECTS) \
51           -o $@
52
53 %.cmi: %.mli ../generator-lib/generator_lib.cma
54         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
55 %.cmo: %.ml
56         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
57 %.cmx: %.ml
58         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
59
60 # Run the generator.
61 noinst_DATA = stamp-generator
62
63 stamp-generator: generator
64         cd $(top_srcdir) && generator/generator
65
66 depend: .depend
67
68 .depend: $(SOURCES)
69         rm -f $@ $@-t
70         $(OCAMLFIND) ocamldep $^ | \
71           $(SED) -e 's/ *$$//' | \
72           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
73           LANG=C sort > $@-t
74         mv $@-t $@
75
76 include .depend
77
78 CLEANFILES = *.cmi *.cmo *.cmx *~ generator
79
80 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly