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