compat.c revision 1.108 1 /* $NetBSD: compat.c,v 1.108 2019/12/18 07:37:19 maxv Exp $ */
2
3 /*
4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
35 /*
36 * Copyright (c) 1988, 1989 by Adam de Boor
37 * Copyright (c) 1989 by Berkeley Softworks
38 * All rights reserved.
39 *
40 * This code is derived from software contributed to Berkeley by
41 * Adam de Boor.
42 *
43 * Redistribution and use in source and binary forms, with or without
44 * modification, are permitted provided that the following conditions
45 * are met:
46 * 1. Redistributions of source code must retain the above copyright
47 * notice, this list of conditions and the following disclaimer.
48 * 2. Redistributions in binary form must reproduce the above copyright
49 * notice, this list of conditions and the following disclaimer in the
50 * documentation and/or other materials provided with the distribution.
51 * 3. All advertising materials mentioning features or use of this software
52 * must display the following acknowledgement:
53 * This product includes software developed by the University of
54 * California, Berkeley and its contributors.
55 * 4. Neither the name of the University nor the names of its contributors
56 * may be used to endorse or promote products derived from this software
57 * without specific prior written permission.
58 *
59 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
60 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
62 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
63 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
64 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69 * SUCH DAMAGE.
70 */
71
72 #ifndef MAKE_NATIVE
73 static char rcsid[] = "$NetBSD: compat.c,v 1.108 2019/12/18 07:37:19 maxv Exp $";
74 #else
75 #include <sys/cdefs.h>
76 #ifndef lint
77 #if 0
78 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
79 #else
80 __RCSID("$NetBSD: compat.c,v 1.108 2019/12/18 07:37:19 maxv Exp $");
81 #endif
82 #endif /* not lint */
83 #endif
84
85 /*-
86 * compat.c --
87 * The routines in this file implement the full-compatibility
88 * mode of PMake. Most of the special functionality of PMake
89 * is available in this mode. Things not supported:
90 * - different shells.
91 * - friendly variable substitution.
92 *
93 * Interface:
94 * Compat_Run Initialize things for this module and recreate
95 * thems as need creatin'
96 */
97
98 #include <sys/types.h>
99 #include <sys/stat.h>
100 #include <sys/wait.h>
101
102 #include <ctype.h>
103 #include <errno.h>
104 #include <signal.h>
105 #include <stdio.h>
106
107 #include "make.h"
108 #include "hash.h"
109 #include "dir.h"
110 #include "job.h"
111 #include "metachar.h"
112 #include "pathnames.h"
113
114
115 static GNode *curTarg = NULL;
116 static GNode *ENDNode;
117 static void CompatInterrupt(int);
118 static pid_t compatChild;
119 static int compatSigno;
120
121 /*
122 * CompatDeleteTarget -- delete a failed, interrupted, or otherwise
123 * duffed target if not inhibited by .PRECIOUS.
124 */
125 static void
126 CompatDeleteTarget(GNode *gn)
127 {
128 if ((gn != NULL) && !Targ_Precious (gn)) {
129 char *p1;
130 char *file = Var_Value(TARGET, gn, &p1);
131
132 if (!noExecute && eunlink(file) != -1) {
133 Error("*** %s removed", file);
134 }
135
136 free(p1);
137 }
138 }
139
140 /*-
141 *-----------------------------------------------------------------------
142 * CompatInterrupt --
143 * Interrupt the creation of the current target and remove it if
144 * it ain't precious.
145 *
146 * Results:
147 * None.
148 *
149 * Side Effects:
150 * The target is removed and the process exits. If .INTERRUPT exists,
151 * its commands are run first WITH INTERRUPTS IGNORED..
152 *
153 * XXX: is .PRECIOUS supposed to inhibit .INTERRUPT? I doubt it, but I've
154 * left the logic alone for now. - dholland 20160826
155 *
156 *-----------------------------------------------------------------------
157 */
158 static void
159 CompatInterrupt(int signo)
160 {
161 GNode *gn;
162
163 CompatDeleteTarget(curTarg);
164
165 if ((curTarg != NULL) && !Targ_Precious (curTarg)) {
166 /*
167 * Run .INTERRUPT only if hit with interrupt signal
168 */
169 if (signo == SIGINT) {
170 gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE);
171 if (gn != NULL) {
172 Compat_Make(gn, gn);
173 }
174 }
175 }
176 if (signo == SIGQUIT)
177 _exit(signo);
178 /*
179 * If there is a child running, pass the signal on
180 * we will exist after it has exited.
181 */
182 compatSigno = signo;
183 if (compatChild > 0) {
184 KILLPG(compatChild, signo);
185 } else {
186 bmake_signal(signo, SIG_DFL);
187 kill(myPid, signo);
188 }
189 }
190
191 /*-
193 *-----------------------------------------------------------------------
194 * CompatRunCommand --
195 * Execute the next command for a target. If the command returns an
196 * error, the node's made field is set to ERROR and creation stops.
197 *
198 * Input:
199 * cmdp Command to execute
200 * gnp Node from which the command came
201 *
202 * Results:
203 * 0 if the command succeeded, 1 if an error occurred.
204 *
205 * Side Effects:
206 * The node's 'made' field may be set to ERROR.
207 *
208 *-----------------------------------------------------------------------
209 */
210 int
211 CompatRunCommand(void *cmdp, void *gnp)
212 {
213 char *cmdStart; /* Start of expanded command */
214 char *cp, *bp;
215 Boolean silent, /* Don't print command */
216 doIt; /* Execute even if -n */
217 volatile Boolean errCheck; /* Check errors */
218 int reason; /* Reason for child's death */
219 int status; /* Description of child's death */
220 pid_t cpid; /* Child actually found */
221 pid_t retstat; /* Result of wait */
222 LstNode cmdNode; /* Node where current command is located */
223 const char ** volatile av; /* Argument vector for thing to exec */
224 char ** volatile mav;/* Copy of the argument vector for freeing */
225 int argc; /* Number of arguments in av or 0 if not
226 * dynamically allocated */
227 Boolean local; /* TRUE if command should be executed
228 * locally */
229 Boolean useShell; /* TRUE if command should be executed
230 * using a shell */
231 char * volatile cmd = (char *)cmdp;
232 GNode *gn = (GNode *)gnp;
233
234 silent = gn->type & OP_SILENT;
235 errCheck = !(gn->type & OP_IGNORE);
236 doIt = FALSE;
237
238 cmdNode = Lst_Member(gn->commands, cmd);
239 cmdStart = Var_Subst(NULL, cmd, gn, VARF_WANTRES);
240
241 /*
242 * brk_string will return an argv with a NULL in av[0], thus causing
243 * execvp to choke and die horribly. Besides, how can we execute a null
244 * command? In any case, we warn the user that the command expanded to
245 * nothing (is this the right thing to do?).
246 */
247
248 if (*cmdStart == '\0') {
249 free(cmdStart);
250 return(0);
251 }
252 cmd = cmdStart;
253 Lst_Replace(cmdNode, cmdStart);
254
255 if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) {
256 (void)Lst_AtEnd(ENDNode->commands, cmdStart);
257 return(0);
258 }
259 if (strcmp(cmdStart, "...") == 0) {
260 gn->type |= OP_SAVE_CMDS;
261 return(0);
262 }
263
264 while ((*cmd == '@') || (*cmd == '-') || (*cmd == '+')) {
265 switch (*cmd) {
266 case '@':
267 silent = DEBUG(LOUD) ? FALSE : TRUE;
268 break;
269 case '-':
270 errCheck = FALSE;
271 break;
272 case '+':
273 doIt = TRUE;
274 if (!shellName) /* we came here from jobs */
275 Shell_Init();
276 break;
277 }
278 cmd++;
279 }
280
281 while (isspace((unsigned char)*cmd))
282 cmd++;
283
284 /*
285 * If we did not end up with a command, just skip it.
286 */
287 if (!*cmd)
288 return (0);
289
290 #if !defined(MAKE_NATIVE)
291 /*
292 * In a non-native build, the host environment might be weird enough
293 * that it's necessary to go through a shell to get the correct
294 * behaviour. Or perhaps the shell has been replaced with something
295 * that does extra logging, and that should not be bypassed.
296 */
297 useShell = TRUE;
298 #else
299 /*
300 * Search for meta characters in the command. If there are no meta
301 * characters, there's no need to execute a shell to execute the
302 * command.
303 *
304 * Additionally variable assignments and empty commands
305 * go to the shell. Therefore treat '=' and ':' like shell
306 * meta characters as documented in make(1).
307 */
308
309 useShell = needshell(cmd, FALSE);
310 #endif
311
312 /*
313 * Print the command before echoing if we're not supposed to be quiet for
314 * this one. We also print the command if -n given.
315 */
316 if (!silent || NoExecute(gn)) {
317 printf("%s\n", cmd);
318 fflush(stdout);
319 }
320
321 /*
322 * If we're not supposed to execute any commands, this is as far as
323 * we go...
324 */
325 if (!doIt && NoExecute(gn)) {
326 return (0);
327 }
328 if (DEBUG(JOB))
329 fprintf(debug_file, "Execute: '%s'\n", cmd);
330
331 again:
332 if (useShell) {
333 /*
334 * We need to pass the command off to the shell, typically
335 * because the command contains a "meta" character.
336 */
337 static const char *shargv[5];
338 int shargc;
339
340 shargc = 0;
341 shargv[shargc++] = shellPath;
342 /*
343 * The following work for any of the builtin shell specs.
344 */
345 if (errCheck && shellErrFlag) {
346 shargv[shargc++] = shellErrFlag;
347 }
348 if (DEBUG(SHELL))
349 shargv[shargc++] = "-xc";
350 else
351 shargv[shargc++] = "-c";
352 shargv[shargc++] = cmd;
353 shargv[shargc++] = NULL;
354 av = shargv;
355 argc = 0;
356 bp = NULL;
357 mav = NULL;
358 } else {
359 /*
360 * No meta-characters, so no need to exec a shell. Break the command
361 * into words to form an argument vector we can execute.
362 */
363 mav = brk_string(cmd, &argc, TRUE, &bp);
364 if (mav == NULL) {
365 useShell = 1;
366 goto again;
367 }
368 av = (void *)mav;
369 }
370
371 local = TRUE;
372
373 #ifdef USE_META
374 if (useMeta) {
375 meta_compat_start();
376 }
377 #endif
378
379 /*
380 * Fork and execute the single command. If the fork fails, we abort.
381 */
382 compatChild = cpid = vFork();
383 if (cpid < 0) {
384 Fatal("Could not fork");
385 }
386 if (cpid == 0) {
387 Var_ExportVars();
388 #ifdef USE_META
389 if (useMeta) {
390 meta_compat_child();
391 }
392 #endif
393 if (local)
394 (void)execvp(av[0], (char *const *)UNCONST(av));
395 else
396 (void)execv(av[0], (char *const *)UNCONST(av));
397 execError("exec", av[0]);
398 _exit(1);
399 }
400
401 free(mav);
402 free(bp);
403
404 Lst_Replace(cmdNode, NULL);
405
406 #ifdef USE_META
407 if (useMeta) {
408 meta_compat_parent();
409 }
410 #endif
411
412 /*
413 * The child is off and running. Now all we can do is wait...
414 */
415 while (1) {
416
417 while ((retstat = wait(&reason)) != cpid) {
418 if (retstat > 0)
419 JobReapChild(retstat, reason, FALSE); /* not ours? */
420 if (retstat == -1 && errno != EINTR) {
421 break;
422 }
423 }
424
425 if (retstat > -1) {
426 if (WIFSTOPPED(reason)) {
427 status = WSTOPSIG(reason); /* stopped */
428 } else if (WIFEXITED(reason)) {
429 status = WEXITSTATUS(reason); /* exited */
430 if (status != 0) {
431 if (DEBUG(ERROR)) {
432 fprintf(debug_file, "\n*** Failed target: %s\n*** Failed command: ",
433 gn->name);
434 for (cp = cmd; *cp; ) {
435 if (isspace((unsigned char)*cp)) {
436 fprintf(debug_file, " ");
437 while (isspace((unsigned char)*cp))
438 cp++;
439 } else {
440 fprintf(debug_file, "%c", *cp);
441 cp++;
442 }
443 }
444 fprintf(debug_file, "\n");
445 }
446 printf("*** Error code %d", status);
447 }
448 } else {
449 status = WTERMSIG(reason); /* signaled */
450 printf("*** Signal %d", status);
451 }
452
453
454 if (!WIFEXITED(reason) || (status != 0)) {
455 if (errCheck) {
456 #ifdef USE_META
457 if (useMeta) {
458 meta_job_error(NULL, gn, 0, status);
459 }
460 #endif
461 gn->made = ERROR;
462 if (keepgoing) {
463 /*
464 * Abort the current target, but let others
465 * continue.
466 */
467 printf(" (continuing)\n");
468 } else {
469 printf("\n");
470 }
471 if (deleteOnError) {
472 CompatDeleteTarget(gn);
473 }
474 } else {
475 /*
476 * Continue executing commands for this target.
477 * If we return 0, this will happen...
478 */
479 printf(" (ignored)\n");
480 status = 0;
481 }
482 }
483 break;
484 } else {
485 Fatal("error in wait: %d: %s", retstat, strerror(errno));
486 /*NOTREACHED*/
487 }
488 }
489 free(cmdStart);
490 compatChild = 0;
491 if (compatSigno) {
492 bmake_signal(compatSigno, SIG_DFL);
493 kill(myPid, compatSigno);
494 }
495
496 return (status);
497 }
498
499 /*-
501 *-----------------------------------------------------------------------
502 * Compat_Make --
503 * Make a target.
504 *
505 * Input:
506 * gnp The node to make
507 * pgnp Parent to abort if necessary
508 *
509 * Results:
510 * 0
511 *
512 * Side Effects:
513 * If an error is detected and not being ignored, the process exits.
514 *
515 *-----------------------------------------------------------------------
516 */
517 int
518 Compat_Make(void *gnp, void *pgnp)
519 {
520 GNode *gn = (GNode *)gnp;
521 GNode *pgn = (GNode *)pgnp;
522
523 if (!shellName) /* we came here from jobs */
524 Shell_Init();
525 if (gn->made == UNMADE && (gn == pgn || (pgn->type & OP_MADE) == 0)) {
526 /*
527 * First mark ourselves to be made, then apply whatever transformations
528 * the suffix module thinks are necessary. Once that's done, we can
529 * descend and make all our children. If any of them has an error
530 * but the -k flag was given, our 'make' field will be set FALSE again.
531 * This is our signal to not attempt to do anything but abort our
532 * parent as well.
533 */
534 gn->flags |= REMAKE;
535 gn->made = BEINGMADE;
536 if ((gn->type & OP_MADE) == 0)
537 Suff_FindDeps(gn);
538 Lst_ForEach(gn->children, Compat_Make, gn);
539 if ((gn->flags & REMAKE) == 0) {
540 gn->made = ABORTED;
541 pgn->flags &= ~REMAKE;
542 goto cohorts;
543 }
544
545 if (Lst_Member(gn->iParents, pgn) != NULL) {
546 char *p1;
547 Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
548 free(p1);
549 }
550
551 /*
552 * All the children were made ok. Now cmgn->mtime contains the
553 * modification time of the newest child, we need to find out if we
554 * exist and when we were modified last. The criteria for datedness
555 * are defined by the Make_OODate function.
556 */
557 if (DEBUG(MAKE)) {
558 fprintf(debug_file, "Examining %s...", gn->name);
559 }
560 if (! Make_OODate(gn)) {
561 gn->made = UPTODATE;
562 if (DEBUG(MAKE)) {
563 fprintf(debug_file, "up-to-date.\n");
564 }
565 goto cohorts;
566 } else if (DEBUG(MAKE)) {
567 fprintf(debug_file, "out-of-date.\n");
568 }
569
570 /*
571 * If the user is just seeing if something is out-of-date, exit now
572 * to tell him/her "yes".
573 */
574 if (queryFlag) {
575 exit(1);
576 }
577
578 /*
579 * We need to be re-made. We also have to make sure we've got a $?
580 * variable. To be nice, we also define the $> variable using
581 * Make_DoAllVar().
582 */
583 Make_DoAllVar(gn);
584
585 /*
586 * Alter our type to tell if errors should be ignored or things
587 * should not be printed so CompatRunCommand knows what to do.
588 */
589 if (Targ_Ignore(gn)) {
590 gn->type |= OP_IGNORE;
591 }
592 if (Targ_Silent(gn)) {
593 gn->type |= OP_SILENT;
594 }
595
596 if (Job_CheckCommands(gn, Fatal)) {
597 /*
598 * Our commands are ok, but we still have to worry about the -t
599 * flag...
600 */
601 if (!touchFlag || (gn->type & OP_MAKE)) {
602 curTarg = gn;
603 #ifdef USE_META
604 if (useMeta && !NoExecute(gn)) {
605 meta_job_start(NULL, gn);
606 }
607 #endif
608 Lst_ForEach(gn->commands, CompatRunCommand, gn);
609 curTarg = NULL;
610 } else {
611 Job_Touch(gn, gn->type & OP_SILENT);
612 }
613 } else {
614 gn->made = ERROR;
615 }
616 #ifdef USE_META
617 if (useMeta && !NoExecute(gn)) {
618 if (meta_job_finish(NULL) != 0)
619 gn->made = ERROR;
620 }
621 #endif
622
623 if (gn->made != ERROR) {
624 /*
625 * If the node was made successfully, mark it so, update
626 * its modification time and timestamp all its parents. Note
627 * that for .ZEROTIME targets, the timestamping isn't done.
628 * This is to keep its state from affecting that of its parent.
629 */
630 gn->made = MADE;
631 pgn->flags |= Make_Recheck(gn) == 0 ? FORCE : 0;
632 if (!(gn->type & OP_EXEC)) {
633 pgn->flags |= CHILDMADE;
634 Make_TimeStamp(pgn, gn);
635 }
636 } else if (keepgoing) {
637 pgn->flags &= ~REMAKE;
638 } else {
639 PrintOnError(gn, "\nStop.");
640 exit(1);
641 }
642 } else if (gn->made == ERROR) {
643 /*
644 * Already had an error when making this beastie. Tell the parent
645 * to abort.
646 */
647 pgn->flags &= ~REMAKE;
648 } else {
649 if (Lst_Member(gn->iParents, pgn) != NULL) {
650 char *p1;
651 Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
652 free(p1);
653 }
654 switch(gn->made) {
655 case BEINGMADE:
656 Error("Graph cycles through %s", gn->name);
657 gn->made = ERROR;
658 pgn->flags &= ~REMAKE;
659 break;
660 case MADE:
661 if ((gn->type & OP_EXEC) == 0) {
662 pgn->flags |= CHILDMADE;
663 Make_TimeStamp(pgn, gn);
664 }
665 break;
666 case UPTODATE:
667 if ((gn->type & OP_EXEC) == 0) {
668 Make_TimeStamp(pgn, gn);
669 }
670 break;
671 default:
672 break;
673 }
674 }
675
676 cohorts:
677 Lst_ForEach(gn->cohorts, Compat_Make, pgnp);
678 return (0);
679 }
680
681 /*-
683 *-----------------------------------------------------------------------
684 * Compat_Run --
685 * Initialize this mode and start making.
686 *
687 * Input:
688 * targs List of target nodes to re-create
689 *
690 * Results:
691 * None.
692 *
693 * Side Effects:
694 * Guess what?
695 *
696 *-----------------------------------------------------------------------
697 */
698 void
699 Compat_Run(Lst targs)
700 {
701 GNode *gn = NULL;/* Current root target */
702 int errors; /* Number of targets not remade due to errors */
703
704 if (!shellName)
705 Shell_Init();
706
707 if (bmake_signal(SIGINT, SIG_IGN) != SIG_IGN) {
708 bmake_signal(SIGINT, CompatInterrupt);
709 }
710 if (bmake_signal(SIGTERM, SIG_IGN) != SIG_IGN) {
711 bmake_signal(SIGTERM, CompatInterrupt);
712 }
713 if (bmake_signal(SIGHUP, SIG_IGN) != SIG_IGN) {
714 bmake_signal(SIGHUP, CompatInterrupt);
715 }
716 if (bmake_signal(SIGQUIT, SIG_IGN) != SIG_IGN) {
717 bmake_signal(SIGQUIT, CompatInterrupt);
718 }
719
720 ENDNode = Targ_FindNode(".END", TARG_CREATE);
721 ENDNode->type = OP_SPECIAL;
722 /*
723 * If the user has defined a .BEGIN target, execute the commands attached
724 * to it.
725 */
726 if (!queryFlag) {
727 gn = Targ_FindNode(".BEGIN", TARG_NOCREATE);
728 if (gn != NULL) {
729 Compat_Make(gn, gn);
730 if (gn->made == ERROR) {
731 PrintOnError(gn, "\nStop.");
732 exit(1);
733 }
734 }
735 }
736
737 /*
738 * Expand .USE nodes right now, because they can modify the structure
739 * of the tree.
740 */
741 Make_ExpandUse(targs);
742
743 /*
744 * For each entry in the list of targets to create, call Compat_Make on
745 * it to create the thing. Compat_Make will leave the 'made' field of gn
746 * in one of several states:
747 * UPTODATE gn was already up-to-date
748 * MADE gn was recreated successfully
749 * ERROR An error occurred while gn was being created
750 * ABORTED gn was not remade because one of its inferiors
751 * could not be made due to errors.
752 */
753 errors = 0;
754 while (!Lst_IsEmpty (targs)) {
755 gn = (GNode *)Lst_DeQueue(targs);
756 Compat_Make(gn, gn);
757
758 if (gn->made == UPTODATE) {
759 printf("`%s' is up to date.\n", gn->name);
760 } else if (gn->made == ABORTED) {
761 printf("`%s' not remade because of errors.\n", gn->name);
762 errors += 1;
763 }
764 }
765
766 /*
767 * If the user has defined a .END target, run its commands.
768 */
769 if (errors == 0) {
770 Compat_Make(ENDNode, ENDNode);
771 if (gn->made == ERROR) {
772 PrintOnError(gn, "\nStop.");
773 exit(1);
774 }
775 }
776 }
777