diff --git a/docs/glob_plus_pg.md b/docs/glob_plus_pg.md new file mode 100644 index 0000000..9168594 --- /dev/null +++ b/docs/glob_plus_pg.md @@ -0,0 +1,24 @@ + +```shell +@goal gpg @glob 'glob_test/*.txt' @params P + echo "$ITEM $P" + +@goal g1 +@depends_on gpg @args 'hello' +``` + +-> + +```shell +@goal gpg @params P +@depends_on 'gpg@glob_test/1.txt' @args P +@depends_on 'gpg@glob_test/2.txt' @args P + +@goal 'gpg@glob_test/1.txt' @params P + echo "$ITEM $P" +@goal 'gpg@glob_test/2.txt' @params P + echo "$ITEM $P" + +@goal g1 +@depends_on gpg @args 'hello' +``` diff --git a/makesure.awk b/makesure.awk index 954b693..fbe221e 100755 --- a/makesure.awk +++ b/makesure.awk @@ -300,10 +300,9 @@ function handleDependsOn( i) { registerDependsOn(globGoal(i)) } -function registerDependsOn(goalName, i,dep,x,y) { +function registerDependsOn(goalName, i,dep) { for (i = 2; i <= NF; i++) { - dep = $i - if ("@args" == dep) { + if ("@args" == (dep = $i)) { if (i != 3) addError("@args only allowed at position 3") DependencyArgsNR[goalName, DependenciesCnt[goalName] - 1] = NR diff --git a/tests/29_glob_plus_pg.tush b/tests/29_glob_plus_pg.tush index a29dd11..e2d161c 100644 --- a/tests/29_glob_plus_pg.tush +++ b/tests/29_glob_plus_pg.tush @@ -1,8 +1,16 @@ -$ ./$MAKESURE -f tests/29_glob_plus_pg.sh -l +$ ./$MAKESURE -f tests/29_glob_plus_pg_1.sh -l -$ ./$MAKESURE -f tests/29_glob_plus_pg.sh g1 +$ ./$MAKESURE -f tests/29_glob_plus_pg_1.sh g1 -$ ./$MAKESURE -f tests/29_glob_plus_pg.sh g2 +$ ./$MAKESURE -f tests/29_glob_plus_pg_1.sh g2 -$ ./$MAKESURE -f tests/29_glob_plus_pg.sh g3 +$ ./$MAKESURE -f tests/29_glob_plus_pg_1.sh g3 + +$ ./$MAKESURE -f tests/29_glob_plus_pg_2.sh -l + +$ ./$MAKESURE -f tests/29_glob_plus_pg_2.sh g1 + +$ ./$MAKESURE -f tests/29_glob_plus_pg_2.sh g2 + +$ ./$MAKESURE -f tests/29_glob_plus_pg_2.sh g3 diff --git a/tests/29_glob_plus_pg.sh b/tests/29_glob_plus_pg_1.sh similarity index 100% rename from tests/29_glob_plus_pg.sh rename to tests/29_glob_plus_pg_1.sh diff --git a/tests/29_glob_plus_pg_2.sh b/tests/29_glob_plus_pg_2.sh new file mode 100644 index 0000000..9cc97fb --- /dev/null +++ b/tests/29_glob_plus_pg_2.sh @@ -0,0 +1,16 @@ + +@goal @glob 'glob_test/*.txt' @params P + echo "$ITEM $P" + +@goal g1 +@depends_on 'glob_test/*.txt' @args 'hello' + +@goal g2 +@depends_on 'glob_test/*.txt' @args 'hello' +@depends_on 'glob_test/*.txt' @args 'hi' + +@goal g3 +@depends_on g3pg @args 'salut' + +@goal g3pg @params X +@depends_on 'glob_test/*.txt' @args X