diff options
author | fjoe <fjoe@FreeBSD.org> | 2007-03-08 09:16:11 +0000 |
---|---|---|
committer | fjoe <fjoe@FreeBSD.org> | 2007-03-08 09:16:11 +0000 |
commit | 19d858e266534f79d31f05bb4f1b0810dae9b0e4 (patch) | |
tree | 4df26b7f4601246e5adacdf07dd59f9d468d6c03 /usr.bin/make/job.c | |
parent | f6d48b2630c435828501c18fc4f28e9a6df9adfd (diff) | |
download | FreeBSD-src-19d858e266534f79d31f05bb4f1b0810dae9b0e4.zip FreeBSD-src-19d858e266534f79d31f05bb4f1b0810dae9b0e4.tar.gz |
Implement "Remaking Makefiles" feature:
After reading Makefile and all the files that are included using .include
or .sinclude directives (source Makefiles) make considers each source
Makefile as a target and tries to rebuild it. Both explicit and implicit
rules are checked and all source Makefiles are updated if necessary. If
any of the source Makefiles were rebuilt, make restarts from clean state.
To prevent infinite loops the following source Makefile targets are
ignored:
- :: targets that have no prerequisites but have commands
- ! targets
- targets that have .PHONY or .EXEC attributes
- targets without prerequisites and without commands
When remaking a source Makefile options -t (touch target), -q (query
mode), and -n (no exec) do not take effect, unless source Makefile is
specified explicitly as a target in make command line.
Additionally, system makefiles and .depend are not considered as a
Makefiles that can be rebuilt.
Reviewed by: harti
Diffstat (limited to 'usr.bin/make/job.c')
-rw-r--r-- | usr.bin/make/job.c | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 7bb31cd..6136c6f 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -3070,7 +3070,7 @@ Compat_RunCommand(char *cmd, GNode *gn) /*- *----------------------------------------------------------------------- - * CompatMake -- + * Compat_Make -- * Make a target, given the parent, to abort if necessary. * * Side Effects: @@ -3078,8 +3078,8 @@ Compat_RunCommand(char *cmd, GNode *gn) * *----------------------------------------------------------------------- */ -static int -CompatMake(GNode *gn, GNode *pgn) +int +Compat_Make(GNode *gn, GNode *pgn) { LstNode *ln; @@ -3099,7 +3099,7 @@ CompatMake(GNode *gn, GNode *pgn) gn->made = BEINGMADE; Suff_FindDeps(gn); LST_FOREACH(ln, &gn->children) - CompatMake(Lst_Datum(ln), gn); + Compat_Make(Lst_Datum(ln), gn); if (!gn->make) { gn->made = ABORTED; pgn->make = FALSE; @@ -3289,6 +3289,27 @@ CompatMake(GNode *gn, GNode *pgn) } /*- + * Install signal handlers for Compat_Run + */ +void +Compat_InstallSignalHandlers(void) +{ + + if (signal(SIGINT, SIG_IGN) != SIG_IGN) { + signal(SIGINT, CompatCatchSig); + } + if (signal(SIGTERM, SIG_IGN) != SIG_IGN) { + signal(SIGTERM, CompatCatchSig); + } + if (signal(SIGHUP, SIG_IGN) != SIG_IGN) { + signal(SIGHUP, CompatCatchSig); + } + if (signal(SIGQUIT, SIG_IGN) != SIG_IGN) { + signal(SIGQUIT, CompatCatchSig); + } +} + +/*- *----------------------------------------------------------------------- * Compat_Run -- * Start making again, given a list of target nodes. @@ -3308,19 +3329,7 @@ Compat_Run(Lst *targs) int error_cnt; /* Number of targets not remade due to errors */ LstNode *ln; - if (signal(SIGINT, SIG_IGN) != SIG_IGN) { - signal(SIGINT, CompatCatchSig); - } - if (signal(SIGTERM, SIG_IGN) != SIG_IGN) { - signal(SIGTERM, CompatCatchSig); - } - if (signal(SIGHUP, SIG_IGN) != SIG_IGN) { - signal(SIGHUP, CompatCatchSig); - } - if (signal(SIGQUIT, SIG_IGN) != SIG_IGN) { - signal(SIGQUIT, CompatCatchSig); - } - + Compat_InstallSignalHandlers(); ENDNode = Targ_FindNode(".END", TARG_CREATE); /* * If the user has defined a .BEGIN target, execute the commands @@ -3341,8 +3350,8 @@ Compat_Run(Lst *targs) } /* - * For each entry in the list of targets to create, call CompatMake on - * it to create the thing. CompatMake will leave the 'made' field of gn + * For each entry in the list of targets to create, call Compat_Make on + * it to create the thing. Compat_Make will leave the 'made' field of gn * in one of several states: * UPTODATE gn was already up-to-date * MADE gn was recreated successfully @@ -3353,7 +3362,7 @@ Compat_Run(Lst *targs) error_cnt = 0; while (!Lst_IsEmpty(targs)) { gn = Lst_DeQueue(targs); - CompatMake(gn, gn); + Compat_Make(gn, gn); if (gn->made == UPTODATE) { printf("`%s' is up to date.\n", gn->name); |