7ef5d9db429f99cf69e6c951e8d74234f458402b
[libguestfs.git] / generator / Makefile.am
1 # libguestfs
2 # Copyright (C) 2010 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., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 SOURCES = \
19         generator_types.ml \
20         generator_utils.mli \
21         generator_utils.ml \
22         generator_actions.mli \
23         generator_actions.ml \
24         generator_structs.mli \
25         generator_structs.ml \
26         generator_optgroups.ml \
27         generator_prepopts.mli \
28         generator_prepopts.ml \
29         generator_pr.mli \
30         generator_pr.ml \
31         generator_docstrings.ml \
32         generator_checks.ml \
33         generator_c.ml \
34         generator_xdr.ml \
35         generator_daemon.ml \
36         generator_capitests.ml \
37         generator_fish.ml \
38         generator_ocaml.ml \
39         generator_perl.ml \
40         generator_python.ml \
41         generator_ruby.ml \
42         generator_java.ml \
43         generator_haskell.ml \
44         generator_csharp.ml \
45         generator_php.ml \
46         generator_bindtests.ml \
47         generator_main.ml
48
49 SOURCES_ML = $(filter %.ml,$(SOURCES))
50 OBJECTS = $(SOURCES_ML:.ml=.cmo)
51
52 EXTRA_DIST = $(SOURCES)
53
54 OCAMLCFLAGS = -I +xml-light -I +../pkg-lib/xml-light
55 OCAMLCLIBS = xml-light.cma unix.cma str.cma
56
57 noinst_PROGRAM = generator
58
59 generator: $(OBJECTS) ../images/test.iso
60         $(OCAMLC) -o generator $(OCAMLCFLAGS) $(OCAMLCLIBS) $(OBJECTS)
61
62 .ml.cmo:
63         $(OCAMLC) $(OCAMLCFLAGS) -c $< -o $@
64
65 .mli.cmi:
66         $(OCAMLC) $(OCAMLCFLAGS) -c $< -o $@
67
68 depend: .depend
69
70 .depend: $(SOURCES)
71         rm -f $@ $@-t
72         $(OCAMLDEP) $^ | sed 's/  *$$//' > $@-t
73         mv $@-t $@
74
75 include .depend
76
77 noinst_DATA = stamp-generator
78
79 # Run the generator.
80 # Git removes empty directories, so in cases where the
81 # generator is creating the sole file in a directory, we
82 # have to create the directory first.
83 stamp-generator: generator
84         mkdir -p $(top_srcdir)/perl/lib/Sys
85         mkdir -p $(top_srcdir)/ruby/ext/guestfs
86         mkdir -p $(top_srcdir)/java/com/redhat/et/libguestfs
87         mkdir -p $(top_srcdir)/csharp
88         cd $(top_srcdir) && generator/generator
89
90 ../images/test.iso:
91         make -C ../images test.iso
92
93 CLEANFILES = $(noinst_DATA) $(noinst_PROGRAM) *.cmi *.cmo *~
94
95 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly