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