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