2 # Copyright (C) 2019 Richard W.M. Jones
3 # Copyright (C) 2019 Red Hat Inc.
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.
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.
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.
21 let subdirs = [ "m4", "src", "stdlib", "docs", "man", "tests" ]
23 goal all = : "Goalfile", tool, documentation;
25 "Goalfile": "Goalfile.in", "config.status" {
28 "src/config.ml" : "src/config.ml.in", "config.status" {
36 rm -f *.cmi *.cmo *.cmx *.o
39 rm -f src/parser.ml src/parser.mli src/lexer.ml src/parser.conflicts
42 # We don't delete src/goals because it is required to do builds.
43 # If you want to really delete it, use the maintainer-clean rule.
46 goal maintainer-clean = : clean {
50 #----------------------------------------------------------------------
51 # Build the goals tool itself.
53 let MENHIR = "@MENHIR@"
54 let OCAMLDEP = "@OCAMLDEP@"
55 let OCAMLFIND = "@OCAMLFIND@"
56 let OCAMLLEX = "@OCAMLLEX@"
58 let OCAMLFLAGS = [ "-g", "-safe-string", "-warn-error", "CDEFLMPSUVYZX+52-3" ]
59 let OCAMLPACKAGES = [ "-package", "str,unix,threads", "-I", "src", "-thread" ]
60 #let OCAMLFLAGS = "@OCAMLFLAGS@"
61 #let OCAMLPACKAGES = "@OCAMLPACKAGES@"
64 # These must be in dependency order.
79 goal tool = : ocaml_link ("src/goals", objects) ;
82 "src/parser.mli", "src/parser.ml" : "src/parser.mly" {
84 # Hack required to break circular dependencies.
85 echo 'val lexer_read : (Lexing.lexbuf -> token) option ref' >> src/parser.mli
86 echo 'val eval_substitute : (Ast.env -> Ast.loc -> Ast.substs -> string) option ref' >> src/parser.mli
89 "src/lexer.ml" : "src/lexer.mll" {
93 # XXX Goalfile itself depends on this and we should probably have a
94 # way to reevaluate it.
97 "src/.depend" : wildcard ("src/*.ml"), wildcard ("src/*.mli") {
99 # Like many existing tools, ocamldep produces make-compatible
100 # output which doesn't work directly in goals.
101 %OCAMLDEP -all -one-line -I src %< |
102 sed 's|[./[:alnum:]]\+|"&"|g' |
104 sed 's|.*|& ;|' > %@-t
108 -include "src/.depend";
110 #----------------------------------------------------------------------
113 let POD2MAN = "@POD2MAN@"
115 goal documentation = : pod2man ("goals", "1"),
116 pod2man ("Goalfile", "5"),
117 pod2man ("goals-reference", "5")
119 goal pod2man (page, section) =
120 "man/%page.%section" : "docs/%page.pod" {
126 --release "@PACKAGE_NAME@-@PACKAGE_VERSION@" \
127 --section %section %< > %@-t
131 #----------------------------------------------------------------------
134 let tests = wrap ("test", wildcard ("tests/*.sh"))
136 goal check () = : tests
138 goal test (name) = : {