diff options
Diffstat (limited to 'miscutils/make.c')
-rw-r--r-- | miscutils/make.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/miscutils/make.c b/miscutils/make.c index daad75f5c..86d06e970 100644 --- a/miscutils/make.c +++ b/miscutils/make.c | |||
@@ -717,21 +717,23 @@ dyndep(struct name *np, struct rule *imprule) | |||
717 | sp = findname(auto_concat(newsuff, suff)); | 717 | sp = findname(auto_concat(newsuff, suff)); |
718 | if (sp && sp->n_rule) { | 718 | if (sp && sp->n_rule) { |
719 | // Generate a name for an implicit prerequisite | 719 | // Generate a name for an implicit prerequisite |
720 | pp = newname(auto_concat(base, newsuff)); | 720 | struct name *ip = newname(auto_concat(base, newsuff)); |
721 | if (!pp->n_tim.tv_sec) | 721 | if ((ip->n_flag & N_DOING)) |
722 | modtime(pp); | 722 | continue; |
723 | if ((!chain && (pp->n_tim.tv_sec || getcmd(pp))) || | 723 | if (!ip->n_tim.tv_sec) |
724 | (chain && dyndep(pp, NULL))) { | 724 | modtime(ip); |
725 | if (chain ? ip->n_tim.tv_sec || (ip->n_flag & N_TARGET) : | ||
726 | dyndep(ip, NULL) != NULL) { | ||
725 | // Prerequisite exists or we know how to make it | 727 | // Prerequisite exists or we know how to make it |
726 | if (imprule) { | 728 | if (imprule) { |
727 | dp = NULL; | 729 | dp = NULL; |
728 | newdep(&dp, pp); | 730 | newdep(&dp, ip); |
729 | imprule->r_dep = dp; | 731 | imprule->r_dep = dp; |
730 | imprule->r_cmd = sp->n_rule->r_cmd; | 732 | imprule->r_cmd = sp->n_rule->r_cmd; |
731 | } | 733 | } |
734 | pp = ip; | ||
732 | goto finish; | 735 | goto finish; |
733 | } | 736 | } |
734 | pp = NULL; | ||
735 | } | 737 | } |
736 | } | 738 | } |
737 | } | 739 | } |
@@ -2121,6 +2123,7 @@ make(struct name *np, int level) | |||
2121 | } | 2123 | } |
2122 | for (dp = rp->r_dep; dp; dp = dp->d_next) { | 2124 | for (dp = rp->r_dep; dp; dp = dp->d_next) { |
2123 | // Make prerequisite | 2125 | // Make prerequisite |
2126 | dp->d_name->n_flag |= N_TARGET; | ||
2124 | estat |= make(dp->d_name, level + 1); | 2127 | estat |= make(dp->d_name, level + 1); |
2125 | 2128 | ||
2126 | // Make strings of out-of-date prerequisites (for $?), | 2129 | // Make strings of out-of-date prerequisites (for $?), |
@@ -2166,28 +2169,28 @@ make(struct name *np, int level) | |||
2166 | 2169 | ||
2167 | if (quest) { | 2170 | if (quest) { |
2168 | if (timespec_le(&np->n_tim, &dtim)) { | 2171 | if (timespec_le(&np->n_tim, &dtim)) { |
2169 | clock_gettime(CLOCK_REALTIME, &np->n_tim); | 2172 | didsomething = 1; |
2170 | return 1; // 1 means rebuild is needed | 2173 | estat = 1; // 1 means rebuild is needed |
2171 | } | 2174 | } |
2172 | } else if (!(np->n_flag & N_DOUBLE) && | 2175 | } else if (!(np->n_flag & N_DOUBLE) && |
2173 | ((np->n_flag & N_PHONY) || (timespec_le(&np->n_tim, &dtim)))) { | 2176 | ((np->n_flag & N_PHONY) || (timespec_le(&np->n_tim, &dtim)))) { |
2174 | if (estat == 0) { | 2177 | if (estat == 0) { |
2175 | if (!sc_cmd) { | 2178 | if (sc_cmd) |
2176 | if (!doinclude) | ||
2177 | bb_error_msg("nothing to be done for %s", np->n_name); | ||
2178 | } else { | ||
2179 | estat = make1(np, sc_cmd, oodate, allsrc, dedup, impdep); | 2179 | estat = make1(np, sc_cmd, oodate, allsrc, dedup, impdep); |
2180 | clock_gettime(CLOCK_REALTIME, &np->n_tim); | 2180 | else if (!doinclude) |
2181 | } | 2181 | bb_error_msg("nothing to be done for %s", np->n_name); |
2182 | didsomething = 1; | ||
2182 | } else if (!doinclude) { | 2183 | } else if (!doinclude) { |
2183 | bb_error_msg("'%s' not built due to errors", np->n_name); | 2184 | bb_error_msg("'%s' not built due to errors", np->n_name); |
2184 | } | 2185 | } |
2185 | free(oodate); | 2186 | free(oodate); |
2186 | } else if (didsomething) { | 2187 | } |
2188 | |||
2189 | if (didsomething) | ||
2187 | clock_gettime(CLOCK_REALTIME, &np->n_tim); | 2190 | clock_gettime(CLOCK_REALTIME, &np->n_tim); |
2188 | } else if (level == 0) { | 2191 | else if (!quest && level == 0) |
2189 | printf("%s: '%s' is up to date\n", applet_name, np->n_name); | 2192 | printf("%s: '%s' is up to date\n", applet_name, np->n_name); |
2190 | } | 2193 | |
2191 | free(allsrc); | 2194 | free(allsrc); |
2192 | free(dedup); | 2195 | free(dedup); |
2193 | return estat; | 2196 | return estat; |