build: Don't always pass -d to goals.
[goals.git] / Makefile.in
1 # Goals
2 # Copyright (C) 2019 Richard W.M. Jones
3 # Copyright (C) 2019 Red Hat Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
19 # Pass through normal targets to Goalfile.in
20
21 # XXX Why can't this parse "all" instead of "all ()"?
22 all clean install: src/goals
23         ./run src/goals "$@ ()"
24
25 # If src/goals doesn't exist then brute-force build it.  Once we have
26 # src/goals we can rebuild it and other parts of the project using
27 # goals itself (see Goalfile.in).
28
29 MENHIR = @MENHIR@
30 OCAMLFIND = @OCAMLFIND@
31 OCAMLLEX = @OCAMLLEX@
32 OCAMLFLAGS = @OCAMLFLAGS@
33 OCAMLPACKAGES = @OCAMLPACKAGES@
34
35 src/goals:
36         $(MENHIR) --explain src/parser.mly
37 # Hack required to get includes working.
38         echo 'val lexer_read : (Lexing.lexbuf -> token) option ref' \
39             >> src/parser.mli
40         $(OCAMLLEX) src/lexer.mll
41         $(OCAMLFIND) opt $(OCAMLFLAGS) $(OCAMLPACKAGES) -I src \
42             src/config.mli src/utils.mli src/cmdline.mli src/ast.mli \
43             src/eval.mli src/run.mli src/parser.mli src/lexer.mli \
44             src/parse.mli \
45             src/config.ml src/utils.ml src/cmdline.ml src/ast.ml \
46             src/eval.ml src/run.ml src/parser.ml src/lexer.ml \
47             src/parse.ml \
48             src/main.ml \
49             -linkpkg -o $@
50
51 # These rules are required by autoconf.
52 config.h: stamp-h
53 stamp-h: config.h.in config.status
54         ./config.status config.h
55         touch $@
56
57 Makefile: Makefile.in config.status
58         ./config.status $@
59
60 run: run.in config.status
61         ./config.status $@
62
63 $(srcdir)/configure: configure.ac aclocal.m4
64         cd '$(srcdir)' && autoconf
65
66 $(srcdir)/config.h.in: stamp-h.in
67 $(srcdir)/stamp-h.in: configure.ac aclocal.m4
68         cd '$(srcdir)' && autoheader
69         echo timestamp > '$(srcdir)/stamp-h.in'
70
71 config.status: configure
72         ./config.status --recheck