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