diff --git a/src/build_system.ml b/src/build_system.ml index 7ac64409..5ad424d0 100644 --- a/src/build_system.ml +++ b/src/build_system.ml @@ -675,9 +675,9 @@ let no_rule_found = die "No rule found for %s" (Utils.describe_target fn) in fun t fn -> - match Path.extract_build_context fn with - | None -> fail fn - | Some (ctx, _) -> + match Utils.analyse_target fn with + | Other _ -> fail fn + | Regular (ctx, _) -> if String.Map.mem t.contexts ctx then fail fn else @@ -685,6 +685,15 @@ let no_rule_found = (Path.to_string_maybe_quoted fn) ctx (hint ctx (String.Map.keys t.contexts)) + | Alias (ctx, fn') -> + if String.Map.mem t.contexts ctx then + fail fn + else + let fn = Path.append (Path.relative Path.build_dir ctx) fn' in + die "Trying to build alias %s but build context %s doesn't exist.%s" + (Path.to_string_maybe_quoted fn) + ctx + (hint ctx (String.Map.keys t.contexts)) let rec compile_rule t ?(copy_source=false) pre_rule = let { Pre_rule.