diff --git a/auxbin/jpm b/auxbin/jpm index 80578d5c..19f7d9e9 100755 --- a/auxbin/jpm +++ b/auxbin/jpm @@ -34,7 +34,7 @@ (defmacro rule "Add a rule to the rule graph." [target deps & body] - ~(,rule-impl ,target ,deps (fn [] nil ,;body))) + ~(,rule-impl ,target ,deps (fn [] ,;body))) (defmacro phony "Add a phony rule to the rule graph. A phony rule will run every time @@ -43,6 +43,16 @@ [target deps & body] ~(,rule-impl ,target ,deps (fn [] nil ,;body) true)) +(defmacro sh-rule + "Add a rule that invokes a shell command, and fails if the command returns non-zero." + [target deps & body] + ~(,rule-impl ,target ,deps (fn [] (,assert (,zero? (,os/shell (,string ,;body))))))) + +(defmacro sh-phony + "Add a phony rule that invokes a shell command, and fails if the command returns non-zero." + [target deps & body] + ~(,rule-impl ,target ,deps (fn [] (,assert (,zero? (,os/shell (,string ,;body))))) true)) + (defn add-dep "Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules."