1 /* $NetBSD: compat.c,v 1.89 2012/06/10 21:44:01 wiz 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.89 2012/06/10 21:44:01 wiz 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.89 2012/06/10 21:44:01 wiz 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 "pathnames.h" 112 113 /* 114 * The following array is used to make a fast determination of which 115 * characters are interpreted specially by the shell. If a command 116 * contains any of these characters, it is executed by the shell, not 117 * directly by us. 118 */ 119 120 static char meta[256]; 121 122 static GNode *curTarg = NULL; 123 static GNode *ENDNode; 124 static void CompatInterrupt(int); 125 126 static void 127 Compat_Init(void) 128 { 129 const char *cp; 130 131 Shell_Init(); /* setup default shell */ 132 133 for (cp = "#=|^(){};&<>*?[]:$`\\\n"; *cp != '\0'; cp++) { 134 meta[(unsigned char) *cp] = 1; 135 } 136 /* 137 * The null character serves as a sentinel in the string. 138 */ 139 meta[0] = 1; 140 } 141 142 /*- 143 *----------------------------------------------------------------------- 144 * CompatInterrupt -- 145 * Interrupt the creation of the current target and remove it if 146 * it ain't precious. 147 * 148 * Results: 149 * None. 150 * 151 * Side Effects: 152 * The target is removed and the process exits. If .INTERRUPT exists, 153 * its commands are run first WITH INTERRUPTS IGNORED.. 154 * 155 *----------------------------------------------------------------------- 156 */ 157 static void 158 CompatInterrupt(int signo) 159 { 160 GNode *gn; 161 162 if ((curTarg != NULL) && !Targ_Precious (curTarg)) { 163 char *p1; 164 char *file = Var_Value(TARGET, curTarg, &p1); 165 166 if (!noExecute && eunlink(file) != -1) { 167 Error("*** %s removed", file); 168 } 169 if (p1) 170 free(p1); 171 172 /* 173 * Run .INTERRUPT only if hit with interrupt signal 174 */ 175 if (signo == SIGINT) { 176 gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE); 177 if (gn != NULL) { 178 Compat_Make(gn, gn); 179 } 180 } 181 182 } 183 if (signo == SIGQUIT) 184 _exit(signo); 185 bmake_signal(signo, SIG_DFL); 186 kill(myPid, signo); 187 } 188 189 /*- 190 *----------------------------------------------------------------------- 191 * CompatRunCommand -- 192 * Execute the next command for a target. If the command returns an 193 * error, the node's made field is set to ERROR and creation stops. 194 * 195 * Input: 196 * cmdp Command to execute 197 * gnp Node from which the command came 198 * 199 * Results: 200 * 0 if the command succeeded, 1 if an error occurred. 201 * 202 * Side Effects: 203 * The node's 'made' field may be set to ERROR. 204 * 205 *----------------------------------------------------------------------- 206 */ 207 int 208 CompatRunCommand(void *cmdp, void *gnp) 209 { 210 char *cmdStart; /* Start of expanded command */ 211 char *cp, *bp; 212 Boolean silent, /* Don't print command */ 213 doIt; /* Execute even if -n */ 214 volatile Boolean errCheck; /* Check errors */ 215 int reason; /* Reason for child's death */ 216 int status; /* Description of child's death */ 217 pid_t cpid; /* Child actually found */ 218 pid_t retstat; /* Result of wait */ 219 LstNode cmdNode; /* Node where current command is located */ 220 const char ** volatile av; /* Argument vector for thing to exec */ 221 char ** volatile mav;/* Copy of the argument vector for freeing */ 222 int argc; /* Number of arguments in av or 0 if not 223 * dynamically allocated */ 224 Boolean local; /* TRUE if command should be executed 225 * locally */ 226 Boolean useShell; /* TRUE if command should be executed 227 * using a shell */ 228 char * volatile cmd = (char *)cmdp; 229 GNode *gn = (GNode *)gnp; 230 231 silent = gn->type & OP_SILENT; 232 errCheck = !(gn->type & OP_IGNORE); 233 doIt = FALSE; 234 235 cmdNode = Lst_Member(gn->commands, cmd); 236 cmdStart = Var_Subst(NULL, cmd, gn, FALSE); 237 238 /* 239 * brk_string will return an argv with a NULL in av[0], thus causing 240 * execvp to choke and die horribly. Besides, how can we execute a null 241 * command? In any case, we warn the user that the command expanded to 242 * nothing (is this the right thing to do?). 243 */ 244 245 if (*cmdStart == '\0') { 246 free(cmdStart); 247 Error("%s expands to empty string", cmd); 248 return(0); 249 } 250 cmd = cmdStart; 251 Lst_Replace(cmdNode, cmdStart); 252 253 if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) { 254 (void)Lst_AtEnd(ENDNode->commands, cmdStart); 255 return(0); 256 } 257 if (strcmp(cmdStart, "...") == 0) { 258 gn->type |= OP_SAVE_CMDS; 259 return(0); 260 } 261 262 while ((*cmd == '@') || (*cmd == '-') || (*cmd == '+')) { 263 switch (*cmd) { 264 case '@': 265 silent = DEBUG(LOUD) ? FALSE : TRUE; 266 break; 267 case '-': 268 errCheck = FALSE; 269 break; 270 case '+': 271 doIt = TRUE; 272 if (!meta[0]) /* we came here from jobs */ 273 Compat_Init(); 274 break; 275 } 276 cmd++; 277 } 278 279 while (isspace((unsigned char)*cmd)) 280 cmd++; 281 282 /* 283 * If we did not end up with a command, just skip it. 284 */ 285 if (!*cmd) 286 return (0); 287 288 #if !defined(MAKE_NATIVE) 289 /* 290 * In a non-native build, the host environment might be weird enough 291 * that it's necessary to go through a shell to get the correct 292 * behaviour. Or perhaps the shell has been replaced with something 293 * that does extra logging, and that should not be bypassed. 294 */ 295 useShell = TRUE; 296 #else 297 /* 298 * Search for meta characters in the command. If there are no meta 299 * characters, there's no need to execute a shell to execute the 300 * command. 301 */ 302 for (cp = cmd; !meta[(unsigned char)*cp]; cp++) { 303 continue; 304 } 305 useShell = (*cp != '\0'); 306 #endif 307 308 /* 309 * Print the command before echoing if we're not supposed to be quiet for 310 * this one. We also print the command if -n given. 311 */ 312 if (!silent || NoExecute(gn)) { 313 printf("%s\n", cmd); 314 fflush(stdout); 315 } 316 317 /* 318 * If we're not supposed to execute any commands, this is as far as 319 * we go... 320 */ 321 if (!doIt && NoExecute(gn)) { 322 return (0); 323 } 324 if (DEBUG(JOB)) 325 fprintf(debug_file, "Execute: '%s'\n", cmd); 326 327 again: 328 if (useShell) { 329 /* 330 * We need to pass the command off to the shell, typically 331 * because the command contains a "meta" character. 332 */ 333 static const char *shargv[4]; 334 335 shargv[0] = shellPath; 336 /* 337 * The following work for any of the builtin shell specs. 338 */ 339 if (DEBUG(SHELL)) 340 shargv[1] = "-xc"; 341 else 342 shargv[1] = "-c"; 343 shargv[2] = cmd; 344 shargv[3] = NULL; 345 av = shargv; 346 argc = 0; 347 bp = NULL; 348 mav = NULL; 349 } else { 350 /* 351 * No meta-characters, so no need to exec a shell. Break the command 352 * into words to form an argument vector we can execute. 353 */ 354 mav = brk_string(cmd, &argc, TRUE, &bp); 355 if (mav == NULL) { 356 useShell = 1; 357 goto again; 358 } 359 av = (void *)mav; 360 } 361 362 local = TRUE; 363 364 #ifdef USE_META 365 if (useMeta) { 366 meta_compat_start(); 367 } 368 #endif 369 370 /* 371 * Fork and execute the single command. If the fork fails, we abort. 372 */ 373 cpid = vFork(); 374 if (cpid < 0) { 375 Fatal("Could not fork"); 376 } 377 if (cpid == 0) { 378 Check_Cwd(av); 379 Var_ExportVars(); 380 #ifdef USE_META 381 if (useMeta) { 382 meta_compat_child(); 383 } 384 #endif 385 if (local) 386 (void)execvp(av[0], (char *const *)UNCONST(av)); 387 else 388 (void)execv(av[0], (char *const *)UNCONST(av)); 389 execError("exec", av[0]); 390 _exit(1); 391 } 392 if (mav) 393 free(mav); 394 if (bp) 395 free(bp); 396 Lst_Replace(cmdNode, NULL); 397 398 #ifdef USE_META 399 if (useMeta) { 400 meta_compat_parent(); 401 } 402 #endif 403 404 /* 405 * The child is off and running. Now all we can do is wait... 406 */ 407 while (1) { 408 409 while ((retstat = wait(&reason)) != cpid) { 410 if (retstat > 0) 411 JobReapChild(retstat, reason, FALSE); /* not ours? */ 412 if (retstat == -1 && errno != EINTR) { 413 break; 414 } 415 } 416 417 if (retstat > -1) { 418 if (WIFSTOPPED(reason)) { 419 status = WSTOPSIG(reason); /* stopped */ 420 } else if (WIFEXITED(reason)) { 421 status = WEXITSTATUS(reason); /* exited */ 422 #if defined(USE_META) && defined(USE_FILEMON_ONCE) 423 if (useMeta) { 424 meta_cmd_finish(NULL); 425 } 426 #endif 427 if (status != 0) { 428 if (DEBUG(ERROR)) { 429 fprintf(debug_file, "\n*** Failed target: %s\n*** Failed command: ", 430 gn->name); 431 for (cp = cmd; *cp; ) { 432 if (isspace((unsigned char)*cp)) { 433 fprintf(debug_file, " "); 434 while (isspace((unsigned char)*cp)) 435 cp++; 436 } else { 437 fprintf(debug_file, "%c", *cp); 438 cp++; 439 } 440 } 441 fprintf(debug_file, "\n"); 442 } 443 printf("*** Error code %d", status); 444 } 445 } else { 446 status = WTERMSIG(reason); /* signaled */ 447 printf("*** Signal %d", status); 448 } 449 450 451 if (!WIFEXITED(reason) || (status != 0)) { 452 if (errCheck) { 453 #ifdef USE_META 454 if (useMeta) { 455 meta_job_error(NULL, gn, 0, status); 456 } 457 #endif 458 gn->made = ERROR; 459 if (keepgoing) { 460 /* 461 * Abort the current target, but let others 462 * continue. 463 */ 464 printf(" (continuing)\n"); 465 } 466 } else { 467 /* 468 * Continue executing commands for this target. 469 * If we return 0, this will happen... 470 */ 471 printf(" (ignored)\n"); 472 status = 0; 473 } 474 } 475 break; 476 } else { 477 Fatal("error in wait: %d: %s", retstat, strerror(errno)); 478 /*NOTREACHED*/ 479 } 480 } 481 free(cmdStart); 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 (!meta[0]) /* we came here from jobs */ 510 Compat_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 &= ~REMAKE; 528 goto cohorts; 529 } 530 531 if (Lst_Member(gn->iParents, pgn) != NULL) { 532 char *p1; 533 Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0); 534 if (p1) 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 meta_job_finish(NULL); 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 &= ~REMAKE; 624 } else { 625 PrintOnError(gn, "\n\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 &= ~REMAKE; 634 } else { 635 if (Lst_Member(gn->iParents, pgn) != NULL) { 636 char *p1; 637 Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0); 638 if (p1) 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 Compat_Init(); 691 692 if (bmake_signal(SIGINT, SIG_IGN) != SIG_IGN) { 693 bmake_signal(SIGINT, CompatInterrupt); 694 } 695 if (bmake_signal(SIGTERM, SIG_IGN) != SIG_IGN) { 696 bmake_signal(SIGTERM, CompatInterrupt); 697 } 698 if (bmake_signal(SIGHUP, SIG_IGN) != SIG_IGN) { 699 bmake_signal(SIGHUP, CompatInterrupt); 700 } 701 if (bmake_signal(SIGQUIT, SIG_IGN) != SIG_IGN) { 702 bmake_signal(SIGQUIT, CompatInterrupt); 703 } 704 705 ENDNode = Targ_FindNode(".END", TARG_CREATE); 706 ENDNode->type = OP_SPECIAL; 707 /* 708 * If the user has defined a .BEGIN target, execute the commands attached 709 * to it. 710 */ 711 if (!queryFlag) { 712 gn = Targ_FindNode(".BEGIN", TARG_NOCREATE); 713 if (gn != NULL) { 714 Compat_Make(gn, gn); 715 if (gn->made == ERROR) { 716 PrintOnError(gn, "\n\nStop."); 717 exit(1); 718 } 719 } 720 } 721 722 /* 723 * Expand .USE nodes right now, because they can modify the structure 724 * of the tree. 725 */ 726 Make_ExpandUse(targs); 727 728 /* 729 * For each entry in the list of targets to create, call Compat_Make on 730 * it to create the thing. Compat_Make will leave the 'made' field of gn 731 * in one of several states: 732 * UPTODATE gn was already up-to-date 733 * MADE gn was recreated successfully 734 * ERROR An error occurred while gn was being created 735 * ABORTED gn was not remade because one of its inferiors 736 * could not be made due to errors. 737 */ 738 errors = 0; 739 while (!Lst_IsEmpty (targs)) { 740 gn = (GNode *)Lst_DeQueue(targs); 741 Compat_Make(gn, gn); 742 743 if (gn->made == UPTODATE) { 744 printf("`%s' is up to date.\n", gn->name); 745 } else if (gn->made == ABORTED) { 746 printf("`%s' not remade because of errors.\n", gn->name); 747 errors += 1; 748 } 749 } 750 751 /* 752 * If the user has defined a .END target, run its commands. 753 */ 754 if (errors == 0) { 755 Compat_Make(ENDNode, ENDNode); 756 if (gn->made == ERROR) { 757 PrintOnError(gn, "\n\nStop."); 758 exit(1); 759 } 760 } 761 } 762