diff options
Diffstat (limited to 'miscutils/make.c')
-rw-r--r-- | miscutils/make.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/miscutils/make.c b/miscutils/make.c index 333f8bf12..ceac1d91d 100644 --- a/miscutils/make.c +++ b/miscutils/make.c | |||
@@ -2838,11 +2838,13 @@ make(struct name *np, int level) | |||
2838 | } | 2838 | } |
2839 | } else { | 2839 | } else { |
2840 | // If any double-colon rule has no commands we need | 2840 | // If any double-colon rule has no commands we need |
2841 | // an inference rule (but, as an extension, not for phony targets) | 2841 | // an inference rule. |
2842 | for (rp = np->n_rule; rp; rp = rp->r_next) { | 2842 | for (rp = np->n_rule; rp; rp = rp->r_next) { |
2843 | if (!rp->r_cmd) { | 2843 | if (!rp->r_cmd) { |
2844 | if (posix || !(np->n_flag & N_PHONY)) | 2844 | // Phony targets don't need an inference rule. |
2845 | impdep = dyndep(np, &infrule, &tsuff); | 2845 | if (!posix && (np->n_flag & N_PHONY)) |
2846 | continue; | ||
2847 | impdep = dyndep(np, &infrule, &tsuff); | ||
2846 | if (!impdep) { | 2848 | if (!impdep) { |
2847 | if (doinclude) | 2849 | if (doinclude) |
2848 | return 1; | 2850 | return 1; |
@@ -2868,11 +2870,14 @@ make(struct name *np, int level) | |||
2868 | // Each double-colon rule is handled separately. | 2870 | // Each double-colon rule is handled separately. |
2869 | if ((np->n_flag & N_DOUBLE)) { | 2871 | if ((np->n_flag & N_DOUBLE)) { |
2870 | // If the rule has no commands use the inference rule. | 2872 | // If the rule has no commands use the inference rule. |
2873 | // Unless there isn't one, as allowed for phony targets. | ||
2871 | if (!rp->r_cmd) { | 2874 | if (!rp->r_cmd) { |
2872 | locdep = impdep; | 2875 | if (impdep) { |
2873 | infrule.r_dep->d_next = rp->r_dep; | 2876 | locdep = impdep; |
2874 | rp->r_dep = infrule.r_dep; | 2877 | infrule.r_dep->d_next = rp->r_dep; |
2875 | rp->r_cmd = infrule.r_cmd; | 2878 | rp->r_dep = infrule.r_dep; |
2879 | rp->r_cmd = infrule.r_cmd; | ||
2880 | } | ||
2876 | } | 2881 | } |
2877 | // A rule with no prerequisities is executed unconditionally. | 2882 | // A rule with no prerequisities is executed unconditionally. |
2878 | if (!rp->r_dep) | 2883 | if (!rp->r_dep) |