main.c (143960) | main.c (144020) |
---|---|
1/*- 2 * Copyright (c) 1988, 1989, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * Copyright (c) 1989 by Berkeley Softworks 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Adam de Boor. --- 32 unchanged lines hidden (view full) --- 41#ifndef lint 42#if 0 43static char copyright[] = 44"@(#) Copyright (c) 1988, 1989, 1990, 1993\n\ 45 The Regents of the University of California. All rights reserved.\n"; 46#endif 47#endif /* not lint */ 48#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1988, 1989, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * Copyright (c) 1989 by Berkeley Softworks 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Adam de Boor. --- 32 unchanged lines hidden (view full) --- 41#ifndef lint 42#if 0 43static char copyright[] = 44"@(#) Copyright (c) 1988, 1989, 1990, 1993\n\ 45 The Regents of the University of California. All rights reserved.\n"; 46#endif 47#endif /* not lint */ 48#include <sys/cdefs.h> |
49__FBSDID("$FreeBSD: head/usr.bin/make/main.c 143960 2005-03-22 07:56:22Z harti $"); | 49__FBSDID("$FreeBSD: head/usr.bin/make/main.c 144020 2005-03-23 12:56:15Z harti $"); |
50 51/*- 52 * main.c -- 53 * The main file for this entire program. Exit routines etc 54 * reside here. 55 * 56 * Utility functions defined in this file: 57 * Main_ParseArgLine Takes a line of arguments, breaks them and --- 4 unchanged lines hidden (view full) --- 62 63#ifndef MACHINE 64#include <sys/utsname.h> 65#endif 66#include <sys/param.h> 67#include <sys/stat.h> 68#include <sys/sysctl.h> 69#include <sys/time.h> | 50 51/*- 52 * main.c -- 53 * The main file for this entire program. Exit routines etc 54 * reside here. 55 * 56 * Utility functions defined in this file: 57 * Main_ParseArgLine Takes a line of arguments, breaks them and --- 4 unchanged lines hidden (view full) --- 62 63#ifndef MACHINE 64#include <sys/utsname.h> 65#endif 66#include <sys/param.h> 67#include <sys/stat.h> 68#include <sys/sysctl.h> 69#include <sys/time.h> |
70#include <sys/queue.h> |
|
70#include <sys/resource.h> 71#include <sys/wait.h> 72#include <err.h> 73#include <errno.h> 74#include <signal.h> 75#include <stdlib.h> 76#include <string.h> 77#include <unistd.h> --- 227 unchanged lines hidden (view full) --- 305 MFLAGS_append("-j", optarg); 306 break; 307 } 308 case 'k': 309 keepgoing = TRUE; 310 MFLAGS_append("-k", NULL); 311 break; 312 case 'm': | 71#include <sys/resource.h> 72#include <sys/wait.h> 73#include <err.h> 74#include <errno.h> 75#include <signal.h> 76#include <stdlib.h> 77#include <string.h> 78#include <unistd.h> --- 227 unchanged lines hidden (view full) --- 306 MFLAGS_append("-j", optarg); 307 break; 308 } 309 case 'k': 310 keepgoing = TRUE; 311 MFLAGS_append("-k", NULL); 312 break; 313 case 'm': |
313 Dir_AddDir(&sysIncPath, optarg); | 314 Path_AddDir(&sysIncPath, optarg); |
314 MFLAGS_append("-m", optarg); 315 break; 316 case 'n': 317 noExecute = TRUE; 318 MFLAGS_append("-n", NULL); 319 break; 320 case 'q': 321 queryFlag = TRUE; --- 376 unchanged lines hidden (view full) --- 698 } 699 else { 700 snprintf(mdpath, MAXPATHLEN, "%s%s", pathp, curdir); 701 if (!(objdir = chdir_verify_path(mdpath, obpath))) 702 objdir = curdir; 703 } 704 Dir_InitDot(); /* Initialize the "." directory */ 705 if (objdir != curdir) | 315 MFLAGS_append("-m", optarg); 316 break; 317 case 'n': 318 noExecute = TRUE; 319 MFLAGS_append("-n", NULL); 320 break; 321 case 'q': 322 queryFlag = TRUE; --- 376 unchanged lines hidden (view full) --- 699 } 700 else { 701 snprintf(mdpath, MAXPATHLEN, "%s%s", pathp, curdir); 702 if (!(objdir = chdir_verify_path(mdpath, obpath))) 703 objdir = curdir; 704 } 705 Dir_InitDot(); /* Initialize the "." directory */ 706 if (objdir != curdir) |
706 Dir_AddDir(&dirSearchPath, curdir); | 707 Path_AddDir(&dirSearchPath, curdir); |
707 Var_Set(".CURDIR", curdir, VAR_GLOBAL); 708 Var_Set(".OBJDIR", objdir, VAR_GLOBAL); 709 710 if (getenv("MAKE_JOBS_FIFO") != NULL) 711 forceJobs = TRUE; 712 /* 713 * Be compatible if user did not specify -j and did not explicitly 714 * turned compatibility on --- 29 unchanged lines hidden (view full) --- 744 Var_Set(".TARGETS", "", VAR_GLOBAL); 745 746 747 /* 748 * If no user-supplied system path was given (through the -m option) 749 * add the directories from the DEFSYSPATH (more than one may be given 750 * as dir1:...:dirn) to the system include path. 751 */ | 708 Var_Set(".CURDIR", curdir, VAR_GLOBAL); 709 Var_Set(".OBJDIR", objdir, VAR_GLOBAL); 710 711 if (getenv("MAKE_JOBS_FIFO") != NULL) 712 forceJobs = TRUE; 713 /* 714 * Be compatible if user did not specify -j and did not explicitly 715 * turned compatibility on --- 29 unchanged lines hidden (view full) --- 745 Var_Set(".TARGETS", "", VAR_GLOBAL); 746 747 748 /* 749 * If no user-supplied system path was given (through the -m option) 750 * add the directories from the DEFSYSPATH (more than one may be given 751 * as dir1:...:dirn) to the system include path. 752 */ |
752 if (Lst_IsEmpty(&sysIncPath)) { | 753 if (TAILQ_EMPTY(&sysIncPath)) { |
753 for (start = syspath; *start != '\0'; start = cp) { 754 for (cp = start; *cp != '\0' && *cp != ':'; cp++) 755 continue; 756 if (*cp == '\0') { | 754 for (start = syspath; *start != '\0'; start = cp) { 755 for (cp = start; *cp != '\0' && *cp != ':'; cp++) 756 continue; 757 if (*cp == '\0') { |
757 Dir_AddDir(&sysIncPath, start); | 758 Path_AddDir(&sysIncPath, start); |
758 } else { 759 *cp++ = '\0'; | 759 } else { 760 *cp++ = '\0'; |
760 Dir_AddDir(&sysIncPath, start); | 761 Path_AddDir(&sysIncPath, start); |
761 } 762 } 763 } 764 765 /* 766 * Read in the built-in rules first, followed by the specified 767 * makefile, if it was (makefile != (char *) NULL), or the default 768 * Makefile and makefile, in that order, if it wasn't. 769 */ 770 if (!noBuiltins) { 771 /* Path of sys.mk */ 772 Lst sysMkPath = Lst_Initializer(sysMkPath); 773 LstNode *ln; 774 | 762 } 763 } 764 } 765 766 /* 767 * Read in the built-in rules first, followed by the specified 768 * makefile, if it was (makefile != (char *) NULL), or the default 769 * Makefile and makefile, in that order, if it wasn't. 770 */ 771 if (!noBuiltins) { 772 /* Path of sys.mk */ 773 Lst sysMkPath = Lst_Initializer(sysMkPath); 774 LstNode *ln; 775 |
775 Dir_Expand(PATH_DEFSYSMK, &sysIncPath, &sysMkPath); | 776 Path_Expand(PATH_DEFSYSMK, &sysIncPath, &sysMkPath); |
776 if (Lst_IsEmpty(&sysMkPath)) 777 Fatal("make: no system rules (%s).", PATH_DEFSYSMK); 778 LST_FOREACH(ln, &sysMkPath) { 779 if (!ReadMakefile(Lst_Datum(ln))) 780 break; 781 } 782 if (ln != NULL) 783 Fatal("make: cannot open %s.", (char *)Lst_Datum(ln)); --- 46 unchanged lines hidden (view full) --- 830 for (ptr = vpath; *ptr != ':' && *ptr != '\0'; ptr++) 831 ; 832 833 /* Save terminator character so know when to stop */ 834 savec = *ptr; 835 *ptr = '\0'; 836 837 /* Add directory to search path */ | 777 if (Lst_IsEmpty(&sysMkPath)) 778 Fatal("make: no system rules (%s).", PATH_DEFSYSMK); 779 LST_FOREACH(ln, &sysMkPath) { 780 if (!ReadMakefile(Lst_Datum(ln))) 781 break; 782 } 783 if (ln != NULL) 784 Fatal("make: cannot open %s.", (char *)Lst_Datum(ln)); --- 46 unchanged lines hidden (view full) --- 831 for (ptr = vpath; *ptr != ':' && *ptr != '\0'; ptr++) 832 ; 833 834 /* Save terminator character so know when to stop */ 835 savec = *ptr; 836 *ptr = '\0'; 837 838 /* Add directory to search path */ |
838 Dir_AddDir(&dirSearchPath, vpath); | 839 Path_AddDir(&dirSearchPath, vpath); |
839 840 vpath = ptr + 1; 841 } while (savec != '\0'); 842 843 Buf_Destroy(buf, TRUE); 844 } 845 846 /* --- 162 unchanged lines hidden (view full) --- 1009 } 1010 } else { 1011 MAKEFILE = fname; 1012 if ((stream = fopen(fname, "r")) != NULL) 1013 goto found; 1014 } 1015#endif 1016 /* look in -I and system include directories. */ | 840 841 vpath = ptr + 1; 842 } while (savec != '\0'); 843 844 Buf_Destroy(buf, TRUE); 845 } 846 847 /* --- 162 unchanged lines hidden (view full) --- 1010 } 1011 } else { 1012 MAKEFILE = fname; 1013 if ((stream = fopen(fname, "r")) != NULL) 1014 goto found; 1015 } 1016#endif 1017 /* look in -I and system include directories. */ |
1017 name = Dir_FindFile(fname, &parseIncPath); | 1018 name = Path_FindFile(fname, &parseIncPath); |
1018 if (!name) | 1019 if (!name) |
1019 name = Dir_FindFile(fname, &sysIncPath); | 1020 name = Path_FindFile(fname, &sysIncPath); |
1020 if (!name || !(stream = fopen(name, "r"))) 1021 return (FALSE); 1022 MAKEFILE = fname = name; 1023 /* 1024 * set the MAKEFILE variable desired by System V fans -- the 1025 * placement of the setting here means it gets set to the last 1026 * makefile specified, as it is set by SysV make. 1027 */ --- 130 unchanged lines hidden --- | 1021 if (!name || !(stream = fopen(name, "r"))) 1022 return (FALSE); 1023 MAKEFILE = fname = name; 1024 /* 1025 * set the MAKEFILE variable desired by System V fans -- the 1026 * placement of the setting here means it gets set to the last 1027 * makefile specified, as it is set by SysV make. 1028 */ --- 130 unchanged lines hidden --- |