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 #ifdef HAVE_CONFIG_H 99 # include "config.h" 100 #endif 101 #include <sys/types.h> 102 #include <sys/stat.h> 103 #include "wait.h" 104 105 #include <ctype.h> 106 #include <errno.h> 107 #include <signal.h> 108 #include <stdio.h> 109 110 #include "make.h" 111 #include "hash.h" 112 #include "dir.h" 113 #include "job.h" 114 #include "metachar.h" 115 #include "pathnames.h" 116 117 118 static GNode *curTarg = NULL; 119 static GNode *ENDNode; 120 static void CompatInterrupt(int); 121 static pid_t compatChild; 122 static int compatSigno; 123 124 /* 125 * CompatDeleteTarget -- delete a failed, interrupted, or otherwise 126 * duffed target if not inhibited by .PRECIOUS. 127 */ 128 static void 129 CompatDeleteTarget(GNode *gn) 130 { 131 if ((gn != NULL) && !Targ_Precious (gn)) { 132 char *p1; 133 const char *file = Var_Value(TARGET, gn, &p1); 134 135 if (!noExecute && eunlink(file) != -1) { 136 Error("*** %s removed", file); 137 } 138 139 bmake_free(p1); 140 } 141 } 142 143 /* Interrupt the creation of the current target and remove it if it ain't 144 * precious. Then exit. 145 * 146 * If .INTERRUPT exists, its commands are run first WITH INTERRUPTS IGNORED. 147 * 148 * XXX: is .PRECIOUS supposed to inhibit .INTERRUPT? I doubt it, but I've 149 * left the logic alone for now. - dholland 20160826 150 */ 151 static void 152 CompatInterrupt(int signo) 153 { 154 GNode *gn; 155 156 CompatDeleteTarget(curTarg); 157 158 if ((curTarg != NULL) && !Targ_Precious (curTarg)) { 159 /* 160 * Run .INTERRUPT only if hit with interrupt signal 161 */ 162 if (signo == SIGINT) { 163 gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE); 164 if (gn != NULL) { 165 Compat_Make(gn, gn); 166 } 167 } 168 } 169 if (signo == SIGQUIT) 170 _exit(signo); 171 /* 172 * If there is a child running, pass the signal on 173 * we will exist after it has exited. 174 */ 175 compatSigno = signo; 176 if (compatChild > 0) { 177 KILLPG(compatChild, signo); 178 } else { 179 bmake_signal(signo, SIG_DFL); 180 kill(myPid, signo); 181 } 182 } 183 184 /*- 185 *----------------------------------------------------------------------- 186 * CompatRunCommand -- 187 * Execute the next command for a target. If the command returns an 188 * error, the node's made field is set to ERROR and creation stops. 189 * 190 * Input: 191 * cmdp Command to execute 192 * gnp Node from which the command came 193 * 194 * Results: 195 * 0 if the command succeeded, 1 if an error occurred. 196 * 197 * Side Effects: 198 * The node's 'made' field may be set to ERROR. 199 * 200 *----------------------------------------------------------------------- 201 */ 202 int 203 CompatRunCommand(void *cmdp, void *gnp) 204 { 205 char *cmdStart; /* Start of expanded command */ 206 char *cp, *bp; 207 Boolean silent, /* Don't print command */ 208 doIt; /* Execute even if -n */ 209 volatile Boolean errCheck; /* Check errors */ 210 WAIT_T reason; /* Reason for child's death */ 211 int status; /* Description of child's death */ 212 pid_t cpid; /* Child actually found */ 213 pid_t retstat; /* Result of wait */ 214 LstNode cmdNode; /* Node where current command is located */ 215 const char ** volatile av; /* Argument vector for thing to exec */ 216 char ** volatile mav;/* Copy of the argument vector for freeing */ 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) != 0; 223 errCheck = !(gn->type & OP_IGNORE); 224 doIt = FALSE; 225 226 cmdNode = Lst_FindDatum(gn->commands, cmd); 227 cmdStart = Var_Subst(cmd, gn, VARE_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 LstNode_Set(cmdNode, cmdStart); 242 243 if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) { 244 assert(ENDNode != NULL); 245 Lst_Append(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); 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 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 bp = NULL; 344 mav = NULL; 345 } else { 346 /* 347 * No meta-characters, so no need to exec a shell. Break the command 348 * into words to form an argument vector we can execute. 349 */ 350 Words words = Str_Words(cmd, FALSE); 351 mav = words.words; 352 bp = words.freeIt; 353 av = (void *)mav; 354 } 355 356 #ifdef USE_META 357 if (useMeta) { 358 meta_compat_start(); 359 } 360 #endif 361 362 /* 363 * Fork and execute the single command. If the fork fails, we abort. 364 */ 365 compatChild = cpid = vFork(); 366 if (cpid < 0) { 367 Fatal("Could not fork"); 368 } 369 if (cpid == 0) { 370 Var_ExportVars(); 371 #ifdef USE_META 372 if (useMeta) { 373 meta_compat_child(); 374 } 375 #endif 376 (void)execvp(av[0], (char *const *)UNCONST(av)); 377 execError("exec", av[0]); 378 _exit(1); 379 } 380 381 free(mav); 382 free(bp); 383 384 /* XXX: Memory management looks suspicious here. */ 385 /* XXX: Setting a list item to NULL is unexpected. */ 386 LstNode_SetNull(cmdNode); 387 388 #ifdef USE_META 389 if (useMeta) { 390 meta_compat_parent(cpid); 391 } 392 #endif 393 394 /* 395 * The child is off and running. Now all we can do is wait... 396 */ 397 while (1) { 398 399 while ((retstat = wait(&reason)) != cpid) { 400 if (retstat > 0) 401 JobReapChild(retstat, reason, FALSE); /* not ours? */ 402 if (retstat == -1 && errno != EINTR) { 403 break; 404 } 405 } 406 407 if (retstat > -1) { 408 if (WIFSTOPPED(reason)) { 409 status = WSTOPSIG(reason); /* stopped */ 410 } else if (WIFEXITED(reason)) { 411 status = WEXITSTATUS(reason); /* exited */ 412 #if defined(USE_META) && defined(USE_FILEMON_ONCE) 413 if (useMeta) { 414 meta_cmd_finish(NULL); 415 } 416 #endif 417 if (status != 0) { 418 if (DEBUG(ERROR)) { 419 fprintf(debug_file, "\n*** Failed target: %s\n*** Failed command: ", 420 gn->name); 421 for (cp = cmd; *cp; ) { 422 if (isspace((unsigned char)*cp)) { 423 fprintf(debug_file, " "); 424 while (isspace((unsigned char)*cp)) 425 cp++; 426 } else { 427 fprintf(debug_file, "%c", *cp); 428 cp++; 429 } 430 } 431 fprintf(debug_file, "\n"); 432 } 433 printf("*** Error code %d", status); 434 } 435 } else { 436 status = WTERMSIG(reason); /* signaled */ 437 printf("*** Signal %d", status); 438 } 439 440 441 if (!WIFEXITED(reason) || (status != 0)) { 442 if (errCheck) { 443 #ifdef USE_META 444 if (useMeta) { 445 meta_job_error(NULL, gn, 0, status); 446 } 447 #endif 448 gn->made = ERROR; 449 if (keepgoing) { 450 /* 451 * Abort the current target, but let others 452 * continue. 453 */ 454 printf(" (continuing)\n"); 455 } else { 456 printf("\n"); 457 } 458 if (deleteOnError) { 459 CompatDeleteTarget(gn); 460 } 461 } else { 462 /* 463 * Continue executing commands for this target. 464 * If we return 0, this will happen... 465 */ 466 printf(" (ignored)\n"); 467 status = 0; 468 } 469 } 470 break; 471 } else { 472 Fatal("error in wait: %d: %s", retstat, strerror(errno)); 473 /*NOTREACHED*/ 474 } 475 } 476 free(cmdStart); 477 compatChild = 0; 478 if (compatSigno) { 479 bmake_signal(compatSigno, SIG_DFL); 480 kill(myPid, compatSigno); 481 } 482 483 return status; 484 } 485 486 /*- 487 *----------------------------------------------------------------------- 488 * Compat_Make -- 489 * Make a target. 490 * 491 * Input: 492 * gnp The node to make 493 * pgnp Parent to abort if necessary 494 * 495 * Results: 496 * 0 497 * 498 * Side Effects: 499 * If an error is detected and not being ignored, the process exits. 500 * 501 *----------------------------------------------------------------------- 502 */ 503 int 504 Compat_Make(void *gnp, void *pgnp) 505 { 506 GNode *gn = (GNode *)gnp; 507 GNode *pgn = (GNode *)pgnp; 508 509 if (!shellName) /* we came here from jobs */ 510 Shell_Init(); 511 if (gn->made == UNMADE && (gn == pgn || (pgn->type & OP_MADE) == 0)) { 512 /* 513 * First mark ourselves to be made, then apply whatever transformations 514 * the suffix module thinks are necessary. Once that's done, we can 515 * descend and make all our children. If any of them has an error 516 * but the -k flag was given, our 'make' field will be set FALSE again. 517 * This is our signal to not attempt to do anything but abort our 518 * parent as well. 519 */ 520 gn->flags |= REMAKE; 521 gn->made = BEINGMADE; 522 if ((gn->type & OP_MADE) == 0) 523 Suff_FindDeps(gn); 524 Lst_ForEach(gn->children, Compat_Make, gn); 525 if ((gn->flags & REMAKE) == 0) { 526 gn->made = ABORTED; 527 pgn->flags &= ~(unsigned)REMAKE; 528 goto cohorts; 529 } 530 531 if (Lst_FindDatum(gn->implicitParents, pgn) != NULL) { 532 char *p1; 533 Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn); 534 bmake_free(p1); 535 } 536 537 /* 538 * All the children were made ok. Now cmgn->mtime contains the 539 * modification time of the newest child, we need to find out if we 540 * exist and when we were modified last. The criteria for datedness 541 * are defined by the Make_OODate function. 542 */ 543 if (DEBUG(MAKE)) { 544 fprintf(debug_file, "Examining %s...", gn->name); 545 } 546 if (! Make_OODate(gn)) { 547 gn->made = UPTODATE; 548 if (DEBUG(MAKE)) { 549 fprintf(debug_file, "up-to-date.\n"); 550 } 551 goto cohorts; 552 } else if (DEBUG(MAKE)) { 553 fprintf(debug_file, "out-of-date.\n"); 554 } 555 556 /* 557 * If the user is just seeing if something is out-of-date, exit now 558 * to tell him/her "yes". 559 */ 560 if (queryFlag) { 561 exit(1); 562 } 563 564 /* 565 * We need to be re-made. We also have to make sure we've got a $? 566 * variable. To be nice, we also define the $> variable using 567 * Make_DoAllVar(). 568 */ 569 Make_DoAllVar(gn); 570 571 /* 572 * Alter our type to tell if errors should be ignored or things 573 * should not be printed so CompatRunCommand knows what to do. 574 */ 575 if (Targ_Ignore(gn)) { 576 gn->type |= OP_IGNORE; 577 } 578 if (Targ_Silent(gn)) { 579 gn->type |= OP_SILENT; 580 } 581 582 if (Job_CheckCommands(gn, Fatal)) { 583 /* 584 * Our commands are ok, but we still have to worry about the -t 585 * flag... 586 */ 587 if (!touchFlag || (gn->type & OP_MAKE)) { 588 curTarg = gn; 589 #ifdef USE_META 590 if (useMeta && !NoExecute(gn)) { 591 meta_job_start(NULL, gn); 592 } 593 #endif 594 Lst_ForEach(gn->commands, CompatRunCommand, gn); 595 curTarg = NULL; 596 } else { 597 Job_Touch(gn, (gn->type & OP_SILENT) != 0); 598 } 599 } else { 600 gn->made = ERROR; 601 } 602 #ifdef USE_META 603 if (useMeta && !NoExecute(gn)) { 604 if (meta_job_finish(NULL) != 0) 605 gn->made = ERROR; 606 } 607 #endif 608 609 if (gn->made != ERROR) { 610 /* 611 * If the node was made successfully, mark it so, update 612 * its modification time and timestamp all its parents. Note 613 * that for .ZEROTIME targets, the timestamping isn't done. 614 * This is to keep its state from affecting that of its parent. 615 */ 616 gn->made = MADE; 617 pgn->flags |= Make_Recheck(gn) == 0 ? FORCE : 0; 618 if (!(gn->type & OP_EXEC)) { 619 pgn->flags |= CHILDMADE; 620 Make_TimeStamp(pgn, gn); 621 } 622 } else if (keepgoing) { 623 pgn->flags &= ~(unsigned)REMAKE; 624 } else { 625 PrintOnError(gn, "\nStop."); 626 exit(1); 627 } 628 } else if (gn->made == ERROR) { 629 /* 630 * Already had an error when making this beastie. Tell the parent 631 * to abort. 632 */ 633 pgn->flags &= ~(unsigned)REMAKE; 634 } else { 635 if (Lst_FindDatum(gn->implicitParents, pgn) != NULL) { 636 char *p1; 637 const char *target = Var_Value(TARGET, gn, &p1); 638 Var_Set(IMPSRC, target != NULL ? target : "", pgn); 639 bmake_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 &= ~(unsigned)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 /* Initialize this module and start making. 669 * 670 * Input: 671 * targs The target nodes to re-create 672 */ 673 void 674 Compat_Run(Lst targs) 675 { 676 GNode *gn = NULL;/* Current root target */ 677 int errors; /* Number of targets not remade due to errors */ 678 679 if (!shellName) 680 Shell_Init(); 681 682 if (bmake_signal(SIGINT, SIG_IGN) != SIG_IGN) { 683 bmake_signal(SIGINT, CompatInterrupt); 684 } 685 if (bmake_signal(SIGTERM, SIG_IGN) != SIG_IGN) { 686 bmake_signal(SIGTERM, CompatInterrupt); 687 } 688 if (bmake_signal(SIGHUP, SIG_IGN) != SIG_IGN) { 689 bmake_signal(SIGHUP, CompatInterrupt); 690 } 691 if (bmake_signal(SIGQUIT, SIG_IGN) != SIG_IGN) { 692 bmake_signal(SIGQUIT, CompatInterrupt); 693 } 694 695 ENDNode = Targ_FindNode(".END", TARG_CREATE); 696 ENDNode->type = OP_SPECIAL; 697 /* 698 * If the user has defined a .BEGIN target, execute the commands attached 699 * to it. 700 */ 701 if (!queryFlag) { 702 gn = Targ_FindNode(".BEGIN", TARG_NOCREATE); 703 if (gn != NULL) { 704 Compat_Make(gn, gn); 705 if (gn->made == ERROR) { 706 PrintOnError(gn, "\nStop."); 707 exit(1); 708 } 709 } 710 } 711 712 /* 713 * Expand .USE nodes right now, because they can modify the structure 714 * of the tree. 715 */ 716 Make_ExpandUse(targs); 717 718 /* 719 * For each entry in the list of targets to create, call Compat_Make on 720 * it to create the thing. Compat_Make will leave the 'made' field of gn 721 * in one of several states: 722 * UPTODATE gn was already up-to-date 723 * MADE gn was recreated successfully 724 * ERROR An error occurred while gn was being created 725 * ABORTED gn was not remade because one of its inferiors 726 * could not be made due to errors. 727 */ 728 errors = 0; 729 while (!Lst_IsEmpty(targs)) { 730 gn = Lst_Dequeue(targs); 731 Compat_Make(gn, gn); 732 733 if (gn->made == UPTODATE) { 734 printf("`%s' is up to date.\n", gn->name); 735 } else if (gn->made == ABORTED) { 736 printf("`%s' not remade because of errors.\n", gn->name); 737 errors += 1; 738 } 739 } 740 741 /* 742 * If the user has defined a .END target, run its commands. 743 */ 744 if (errors == 0) { 745 Compat_Make(ENDNode, ENDNode); 746 if (gn->made == ERROR) { 747 PrintOnError(gn, "\nStop."); 748 exit(1); 749 } 750 } 751 } 752