(rule (write-file generated-file dynamic-contents))

(alias
  (name test-dep)
  (action (cat %{dep:generated-file})))

(alias
  (name test-path)
  (action
    (chdir
      sub-tree/dir
      (progn
        (echo "%{path:file-that-does-not-exist}\n")
        (echo "%{path:.}\n")))))
