+let subdirs = [ "m4", "src", "stdlib", "docs", "man", "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 = : wrap ("clean-subdir", subdirs), clean-subdir ("."), clean-other
+
+goal clean-subdir (dir) = {
+ cd %dir
+ rm -f *~
+ rm -f *.cmi *.cmo *.cmx *.o
+}
+
+goal clean-other = {
+ rm -f src/parser.ml src/parser.mli src/lexer.ml src/parser.conflicts
+ rm -f man/*.1 man/*.5
+ rm -f tests/*.log
+
+ # 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 CC = "@CC@"
+let OCAMLLIB = "@OCAMLLIB@"