*.cmxa
*.o
+/docs/*.1
+
.depend
Goalfile
Makefile
include "ocaml.gl"
+let subdirs = [ "m4", "src", "stdlib", "docs", "tests" ]
+
+goal all = : "Goalfile", tool, documentation;
+
+"Goalfile": "Goalfile.in", "config.status" {
+ ./config.status %@
+}
+"src/config.ml" : "src/config.ml.in", "config.status" {
+ ./config.status %@
+}
+
+goal clean = {
+ for d in %subdirs; do
+ pushd $d
+ rm -f *~
+ rm -f *.cmi *.cmo *.cmx *.o
+ popd
+ done
+ rm -f src/parser.ml src/parser.mli src/lexer.ml src/parser.conflicts
+ rm -f docs/*.1
+
+ # We don't delete src/goals because it is required to do builds.
+ # If you want to really delete it, use the maintainer-clean rule.
+}
+
+goal maintainer-clean = : clean {
+ rm -f src/goals
+}
+
+#----------------------------------------------------------------------
+# Build the goals tool itself.
+
let MENHIR = "@MENHIR@"
let OCAMLDEP = "@OCAMLDEP@"
let OCAMLFIND = "@OCAMLFIND@"
#let OCAMLPACKAGES = "@OCAMLPACKAGES@"
let objects = [
+ # These must be in dependency order.
"src/config.cmx",
"src/utils.cmx",
"src/cmdline.cmx",
"src/main.cmx"
]
-let subdirs = [ "m4", "src", "stdlib", "tests" ]
-
-goal all = : "Goalfile", ocaml_link ("src/goals", objects)
-
-goal clean = {
- for d in %subdirs; do
- pushd $d
- rm -f *~
- rm -f *.cmi *.cmo *.cmx *.o
- popd
- done
- rm -f src/parser.ml src/parser.mli src/lexer.ml src/parser.conflicts
-
- # We don't delete src/goals because it is required to do builds.
- # If you want to really delete it, use the maintainer-clean rule.
-}
-
-goal maintainer-clean = : clean {
- rm -f src/goals
-}
+goal tool = : ocaml_link ("src/goals", objects) ;
+# Parser.
"src/parser.mli", "src/parser.ml" : "src/parser.mly" {
%MENHIR --explain %<
# Hack required to break circular dependencies.
# XXX Goalfile itself depends on this and we should probably have a
# way to reevaluate it.
# XXX Atomic output.
-goal depend () =
+goal depend =
"src/.depend" : wildcard ("src/*.ml"), wildcard ("src/*.mli") {
rm -f %@ %@-t
# Like many existing tools, ocamldep produces make-compatible
-include "src/.depend";
-"Goalfile": "Goalfile.in", "config.status" {
- ./config.status %@
-}
-"src/config.ml" : "src/config.ml.in", "config.status" {
- ./config.status %@
-}
+#----------------------------------------------------------------------
+# Documentation.
+
+let POD2MAN = "@POD2MAN@"
+
+goal documentation = : pod2man ("goals")
+
+goal pod2man (page) =
+"docs/%page.1" : "docs/%page.pod" {
+ rm -f %@ %@-t
+ %POD2MAN \
+ -c "goals" \
+ --release "@PACKAGE_NAME@-@PACKAGE_VERSION@" \
+ --section 1 %< > %@-t
+ mv %@-t %@
+}
\ No newline at end of file
let foo = { echo "hello" }
and/or anonymous functions:
let foo = function (arg) { ... }
+
+Infinite loop when you have this goal:
+goal pod2man (page, section) = "docs/%page.%section" : "docs/%page.pod" { ... }
+This is caused by %section matching "pod" so the rule is called
+again, even if the local file docs/%page.pod actually exists.
AC_MSG_ERROR([OCaml menhir parser generator is required])
])
+AC_CHECK_PROG([POD2MAN], [pod2man], [pod2man], [
+ AC_MSG_ERROR([pod2man tool from Perl is required])
+])
+
dnl Substitute OCaml flags and packages.
AC_SUBST([OCAMLFLAGS], ["-g -safe-string -warn-error CDEFLMPSUVYZX+52-3"])
AC_SUBST([OCAMLPACKAGES], ["-package str,unix"])
--- /dev/null
+=encoding utf8
+
+=head1 NAME
+
+goals - an experimental tool that generalizes "make"
+
+=head1 SUMMARY
+
+ goals ['TARGET'] ['VAR=VALUE']
+ [-C|--directory DIRECTORY] [-d] [-f|--file Goalfile]
+ [-I|--include DIRECTORY] [--no-prelude]
+
+ goals --help
+
+ goals -v|--version
+
+=head1 DESCRIPTION
+
+
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-h>
+
+=item B<--help>
+
+Display short help summary and exit.
+
+=item B<-C> DIRECTORY
+
+=item B<--directory> DIRECTORY
+
+When goals starts up, and before reading the initial F<Goalfile> or
+doing any other processing, goals changes directory.
+
+=item B<-d>
+
+Enable very verbose debugging.
+
+=item B<-f> GOALFILE
+
+=item B<--file> GOALFILE
+
+Set the name of the initial goal file to read. The default name is
+F<Goalfile>.
+
+Note that if a relative path is given here, it is relative to the
+directory specified with the I<-C> option, or to the current directory
+if I<-C> was not used.
+
+=item B<-I> DIRECTORY
+
+=item B<--include> DIRECTORY
+
+Specify an include directory, used when including goal files using the
+C<include> directive. You can use this option multiple times. Later
+directories have priority over earlier ones. There is also an
+implicit C<%stdlib> directory which is used for prelude files (see
+L<goals-reference(5)>).
+
+Note that if a relative path is given here, it is relative to the
+directory specified with the I<-C> option, or to the current directory
+if I<-C> was not used.
+
+=item B<--no-prelude>
+
+Do not load F<prelude.gl> from C<%stdlib>. The default is that the
+prelude is always loaded automatically before any initial goal file
+(but you can redefine prelude definitions in your goal file if you
+want).
+
+=back
+
+=head1 SEE ALSO
+
+L<Goalfile(5)>, L<goals-reference(5)>, L<make(1)>.
+
+=head1 AUTHORS
+
+Richard W.M. Jones <rjones@redhat.com>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2020 Richard W.M. Jones
+
+Copyright (C) 2020 Red Hat Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.