From e019d14d15d5caa90892f4c21d8424dbc95067ae Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 27 Dec 2019 19:05:03 +0000 Subject: [PATCH] Hard code *file tactic. --- src/eval.ml | 13 ++++++++++++- tests/file1.c | 0 tests/test1.gl | 7 ++++--- 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 tests/file1.c diff --git a/src/eval.ml b/src/eval.ml index 260cbd9..c6cbda1 100644 --- a/src/eval.ml +++ b/src/eval.ml @@ -98,7 +98,18 @@ and run_goal env loc name args (params, patterns, deps, code) = (* Return whether the target (pattern) needs to be rebuilt. *) and needs_rebuild env loc name deps pattern = - false (* XXX *) + match pattern with + | Ast.PTactic (loc, tactic, targs) -> + (* Resolve the targs down to constants. *) + let targs = List.map (Ast.substitute env loc) targs in + (* XXX Look up the tactic. + * We would do that, but for now hard code the *file tactic. XXX + *) + assert (tactic = "file"); + assert (List.length targs = 1); + let targ = List.hd targs in + not (Sys.file_exists targ) + | Ast.PVar _ -> assert false (* XXX not implemented *) (* Find the goal which matches the given tactic and run it. * cargs is a list of parameters (all constants). diff --git a/tests/file1.c b/tests/file1.c new file mode 100644 index 0000000..e69de29 diff --git a/tests/test1.gl b/tests/test1.gl index afdcc34..ec4011f 100644 --- a/tests/test1.gl +++ b/tests/test1.gl @@ -2,7 +2,8 @@ goal all = : "file1.o", *file("file2.o") -"file1.o" : "file1.c" { - echo file1.c "->" file1.o - touch file1.o +goal compile (name) = +"%name.o" : "%name.c" { + echo %< "->" %@ + touch %@ } -- 1.8.3.1