First published version.
[goaljobs.git] / examples / compile-c / Makefile.am
1 # goaljobs
2 # Copyright (C) 2013 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 include ../../common-rules.mk
19
20 EXTRA_DIST = main.c utils.c $(sources)
21
22 sources = compile.ml
23
24 noinst_SCRIPTS = compile
25
26 compile: ../../goaljobs.cmxa compile.cmx
27         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
28             $(OCAMLOPTPACKAGES) -linkpkg $^ -o $@
29
30 compile.cmx: compile.ml ../../pa_goal.cmo
31         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) \
32             -pp "$(CAMLP4O) ../../pa_goal.cmo" -c $< -o $@
33
34 # Dependencies.
35
36 depend: .depend
37
38 .depend: $(sources)
39         rm -f $@ $@-t
40         $(OCAMLFIND) ocamldep -I $(abs_srcdir) -I $(top_builddir) $^ | \
41           $(SED) 's/ *$$//' | \
42           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
43           $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
44           sort > $@-t
45         mv $@-t $@
46
47 -include .depend
48
49 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly