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
7 * This code is derived from software contributed to Berkeley by
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
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. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * @(#)main.c 8.3 (Berkeley) 3/19/94
43 static char copyright[] =
44 "@(#) Copyright (c) 1988, 1989, 1990, 1993\n\
45 The Regents of the University of California. All rights reserved.\n";
48 #include <sys/cdefs.h>
49 __FBSDID("$FreeBSD$");
53 * The main file for this entire program. Exit routines etc
56 * Utility functions defined in this file:
58 * Takes a line of arguments, breaks them and
59 * treats them as if they were given when first
60 * invoked. Used by the parse module to implement
65 #include <sys/utsname.h>
67 #include <sys/param.h>
69 #include <sys/sysctl.h>
71 #include <sys/queue.h>
72 #include <sys/resource.h>
88 #include "pathnames.h"
96 extern char **environ; /* XXX what header declares this variable? */
98 #define WANT_ENV_MKLVL 1
99 #define MKLVL_MAXVAL 500
100 #define MKLVL_ENVVAR "__MKLVL__"
102 /* ordered list of makefiles to read */
103 static Lst makefiles = Lst_Initializer(makefiles);
105 /* list of variables to print */
106 static Lst variables = Lst_Initializer(variables);
108 static Boolean expandVars; /* fully expand printed variables */
109 static Boolean noBuiltins; /* -r flag */
110 static Boolean forceJobs; /* -j argument given */
111 static char *curdir; /* startup directory */
112 static char *objdir; /* where we chdir'ed to */
114 /* (-E) vars to override from env */
115 Lst envFirstVars = Lst_Initializer(envFirstVars);
117 /* Targets to be made */
118 Lst create = Lst_Initializer(create);
120 Boolean allPrecious; /* .PRECIOUS given on line by itself */
121 Boolean beSilent; /* -s flag */
122 Boolean beVerbose; /* -v flag */
123 Boolean compatMake; /* -B argument */
124 Boolean debug; /* -d flag */
125 Boolean ignoreErrors; /* -i flag */
126 int jobLimit; /* -j argument */
127 Boolean jobsRunning; /* TRUE if the jobs might be running */
128 Boolean keepgoing; /* -k flag */
129 Boolean noExecute; /* -n flag */
130 Boolean queryFlag; /* -q flag */
131 Boolean touchFlag; /* -t flag */
132 Boolean usePipes; /* !-P flag */
133 uint32_t warn_cmd; /* command line warning flags */
134 uint32_t warn_flags; /* actual warning flags */
135 uint32_t warn_nocmd; /* command line no-warning flags */
137 time_t now; /* Time at start of make */
138 struct GNode *DEFAULT; /* .DEFAULT node */
141 * Exit with usage message.
147 "usage: make [-BPSXeiknqrstv] [-C directory] [-D variable]\n"
148 "\t[-d flags] [-E variable] [-f makefile] [-I directory]\n"
149 "\t[-j max_jobs] [-m directory] [-V variable]\n"
150 "\t[variable=value] [target ...]\n");
156 * Append a flag with an optional argument to MAKEFLAGS and MFLAGS
159 MFLAGS_append(const char *flag, char *arg)
163 Var_Append(".MAKEFLAGS", flag, VAR_GLOBAL);
165 str = MAKEFLAGS_quote(arg);
166 Var_Append(".MAKEFLAGS", str, VAR_GLOBAL);
170 Var_Append("MFLAGS", flag, VAR_GLOBAL);
172 str = MAKEFLAGS_quote(arg);
173 Var_Append("MFLAGS", str, VAR_GLOBAL);
181 * Handle argument to warning option.
184 Main_ParseWarn(const char *arg, int iscmd)
188 static const struct {
192 { "dirsyntax", WARN_DIRSYNTAX },
197 if (arg[0] == 'n' && arg[1] == 'o') {
202 for (i = 0; options[i].option != NULL; i++)
203 if (strcmp(arg, options[i].option) == 0)
206 if (options[i].option == NULL)
212 warn_cmd |= options[i].flag;
213 warn_nocmd &= ~options[i].flag;
214 warn_flags |= options[i].flag;
216 warn_nocmd |= options[i].flag;
217 warn_cmd &= ~options[i].flag;
218 warn_flags &= ~options[i].flag;
222 warn_flags |= (options[i].flag & ~warn_nocmd);
224 warn_flags &= ~(options[i].flag | warn_cmd);
231 * Open and parse the given makefile.
234 * TRUE if ok. FALSE if couldn't open file.
237 ReadMakefile(const char p[])
239 char *fname; /* makefile to read */
241 char *name, path[MAXPATHLEN];
245 /* XXX - remove this once constification is done */
248 if (!strcmp(fname, "-")) {
249 Parse_File("(stdin)", stdin);
250 Var_SetGlobal("MAKEFILE", "");
252 setMAKEFILE = strcmp(fname, ".depend");
254 /* if we've chdir'd, rebuild the path name */
255 if (curdir != objdir && *fname != '/') {
256 snprintf(path, MAXPATHLEN, "%s/%s", curdir, fname);
258 * XXX The realpath stuff breaks relative includes
259 * XXX in some cases. The problem likely is in
260 * XXX parse.c where it does special things in
261 * XXX ParseDoInclude if the file is relateive
262 * XXX or absolute and not a system file. There
263 * XXX it assumes that if the current file that's
264 * XXX being included is absolute, that any files
265 * XXX that it includes shouldn't do the -I path
266 * XXX stuff, which is inconsistant with historical
267 * XXX behavior. However, I can't pentrate the mists
268 * XXX further, so I'm putting this workaround in
269 * XXX here until such time as the underlying bug
272 #if THIS_BREAKS_THINGS
273 if (realpath(path, path) != NULL &&
274 (stream = fopen(path, "r")) != NULL) {
279 } else if (realpath(fname, path) != NULL) {
282 if ((stream = fopen(fname, "r")) != NULL)
286 if ((stream = fopen(path, "r")) != NULL) {
293 if ((stream = fopen(fname, "r")) != NULL)
297 /* look in -I and system include directories. */
298 name = Path_FindFile(fname, &parseIncPath);
300 name = Path_FindFile(fname, &sysIncPath);
301 if (!name || !(stream = fopen(name, "r")))
303 MAKEFILE = fname = name;
305 * set the MAKEFILE variable desired by System V fans -- the
306 * placement of the setting here means it gets set to the last
307 * makefile specified, as it is set by SysV make.
311 Var_SetGlobal("MAKEFILE", MAKEFILE);
312 Parse_File(fname, stream);
320 * Parse a given argument vector. Called from main() and from
321 * Main_ParseArgLine() when the .MAKEFLAGS target is used.
323 * XXX: Deal with command line overriding .MAKEFLAGS in makefile
326 * Various global and local flags will be set depending on the flags
330 MainParseArgs(int argc, char **argv)
333 Boolean found_dd = FALSE;
336 optind = 1; /* since we're called more than once */
338 #define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nqrstvx:"
340 if ((optind < argc) && strcmp(argv[optind], "--") == 0) {
343 if ((c = getopt(argc, argv, OPTFLAGS)) == -1) {
350 MFLAGS_append("-A", NULL);
353 if (chdir(optarg) == -1)
354 err(1, "chdir %s", optarg);
357 Var_SetGlobal(optarg, "1");
358 MFLAGS_append("-D", optarg);
361 Parse_AddIncludeDir(optarg);
362 MFLAGS_append("-I", optarg);
365 Lst_AtEnd(&variables, estrdup(optarg));
366 MFLAGS_append("-V", optarg);
373 MFLAGS_append("-B", NULL);
374 unsetenv("MAKE_JOBS_FIFO");
378 MFLAGS_append("-P", NULL);
382 MFLAGS_append("-S", NULL);
385 char *modules = optarg;
387 for (; *modules; ++modules)
405 if (modules[1] == '1') {
406 debug |= DEBUG_GRAPH1;
409 else if (modules[1] == '2') {
410 debug |= DEBUG_GRAPH2;
433 warnx("illegal argument to d option "
437 MFLAGS_append("-d", optarg);
441 Lst_AtEnd(&envFirstVars, estrdup(optarg));
442 MFLAGS_append("-E", optarg);
445 checkEnvFirst = TRUE;
446 MFLAGS_append("-e", NULL);
449 Lst_AtEnd(&makefiles, estrdup(optarg));
453 MFLAGS_append("-i", NULL);
459 jobLimit = strtol(optarg, &endptr, 10);
460 if (jobLimit <= 0 || *endptr != '\0') {
461 warnx("illegal number, -j argument -- %s",
465 MFLAGS_append("-j", optarg);
470 MFLAGS_append("-k", NULL);
473 Path_AddDir(&sysIncPath, optarg);
474 MFLAGS_append("-m", optarg);
478 MFLAGS_append("-n", NULL);
482 /* Kind of nonsensical, wot? */
483 MFLAGS_append("-q", NULL);
487 MFLAGS_append("-r", NULL);
491 MFLAGS_append("-s", NULL);
495 MFLAGS_append("-t", NULL);
499 MFLAGS_append("-v", NULL);
502 if (Main_ParseWarn(optarg, 1) != -1)
503 MFLAGS_append("-x", optarg);
517 * Parse the rest of the arguments.
518 * o Check for variable assignments and perform them if so.
519 * o Check for more flags and restart getopt if so.
520 * o Anything else is taken to be a target and added
521 * to the end of the "create" list.
523 for (; *argv != NULL; ++argv, --argc) {
524 if (Parse_IsVar(*argv)) {
525 char *ptr = MAKEFLAGS_quote(*argv);
527 Var_Append(".MAKEFLAGS", ptr, VAR_GLOBAL);
528 Parse_DoVar(*argv, VAR_CMD);
531 } else if ((*argv)[0] == '-') {
532 if ((*argv)[1] == '\0') {
534 * (*argv) is a single dash, so we
537 } else if (found_dd) {
539 * Double dash has been found, ignore
540 * any more options. But what do we do
541 * with it? For now treat it like a target.
543 Lst_AtEnd(&create, estrdup(*argv));
546 * (*argv) is a -flag, so backup argv and
547 * argc. getopt() expects options to start
548 * in the 2nd position.
555 } else if ((*argv)[0] == '\0') {
556 Punt("illegal (null) argument.");
559 Lst_AtEnd(&create, estrdup(*argv));
566 * Used by the parse module when a .MFLAGS or .MAKEFLAGS target
567 * is encountered and by main() when reading the .MAKEFLAGS envariable.
568 * Takes a line of arguments and breaks it into its
569 * component words and passes those words and the number of them to the
570 * MainParseArgs function.
571 * The line should have all its leading whitespace removed.
574 * Only those that come from the various arguments.
577 Main_ParseArgLine(char *line, int mflags)
583 for (; *line == ' '; ++line)
589 MAKEFLAGS_break(&aa, line);
591 brk_string(&aa, line, TRUE);
593 MainParseArgs(aa.argc, aa.argv);
598 chdir_verify_path(const char *path, char *obpath)
602 if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) {
603 if (chdir(path) == -1 || getcwd(obpath, MAXPATHLEN) == NULL) {
604 warn("warning: %s", path);
614 * In lieu of a good way to prevent every possible looping in make(1), stop
615 * there from being more than MKLVL_MAXVAL processes forked by make(1), to
616 * prevent a forkbomb from happening, in a dumb and mechanical way.
619 * Creates or modifies enviornment variable MKLVL_ENVVAR via setenv().
622 check_make_level(void)
624 #ifdef WANT_ENV_MKLVL
625 char *value = getenv(MKLVL_ENVVAR);
626 int level = (value == NULL) ? 0 : atoi(value);
629 errc(2, EAGAIN, "Invalid value for recursion level (%d).",
631 } else if (level > MKLVL_MAXVAL) {
632 errc(2, EAGAIN, "Max recursion level (%d) exceeded.",
636 sprintf(new_value, "%d", level + 1);
637 setenv(MKLVL_ENVVAR, new_value, 1);
639 #endif /* WANT_ENV_MKLVL */
644 * The main function, for obvious reasons. Initializes variables
645 * and a few modules, then parses the arguments give it in the
646 * environment and on the command line. Reads the system makefile
647 * followed by either Makefile, makefile or the file given by the
648 * -f argument. Sets the .MAKEFLAGS PMake variable based on all the
649 * flags it has received by then uses either the Make or the Compat
650 * module to create the initial list of targets.
653 * If -q was given, exits -1 if anything was out-of-date. Else it exits
657 * The program exits when done. Targets are created. etc. etc. etc.
660 main(int argc, char **argv)
663 const char *machine_arch;
664 const char *machine_cpu;
665 Boolean outOfDate = TRUE; /* FALSE if all targets up to date */
669 char mdpath[MAXPATHLEN];
670 char obpath[MAXPATHLEN];
671 char cdpath[MAXPATHLEN];
672 char *cp = NULL, *start;
675 * Initialize file global variables.
678 noBuiltins = FALSE; /* Read the built-in rules */
679 forceJobs = FALSE; /* No -j flag */
683 * Initialize program global variables.
685 beSilent = FALSE; /* Print commands as executed */
686 ignoreErrors = FALSE; /* Pay attention to non-zero returns */
687 noExecute = FALSE; /* Execute all commands */
688 keepgoing = FALSE; /* Stop on error */
689 allPrecious = FALSE; /* Remove targets when interrupted */
690 queryFlag = FALSE; /* This is not just a check-run */
691 touchFlag = FALSE; /* Actually update targets */
692 usePipes = TRUE; /* Catch child output in pipes */
693 debug = 0; /* No debug verbosity, please. */
696 jobLimit = DEFMAXJOBS;
697 compatMake = FALSE; /* No compat mode */
703 * get rid of resource limit on file descriptors
707 if (getrlimit(RLIMIT_NOFILE, &rl) == -1) {
710 rl.rlim_cur = rl.rlim_max;
711 if (setrlimit(RLIMIT_NOFILE, &rl) == -1) {
718 * PC-98 kernel sets the `i386' string to the utsname.machine and
719 * it cannot be distinguished from IBM-PC by uname(3). Therefore,
720 * we check machine.ispc98 and adjust the machine variable before
721 * using usname(3) below.
722 * NOTE: machdep.ispc98 was defined on 1998/8/31. At that time,
723 * __FreeBSD_version was defined as 300003. So, this check can
724 * safely be done with any kernel with version > 300003.
726 if ((machine = getenv("MACHINE")) == NULL) {
730 len = sizeof(ispc98);
731 if (!sysctlbyname("machdep.ispc98", &ispc98, &len, NULL, 0)) {
738 * Get the name of this type of MACHINE from utsname
739 * so we can share an executable for similar machines.
740 * (i.e. m68k: amiga hp300, mac68k, sun3, ...)
742 * Note that while MACHINE is decided at run-time,
743 * MACHINE_ARCH is always known at compile time.
745 if (machine == NULL) {
749 static struct utsname utsname;
751 if (uname(&utsname) == -1)
753 machine = utsname.machine;
757 if ((machine_arch = getenv("MACHINE_ARCH")) == NULL) {
759 machine_arch = MACHINE_ARCH;
761 machine_arch = "unknown";
766 * Set machine_cpu to the minumum supported CPU revision based
767 * on the target architecture, if not already set.
769 if ((machine_cpu = getenv("MACHINE_CPU")) == NULL) {
770 if (!strcmp(machine_arch, "i386"))
771 machine_cpu = "i386";
772 else if (!strcmp(machine_arch, "alpha"))
775 machine_cpu = "unknown";
779 * Initialize the parsing, directory and variable modules to prepare
780 * for the reading of inclusion paths and variable settings on the
785 Dir_Init(); /* Initialize directory structures so -I flags
786 * can be processed correctly */
787 Var_Init(environ); /* As well as the lists of variables for
788 * parsing arguments */
791 * Initialize the Shell so that we have a shell for != assignments
792 * on the command line.
797 * Initialize various variables.
798 * MAKE also gets this name, for compatibility
799 * .MAKEFLAGS gets set to the empty string just in case.
800 * MFLAGS also gets initialized empty, for compatibility.
802 Var_SetGlobal("MAKE", argv[0]);
803 Var_SetGlobal(".MAKEFLAGS", "");
804 Var_SetGlobal("MFLAGS", "");
805 Var_SetGlobal("MACHINE", machine);
806 Var_SetGlobal("MACHINE_ARCH", machine_arch);
807 Var_SetGlobal("MACHINE_CPU", machine_cpu);
809 Var_SetGlobal("MAKE_VERSION", MAKE_VERSION);
813 * First snag things out of the MAKEFLAGS environment
814 * variable. Then parse the command line arguments.
816 Main_ParseArgLine(getenv("MAKEFLAGS"), 1);
818 MainParseArgs(argc, argv);
821 * Find where we are...
823 if (getcwd(curdir, MAXPATHLEN) == NULL)
829 if (stat(curdir, &sa) == -1)
830 err(2, "%s", curdir);
834 * The object directory location is determined using the
835 * following order of preference:
837 * 1. MAKEOBJDIRPREFIX`cwd`
839 * 3. PATH_OBJDIR.${MACHINE}
841 * 5. PATH_OBJDIRPREFIX`cwd`
843 * If one of the first two fails, use the current directory.
844 * If the remaining three all fail, use the current directory.
846 * Once things are initted,
847 * have to add the original directory to the search path,
848 * and modify the paths for the Makefiles apropriately. The
849 * current directory is also placed as a variable for make scripts.
851 if (!(pathp = getenv("MAKEOBJDIRPREFIX"))) {
852 if (!(path = getenv("MAKEOBJDIR"))) {
854 pathp = PATH_OBJDIRPREFIX;
855 snprintf(mdpath, MAXPATHLEN, "%s.%s", path, machine);
856 if (!(objdir = chdir_verify_path(mdpath, obpath)))
857 if (!(objdir=chdir_verify_path(path, obpath))) {
858 snprintf(mdpath, MAXPATHLEN,
859 "%s%s", pathp, curdir);
860 if (!(objdir=chdir_verify_path(mdpath,
865 else if (!(objdir = chdir_verify_path(path, obpath)))
869 snprintf(mdpath, MAXPATHLEN, "%s%s", pathp, curdir);
870 if (!(objdir = chdir_verify_path(mdpath, obpath)))
873 Dir_InitDot(); /* Initialize the "." directory */
874 if (objdir != curdir)
875 Path_AddDir(&dirSearchPath, curdir);
876 Var_SetGlobal(".ST_EXPORTVAR", "YES");
877 Var_SetGlobal(".CURDIR", curdir);
878 Var_SetGlobal(".OBJDIR", objdir);
880 if (getenv("MAKE_JOBS_FIFO") != NULL)
883 * Be compatible if user did not specify -j and did not explicitly
884 * turned compatibility on
886 if (!compatMake && !forceJobs)
890 * Initialize target and suffix modules in preparation for
891 * parsing the makefile(s)
900 * Set up the .TARGETS variable to contain the list of targets to be
901 * created. If none specified, make the variable empty -- the parser
902 * will fill the thing in with the default or .MAIN target.
904 if (Lst_IsEmpty(&create)) {
905 Var_SetGlobal(".TARGETS", "");
909 for (ln = Lst_First(&create); ln != NULL; ln = Lst_Succ(ln)) {
910 char *name = Lst_Datum(ln);
912 Var_Append(".TARGETS", name, VAR_GLOBAL);
918 * If no user-supplied system path was given (through the -m option)
919 * add the directories from the DEFSYSPATH (more than one may be given
920 * as dir1:...:dirn) to the system include path.
922 if (TAILQ_EMPTY(&sysIncPath)) {
923 char syspath[] = PATH_DEFSYSPATH;
925 for (start = syspath; *start != '\0'; start = cp) {
926 for (cp = start; *cp != '\0' && *cp != ':'; cp++)
929 Path_AddDir(&sysIncPath, start);
932 Path_AddDir(&sysIncPath, start);
938 * Read in the built-in rules first, followed by the specified
939 * makefile, if it was (makefile != (char *) NULL), or the default
940 * Makefile and makefile, in that order, if it wasn't.
944 Lst sysMkPath = Lst_Initializer(sysMkPath);
946 char defsysmk[] = PATH_DEFSYSMK;
948 Path_Expand(defsysmk, &sysIncPath, &sysMkPath);
949 if (Lst_IsEmpty(&sysMkPath))
950 Fatal("make: no system rules (%s).", PATH_DEFSYSMK);
951 LST_FOREACH(ln, &sysMkPath) {
952 if (!ReadMakefile(Lst_Datum(ln)))
956 Fatal("make: cannot open %s.", (char *)Lst_Datum(ln));
957 Lst_Destroy(&sysMkPath, free);
960 if (!Lst_IsEmpty(&makefiles)) {
963 LST_FOREACH(ln, &makefiles) {
964 if (!ReadMakefile(Lst_Datum(ln)))
968 Fatal("make: cannot open %s.", (char *)Lst_Datum(ln));
969 } else if (!ReadMakefile("BSDmakefile"))
970 if (!ReadMakefile("makefile"))
971 ReadMakefile("Makefile");
973 ReadMakefile(".depend");
975 /* Install all the flags into the MAKE envariable. */
976 if (((p = Var_Value(".MAKEFLAGS", VAR_GLOBAL)) != NULL) && *p)
977 setenv("MAKEFLAGS", p, 1);
980 * For compatibility, look at the directories in the VPATH variable
981 * and add them to the search path, if the variable is defined. The
982 * variable's value is in the same format as the PATH envariable, i.e.
983 * <directory>:<directory>:<directory>...
985 if (Var_Exists("VPATH", VAR_CMD)) {
987 * GCC stores string constants in read-only memory, but
988 * Var_Subst will want to write this thing, so store it
991 static char VPATH[] = "${VPATH}";
997 buf = Var_Subst(VPATH, VAR_CMD, FALSE);
999 vpath = Buf_Data(buf);
1001 /* skip to end of directory */
1002 for (ptr = vpath; *ptr != ':' && *ptr != '\0'; ptr++)
1005 /* Save terminator character so know when to stop */
1009 /* Add directory to search path */
1010 Path_AddDir(&dirSearchPath, vpath);
1013 } while (savec != '\0');
1015 Buf_Destroy(buf, TRUE);
1019 * Now that all search paths have been read for suffixes et al, it's
1020 * time to add the default search path to their lists...
1024 /* print the initial graph, if the user requested it */
1028 /* print the values of any variables requested by the user */
1029 if (Lst_IsEmpty(&variables)) {
1031 * Since the user has not requested that any variables
1032 * be printed, we can build targets.
1034 * Have read the entire graph and need to make a list of targets
1035 * to create. If none was given on the command line, we consult
1036 * the parsing module to find the main target(s) to create.
1038 Lst targs = Lst_Initializer(targs);
1040 if (Lst_IsEmpty(&create))
1041 Parse_MainName(&targs);
1043 Targ_FindList(&targs, &create, TARG_CREATE);
1047 * Compat_Init will take care of creating
1048 * all the targets as well as initializing
1055 * Initialize job module before traversing
1056 * the graph, now that any .BEGIN and .END
1057 * targets have been read. This is done
1058 * only if the -q flag wasn't given (to
1059 * prevent the .BEGIN from being executed
1067 /* Traverse the graph, checking on all the targets */
1068 outOfDate = Make_Run(&targs);
1070 Lst_Destroy(&targs, NOFREE);
1073 Var_Print(&variables, expandVars);
1076 Lst_Destroy(&variables, free);
1077 Lst_Destroy(&makefiles, free);
1078 Lst_Destroy(&create, free);
1080 /* print the graph now it's been processed if the user requested it */
1084 if (queryFlag && outOfDate)