%OCAMLLEX %<
}
-# XXX Depends on *.ml *.mli, but we don't have a function for this yet.
# XXX Goalfile itself depends on this and we should probably have a
# way to reevaluate it.
# XXX Atomic output.
-goal depend () = "src/.depend" : {
+goal depend () =
+"src/.depend" : wildcard ("src/*.ml"), wildcard ("src/*.mli") {
rm -f %@ %@-t
# Like many existing tools, ocamldep produces make-compatible
# output which doesn't work directly in goals.
- %OCAMLDEP -all -one-line src/*.ml src/*.mli |
+ %OCAMLDEP -all -one-line %< |
sed 's|[./[:alnum:]]\+|"&"|g' |
sed 's|" "|", "|g' |
sed 's|.*|& ;|' > %@-t
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# This file is included first and automatically in all Goalfiles
-# (unless you use --no-prelude). It contains standard goals and
+# (unless you use --no-prelude). It contains standard functions and
# tactics.
# The only tactic that ‘make’ has.
tactic *exists (filename) = {
test -f %filename || exit 99
}
+
+# Expand a wildcard into a list of filenames.
+function wildcard (wc) = {
+ shopt -s nullglob
+ # Note that the substitution is quoted by goals, so to expand
+ # it we must assign it to a variable and then use it unquoted.
+ wc=%wc
+ for f in $wc; do
+ echo "$f"
+ done
+}