compat.c revision 1.106 1 /* $NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland 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.106 2016/08/26 23:28:39 dholland 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.106 2016/08/26 23:28:39 dholland 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
119 /*
120 * CompatDeleteTarget -- delete a failed, interrupted, or otherwise
121 * duffed target if not inhibited by .PRECIOUS.
122 */
123 static void
124 CompatDeleteTarget(GNode *gn)
125 {
126 if ((gn != NULL) && !Targ_Precious (gn)) {
127 char *p1;
128 char *file = Var_Value(TARGET, gn, &p1);
129
130 if (!noExecute && eunlink(file) != -1) {
131 Error("*** %s removed", file);
132 }
133
134 free(p1);
135 }
136 }
137
138 /*-
139 *-----------------------------------------------------------------------
140 * CompatInterrupt --
141 * Interrupt the creation of the current target and remove it if
142 * it ain't precious.
143 *
144 * Results:
145 * None.
146 *
147 * Side Effects:
148 * The target is removed and the process exits. If .INTERRUPT exists,
149 * its commands are run first WITH INTERRUPTS IGNORED..
150 *
151 * XXX: is .PRECIOUS supposed to inhibit .INTERRUPT? I doubt it, but I've
152 * left the logic alone for now. - dholland 20160826
153 *
154 *-----------------------------------------------------------------------
155 */
156 static void
157 CompatInterrupt(int signo)
158 {
159 GNode *gn;
160
161 CompatDeleteTarget(curTarg);
162
163 if ((curTarg != NULL) && !Targ_Precious (curTarg)) {
164 /*
165 * Run .INTERRUPT only if hit with interrupt signal
166 */
167 if (signo == SIGINT) {
168 gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE);
169 if (gn != NULL) {
170 Compat_Make(gn, gn);
171 }
172 }
173 }
174 if (signo == SIGQUIT)
175 _exit(signo);
176 bmake_signal(signo, SIG_DFL);
177 kill(myPid, signo);
178 }
179
180 /*-
182 *-----------------------------------------------------------------------
183 * CompatRunCommand --
184 * Execute the next command for a target. If the command returns an
185 * error, the node's made field is set to ERROR and creation stops.
186 *
187 * Input:
188 * cmdp Command to execute
189 * gnp Node from which the command came
190 *
191 * Results:
192 * 0 if the command succeeded, 1 if an error occurred.
193 *
194 * Side Effects:
195 * The node's 'made' field may be set to ERROR.
196 *
197 *-----------------------------------------------------------------------
198 */
199 int
200 CompatRunCommand(void *cmdp, void *gnp)
201 {
202 char *cmdStart; /* Start of expanded command */
203 char *cp, *bp;
204 Boolean silent, /* Don't print command */
205 doIt; /* Execute even if -n */
206 volatile Boolean errCheck; /* Check errors */
207 int reason; /* Reason for child's death */
208 int status; /* Description of child's death */
209 pid_t cpid; /* Child actually found */
210 pid_t retstat; /* Result of wait */
211 LstNode cmdNode; /* Node where current command is located */
212 const char ** volatile av; /* Argument vector for thing to exec */
213 char ** volatile mav;/* Copy of the argument vector for freeing */
214 int argc; /* Number of arguments in av or 0 if not
215 * dynamically allocated */
216 Boolean local; /* TRUE if command should be executed
217 * locally */
218 Boolean useShell; /* TRUE if command should be executed
219 * using a shell */
220 char * volatile cmd = (char *)cmdp;
221 GNode *gn = (GNode *)gnp;
222
223 silent = gn->type & OP_SILENT;
224 errCheck = !(gn->type & OP_IGNORE);
225 doIt = FALSE;
226
227 cmdNode = Lst_Member(gn->commands, cmd);
228 cmdStart = Var_Subst(NULL, cmd, gn, VARF_WANTRES);
229
230 /*
231 * brk_string will return an argv with a NULL in av[0], thus causing
232 * execvp to choke and die horribly. Besides, how can we execute a null
233 * command? In any case, we warn the user that the command expanded to
234 * nothing (is this the right thing to do?).
235 */
236
237 if (*cmdStart == '\0') {
238 free(cmdStart);
239 return(0);
240 }
241 cmd = cmdStart;
242 Lst_Replace(cmdNode, cmdStart);
243
244 if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) {
245 (void)Lst_AtEnd(ENDNode->commands, cmdStart);
246 return(0);
247 }
248 if (strcmp(cmdStart, "...") == 0) {
249 gn->type |= OP_SAVE_CMDS;
250 return(0);
251 }
252
253 while ((*cmd == '@') || (*cmd == '-') || (*cmd == '+')) {
254 switch (*cmd) {
255 case '@':
256 silent = DEBUG(LOUD) ? FALSE : TRUE;
257 break;
258 case '-':
259 errCheck = FALSE;
260 break;
261 case '+':
262 doIt = TRUE;
263 if (!shellName) /* we came here from jobs */
264 Shell_Init();
265 break;
266 }
267 cmd++;
268 }
269
270 while (isspace((unsigned char)*cmd))
271 cmd++;
272
273 /*
274 * If we did not end up with a command, just skip it.
275 */
276 if (!*cmd)
277 return (0);
278
279 #if !defined(MAKE_NATIVE)
280 /*
281 * In a non-native build, the host environment might be weird enough
282 * that it's necessary to go through a shell to get the correct
283 * behaviour. Or perhaps the shell has been replaced with something
284 * that does extra logging, and that should not be bypassed.
285 */
286 useShell = TRUE;
287 #else
288 /*
289 * Search for meta characters in the command. If there are no meta
290 * characters, there's no need to execute a shell to execute the
291 * command.
292 *
293 * Additionally variable assignments and empty commands
294 * go to the shell. Therefore treat '=' and ':' like shell
295 * meta characters as documented in make(1).
296 */
297
298 useShell = needshell(cmd, FALSE);
299 #endif
300
301 /*
302 * Print the command before echoing if we're not supposed to be quiet for
303 * this one. We also print the command if -n given.
304 */
305 if (!silent || NoExecute(gn)) {
306 printf("%s\n", cmd);
307 fflush(stdout);
308 }
309
310 /*
311 * If we're not supposed to execute any commands, this is as far as
312 * we go...
313 */
314 if (!doIt && NoExecute(gn)) {
315 return (0);
316 }
317 if (DEBUG(JOB))
318 fprintf(debug_file, "Execute: '%s'\n", cmd);
319
320 again:
321 if (useShell) {
322 /*
323 * We need to pass the command off to the shell, typically
324 * because the command contains a "meta" character.
325 */
326 static const char *shargv[5];
327 int shargc;
328
329 shargc = 0;
330 shargv[shargc++] = shellPath;
331 /*
332 * The following work for any of the builtin shell specs.
333 */
334 if (errCheck && shellErrFlag) {
335 shargv[shargc++] = shellErrFlag;
336 }
337 if (DEBUG(SHELL))
338 shargv[shargc++] = "-xc";
339 else
340 shargv[shargc++] = "-c";
341 shargv[shargc++] = cmd;
342 shargv[shargc++] = NULL;
343 av = shargv;
344 argc = 0;
345 bp = NULL;
346 mav = NULL;
347 } else {
348 /*
349 * No meta-characters, so no need to exec a shell. Break the command
350 * into words to form an argument vector we can execute.
351 */
352 mav = brk_string(cmd, &argc, TRUE, &bp);
353 if (mav == NULL) {
354 useShell = 1;
355 goto again;
356 }
357 av = (void *)mav;
358 }
359
360 local = TRUE;
361
362 #ifdef USE_META
363 if (useMeta) {
364 meta_compat_start();
365 }
366 #endif
367
368 /*
369 * Fork and execute the single command. If the fork fails, we abort.
370 */
371 cpid = vFork();
372 if (cpid < 0) {
373 Fatal("Could not fork");
374 }
375 if (cpid == 0) {
376 Var_ExportVars();
377 #ifdef USE_META
378 if (useMeta) {
379 meta_compat_child();
380 }
381 #endif
382 if (local)
383 (void)execvp(av[0], (char *const *)UNCONST(av));
384 else
385 (void)execv(av[0], (char *const *)UNCONST(av));
386 execError("exec", av[0]);
387 _exit(1);
388 }
389
390 free(mav);
391 free(bp);
392
393 Lst_Replace(cmdNode, NULL);
394
395 #ifdef USE_META
396 if (useMeta) {
397 meta_compat_parent();
398 }
399 #endif
400
401 /*
402 * The child is off and running. Now all we can do is wait...
403 */
404 while (1) {
405
406 while ((retstat = wait(&reason)) != cpid) {
407 if (retstat > 0)
408 JobReapChild(retstat, reason, FALSE); /* not ours? */
409 if (retstat == -1 && errno != EINTR) {
410 break;
411 }
412 }
413
414 if (retstat > -1) {
415 if (WIFSTOPPED(reason)) {
416 status = WSTOPSIG(reason); /* stopped */
417 } else if (WIFEXITED(reason)) {
418 status = WEXITSTATUS(reason); /* exited */
419 #if defined(USE_META) && defined(USE_FILEMON_ONCE)
420 if (useMeta) {
421 meta_cmd_finish(NULL);
422 }
423 #endif
424 if (status != 0) {
425 if (DEBUG(ERROR)) {
426 fprintf(debug_file, "\n*** Failed target: %s\n*** Failed command: ",
427 gn->name);
428 for (cp = cmd; *cp; ) {
429 if (isspace((unsigned char)*cp)) {
430 fprintf(debug_file, " ");
431 while (isspace((unsigned char)*cp))
432 cp++;
433 } else {
434 fprintf(debug_file, "%c", *cp);
435 cp++;
436 }
437 }
438 fprintf(debug_file, "\n");
439 }
440 printf("*** Error code %d", status);
441 }
442 } else {
443 status = WTERMSIG(reason); /* signaled */
444 printf("*** Signal %d", status);
445 }
446
447
448 if (!WIFEXITED(reason) || (status != 0)) {
449 if (errCheck) {
450 #ifdef USE_META
451 if (useMeta) {
452 meta_job_error(NULL, gn, 0, status);
453 }
454 #endif
455 gn->made = ERROR;
456 if (keepgoing) {
457 /*
458 * Abort the current target, but let others
459 * continue.
460 */
461 printf(" (continuing)\n");
462 } else {
463 printf("\n");
464 }
465 if (deleteOnError) {
466 CompatDeleteTarget(gn);
467 }
468 } else {
469 /*
470 * Continue executing commands for this target.
471 * If we return 0, this will happen...
472 */
473 printf(" (ignored)\n");
474 status = 0;
475 }
476 }
477 break;
478 } else {
479 Fatal("error in wait: %d: %s", retstat, strerror(errno));
480 /*NOTREACHED*/
481 }
482 }
483 free(cmdStart);
484
485 return (status);
486 }
487
488 /*-
490 *-----------------------------------------------------------------------
491 * Compat_Make --
492 * Make a target.
493 *
494 * Input:
495 * gnp The node to make
496 * pgnp Parent to abort if necessary
497 *
498 * Results:
499 * 0
500 *
501 * Side Effects:
502 * If an error is detected and not being ignored, the process exits.
503 *
504 *-----------------------------------------------------------------------
505 */
506 int
507 Compat_Make(void *gnp, void *pgnp)
508 {
509 GNode *gn = (GNode *)gnp;
510 GNode *pgn = (GNode *)pgnp;
511
512 if (!shellName) /* we came here from jobs */
513 Shell_Init();
514 if (gn->made == UNMADE && (gn == pgn || (pgn->type & OP_MADE) == 0)) {
515 /*
516 * First mark ourselves to be made, then apply whatever transformations
517 * the suffix module thinks are necessary. Once that's done, we can
518 * descend and make all our children. If any of them has an error
519 * but the -k flag was given, our 'make' field will be set FALSE again.
520 * This is our signal to not attempt to do anything but abort our
521 * parent as well.
522 */
523 gn->flags |= REMAKE;
524 gn->made = BEINGMADE;
525 if ((gn->type & OP_MADE) == 0)
526 Suff_FindDeps(gn);
527 Lst_ForEach(gn->children, Compat_Make, gn);
528 if ((gn->flags & REMAKE) == 0) {
529 gn->made = ABORTED;
530 pgn->flags &= ~REMAKE;
531 goto cohorts;
532 }
533
534 if (Lst_Member(gn->iParents, pgn) != NULL) {
535 char *p1;
536 Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
537 free(p1);
538 }
539
540 /*
541 * All the children were made ok. Now cmgn->mtime contains the
542 * modification time of the newest child, we need to find out if we
543 * exist and when we were modified last. The criteria for datedness
544 * are defined by the Make_OODate function.
545 */
546 if (DEBUG(MAKE)) {
547 fprintf(debug_file, "Examining %s...", gn->name);
548 }
549 if (! Make_OODate(gn)) {
550 gn->made = UPTODATE;
551 if (DEBUG(MAKE)) {
552 fprintf(debug_file, "up-to-date.\n");
553 }
554 goto cohorts;
555 } else if (DEBUG(MAKE)) {
556 fprintf(debug_file, "out-of-date.\n");
557 }
558
559 /*
560 * If the user is just seeing if something is out-of-date, exit now
561 * to tell him/her "yes".
562 */
563 if (queryFlag) {
564 exit(1);
565 }
566
567 /*
568 * We need to be re-made. We also have to make sure we've got a $?
569 * variable. To be nice, we also define the $> variable using
570 * Make_DoAllVar().
571 */
572 Make_DoAllVar(gn);
573
574 /*
575 * Alter our type to tell if errors should be ignored or things
576 * should not be printed so CompatRunCommand knows what to do.
577 */
578 if (Targ_Ignore(gn)) {
579 gn->type |= OP_IGNORE;
580 }
581 if (Targ_Silent(gn)) {
582 gn->type |= OP_SILENT;
583 }
584
585 if (Job_CheckCommands(gn, Fatal)) {
586 /*
587 * Our commands are ok, but we still have to worry about the -t
588 * flag...
589 */
590 if (!touchFlag || (gn->type & OP_MAKE)) {
591 curTarg = gn;
592 #ifdef USE_META
593 if (useMeta && !NoExecute(gn)) {
594 meta_job_start(NULL, gn);
595 }
596 #endif
597 Lst_ForEach(gn->commands, CompatRunCommand, gn);
598 curTarg = NULL;
599 } else {
600 Job_Touch(gn, gn->type & OP_SILENT);
601 }
602 } else {
603 gn->made = ERROR;
604 }
605 #ifdef USE_META
606 if (useMeta && !NoExecute(gn)) {
607 if (meta_job_finish(NULL) != 0)
608 gn->made = ERROR;
609 }
610 #endif
611
612 if (gn->made != ERROR) {
613 /*
614 * If the node was made successfully, mark it so, update
615 * its modification time and timestamp all its parents. Note
616 * that for .ZEROTIME targets, the timestamping isn't done.
617 * This is to keep its state from affecting that of its parent.
618 */
619 gn->made = MADE;
620 pgn->flags |= Make_Recheck(gn) == 0 ? FORCE : 0;
621 if (!(gn->type & OP_EXEC)) {
622 pgn->flags |= CHILDMADE;
623 Make_TimeStamp(pgn, gn);
624 }
625 } else if (keepgoing) {
626 pgn->flags &= ~REMAKE;
627 } else {
628 PrintOnError(gn, "\nStop.");
629 exit(1);
630 }
631 } else if (gn->made == ERROR) {
632 /*
633 * Already had an error when making this beastie. Tell the parent
634 * to abort.
635 */
636 pgn->flags &= ~REMAKE;
637 } else {
638 if (Lst_Member(gn->iParents, pgn) != NULL) {
639 char *p1;
640 Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
641 free(p1);
642 }
643 switch(gn->made) {
644 case BEINGMADE:
645 Error("Graph cycles through %s", gn->name);
646 gn->made = ERROR;
647 pgn->flags &= ~REMAKE;
648 break;
649 case MADE:
650 if ((gn->type & OP_EXEC) == 0) {
651 pgn->flags |= CHILDMADE;
652 Make_TimeStamp(pgn, gn);
653 }
654 break;
655 case UPTODATE:
656 if ((gn->type & OP_EXEC) == 0) {
657 Make_TimeStamp(pgn, gn);
658 }
659 break;
660 default:
661 break;
662 }
663 }
664
665 cohorts:
666 Lst_ForEach(gn->cohorts, Compat_Make, pgnp);
667 return (0);
668 }
669
670 /*-
672 *-----------------------------------------------------------------------
673 * Compat_Run --
674 * Initialize this mode and start making.
675 *
676 * Input:
677 * targs List of target nodes to re-create
678 *
679 * Results:
680 * None.
681 *
682 * Side Effects:
683 * Guess what?
684 *
685 *-----------------------------------------------------------------------
686 */
687 void
688 Compat_Run(Lst targs)
689 {
690 GNode *gn = NULL;/* Current root target */
691 int errors; /* Number of targets not remade due to errors */
692
693 if (!shellName)
694 Shell_Init();
695
696 if (bmake_signal(SIGINT, SIG_IGN) != SIG_IGN) {
697 bmake_signal(SIGINT, CompatInterrupt);
698 }
699 if (bmake_signal(SIGTERM, SIG_IGN) != SIG_IGN) {
700 bmake_signal(SIGTERM, CompatInterrupt);
701 }
702 if (bmake_signal(SIGHUP, SIG_IGN) != SIG_IGN) {
703 bmake_signal(SIGHUP, CompatInterrupt);
704 }
705 if (bmake_signal(SIGQUIT, SIG_IGN) != SIG_IGN) {
706 bmake_signal(SIGQUIT, CompatInterrupt);
707 }
708
709 ENDNode = Targ_FindNode(".END", TARG_CREATE);
710 ENDNode->type = OP_SPECIAL;
711 /*
712 * If the user has defined a .BEGIN target, execute the commands attached
713 * to it.
714 */
715 if (!queryFlag) {
716 gn = Targ_FindNode(".BEGIN", TARG_NOCREATE);
717 if (gn != NULL) {
718 Compat_Make(gn, gn);
719 if (gn->made == ERROR) {
720 PrintOnError(gn, "\nStop.");
721 exit(1);
722 }
723 }
724 }
725
726 /*
727 * Expand .USE nodes right now, because they can modify the structure
728 * of the tree.
729 */
730 Make_ExpandUse(targs);
731
732 /*
733 * For each entry in the list of targets to create, call Compat_Make on
734 * it to create the thing. Compat_Make will leave the 'made' field of gn
735 * in one of several states:
736 * UPTODATE gn was already up-to-date
737 * MADE gn was recreated successfully
738 * ERROR An error occurred while gn was being created
739 * ABORTED gn was not remade because one of its inferiors
740 * could not be made due to errors.
741 */
742 errors = 0;
743 while (!Lst_IsEmpty (targs)) {
744 gn = (GNode *)Lst_DeQueue(targs);
745 Compat_Make(gn, gn);
746
747 if (gn->made == UPTODATE) {
748 printf("`%s' is up to date.\n", gn->name);
749 } else if (gn->made == ABORTED) {
750 printf("`%s' not remade because of errors.\n", gn->name);
751 errors += 1;
752 }
753 }
754
755 /*
756 * If the user has defined a .END target, run its commands.
757 */
758 if (errors == 0) {
759 Compat_Make(ENDNode, ENDNode);
760 if (gn->made == ERROR) {
761 PrintOnError(gn, "\nStop.");
762 exit(1);
763 }
764 }
765 }
766