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
64 #include <sys/param.h>
66 #include <sys/sysctl.h>
68 #include <sys/queue.h>
69 #include <sys/resource.h>
70 #include <sys/utsname.h>
86 #include "pathnames.h"
94 extern char **environ; /* XXX what header declares this variable? */
96 #define WANT_ENV_MKLVL 1
97 #define MKLVL_MAXVAL 500
98 #define MKLVL_ENVVAR "__MKLVL__"
100 /* ordered list of makefiles to read */
101 static Lst makefiles = Lst_Initializer(makefiles);
103 /* list of variables to print */
104 static Lst variables = Lst_Initializer(variables);
106 static Boolean expandVars; /* fully expand printed variables */
107 static Boolean noBuiltins; /* -r flag */
108 static Boolean forceJobs; /* -j argument given */
109 static char *curdir; /* startup directory */
110 static char *objdir; /* where we chdir'ed to */
112 /* (-E) vars to override from env */
113 Lst envFirstVars = Lst_Initializer(envFirstVars);
115 /* Targets to be made */
116 Lst create = Lst_Initializer(create);
118 Boolean allPrecious; /* .PRECIOUS given on line by itself */
119 Boolean beSilent; /* -s flag */
120 Boolean beVerbose; /* -v flag */
121 Boolean compatMake; /* -B argument */
122 int debug; /* -d flag */
123 Boolean ignoreErrors; /* -i flag */
124 int jobLimit; /* -j argument */
125 Boolean jobsRunning; /* TRUE if the jobs might be running */
126 Boolean keepgoing; /* -k flag */
127 Boolean noExecute; /* -n flag */
128 Boolean queryFlag; /* -q flag */
129 Boolean touchFlag; /* -t flag */
130 Boolean usePipes; /* !-P flag */
131 uint32_t warn_cmd; /* command line warning flags */
132 uint32_t warn_flags; /* actual warning flags */
133 uint32_t warn_nocmd; /* command line no-warning flags */
135 time_t now; /* Time at start of make */
136 struct GNode *DEFAULT; /* .DEFAULT node */
139 * Exit with usage message.
145 "usage: make [-BPSXeiknqrstv] [-C directory] [-D variable]\n"
146 "\t[-d flags] [-E variable] [-f makefile] [-I directory]\n"
147 "\t[-j max_jobs] [-m directory] [-V variable]\n"
148 "\t[variable=value] [target ...]\n");
154 * Append a flag with an optional argument to MAKEFLAGS and MFLAGS
157 MFLAGS_append(const char *flag, char *arg)
161 Var_Append(".MAKEFLAGS", flag, VAR_GLOBAL);
163 str = MAKEFLAGS_quote(arg);
164 Var_Append(".MAKEFLAGS", str, VAR_GLOBAL);
168 Var_Append("MFLAGS", flag, VAR_GLOBAL);
170 str = MAKEFLAGS_quote(arg);
171 Var_Append("MFLAGS", str, VAR_GLOBAL);
179 * Handle argument to warning option.
182 Main_ParseWarn(const char *arg, int iscmd)
186 static const struct {
190 { "dirsyntax", WARN_DIRSYNTAX },
195 if (arg[0] == 'n' && arg[1] == 'o') {
200 for (i = 0; options[i].option != NULL; i++)
201 if (strcmp(arg, options[i].option) == 0)
204 if (options[i].option == NULL)
210 warn_cmd |= options[i].flag;
211 warn_nocmd &= ~options[i].flag;
212 warn_flags |= options[i].flag;
214 warn_nocmd |= options[i].flag;
215 warn_cmd &= ~options[i].flag;
216 warn_flags &= ~options[i].flag;
220 warn_flags |= (options[i].flag & ~warn_nocmd);
222 warn_flags &= ~(options[i].flag | warn_cmd);
229 * Open and parse the given makefile.
232 * TRUE if ok. FALSE if couldn't open file.
235 ReadMakefile(const char p[])
237 char *fname, *fnamesave; /* makefile to read */
239 char *name, path[MAXPATHLEN];
243 /* XXX - remove this once constification is done */
244 fnamesave = fname = estrdup(p);
246 if (!strcmp(fname, "-")) {
247 Parse_File("(stdin)", stdin);
248 Var_SetGlobal("MAKEFILE", "");
250 setMAKEFILE = strcmp(fname, ".depend");
252 /* if we've chdir'd, rebuild the path name */
253 if (curdir != objdir && *fname != '/') {
254 snprintf(path, MAXPATHLEN, "%s/%s", curdir, fname);
256 * XXX The realpath stuff breaks relative includes
257 * XXX in some cases. The problem likely is in
258 * XXX parse.c where it does special things in
259 * XXX ParseDoInclude if the file is relateive
260 * XXX or absolute and not a system file. There
261 * XXX it assumes that if the current file that's
262 * XXX being included is absolute, that any files
263 * XXX that it includes shouldn't do the -I path
264 * XXX stuff, which is inconsistant with historical
265 * XXX behavior. However, I can't pentrate the mists
266 * XXX further, so I'm putting this workaround in
267 * XXX here until such time as the underlying bug
270 #if THIS_BREAKS_THINGS
271 if (realpath(path, path) != NULL &&
272 (stream = fopen(path, "r")) != NULL) {
277 } else if (realpath(fname, path) != NULL) {
280 if ((stream = fopen(fname, "r")) != NULL)
284 if ((stream = fopen(path, "r")) != NULL) {
291 if ((stream = fopen(fname, "r")) != NULL)
295 /* look in -I and system include directories. */
296 name = Path_FindFile(fname, &parseIncPath);
298 name = Path_FindFile(fname, &sysIncPath);
299 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 * FreeBSD/pc98 kernel used to set the utsname.machine to
719 * "i386", and MACHINE was defined as "i386", so it could
720 * not be distinguished from FreeBSD/i386. Therefore, we
721 * had to check machine.ispc98 and adjust the MACHINE
723 * NOTE: The code is still here to be able to compile new
724 * make binary on old FreeBSD/pc98 systems, and have the
725 * MACHINE variable set properly.
727 if ((machine = getenv("MACHINE")) == NULL) {
731 len = sizeof(ispc98);
732 if (!sysctlbyname("machdep.ispc98", &ispc98, &len, NULL, 0)) {
739 * Get the name of this type of MACHINE from utsname
740 * so we can share an executable for similar machines.
741 * (i.e. m68k: amiga hp300, mac68k, sun3, ...)
743 * Note that both MACHINE and MACHINE_ARCH are decided at
746 if (machine == NULL) {
747 static struct utsname utsname;
749 if (uname(&utsname) == -1)
751 machine = utsname.machine;
754 if ((machine_arch = getenv("MACHINE_ARCH")) == NULL) {
756 machine_arch = MACHINE_ARCH;
758 machine_arch = "unknown";
763 * Set machine_cpu to the minumum supported CPU revision based
764 * on the target architecture, if not already set.
766 if ((machine_cpu = getenv("MACHINE_CPU")) == NULL) {
767 if (!strcmp(machine_arch, "i386"))
768 machine_cpu = "i386";
769 else if (!strcmp(machine_arch, "alpha"))
772 machine_cpu = "unknown";
776 * Initialize the parsing, directory and variable modules to prepare
777 * for the reading of inclusion paths and variable settings on the
782 Dir_Init(); /* Initialize directory structures so -I flags
783 * can be processed correctly */
784 Var_Init(environ); /* As well as the lists of variables for
785 * parsing arguments */
788 * Initialize the Shell so that we have a shell for != assignments
789 * on the command line.
794 * Initialize various variables.
795 * MAKE also gets this name, for compatibility
796 * .MAKEFLAGS gets set to the empty string just in case.
797 * MFLAGS also gets initialized empty, for compatibility.
799 Var_SetGlobal("MAKE", argv[0]);
800 Var_SetGlobal(".MAKEFLAGS", "");
801 Var_SetGlobal("MFLAGS", "");
802 Var_SetGlobal("MACHINE", machine);
803 Var_SetGlobal("MACHINE_ARCH", machine_arch);
804 Var_SetGlobal("MACHINE_CPU", machine_cpu);
806 Var_SetGlobal("MAKE_VERSION", MAKE_VERSION);
810 * First snag things out of the MAKEFLAGS environment
811 * variable. Then parse the command line arguments.
813 Main_ParseArgLine(getenv("MAKEFLAGS"), 1);
815 MainParseArgs(argc, argv);
818 * Find where we are...
820 if (getcwd(curdir, MAXPATHLEN) == NULL)
826 if (stat(curdir, &sa) == -1)
827 err(2, "%s", curdir);
831 * The object directory location is determined using the
832 * following order of preference:
834 * 1. MAKEOBJDIRPREFIX`cwd`
836 * 3. PATH_OBJDIR.${MACHINE}
838 * 5. PATH_OBJDIRPREFIX`cwd`
840 * If one of the first two fails, use the current directory.
841 * If the remaining three all fail, use the current directory.
843 * Once things are initted,
844 * have to add the original directory to the search path,
845 * and modify the paths for the Makefiles apropriately. The
846 * current directory is also placed as a variable for make scripts.
848 if (!(pathp = getenv("MAKEOBJDIRPREFIX"))) {
849 if (!(path = getenv("MAKEOBJDIR"))) {
851 pathp = PATH_OBJDIRPREFIX;
852 snprintf(mdpath, MAXPATHLEN, "%s.%s", path, machine);
853 if (!(objdir = chdir_verify_path(mdpath, obpath)))
854 if (!(objdir=chdir_verify_path(path, obpath))) {
855 snprintf(mdpath, MAXPATHLEN,
856 "%s%s", pathp, curdir);
857 if (!(objdir=chdir_verify_path(mdpath,
862 else if (!(objdir = chdir_verify_path(path, obpath)))
866 snprintf(mdpath, MAXPATHLEN, "%s%s", pathp, curdir);
867 if (!(objdir = chdir_verify_path(mdpath, obpath)))
870 Dir_InitDot(); /* Initialize the "." directory */
871 if (objdir != curdir)
872 Path_AddDir(&dirSearchPath, curdir);
873 Var_SetGlobal(".ST_EXPORTVAR", "YES");
874 Var_SetGlobal(".CURDIR", curdir);
875 Var_SetGlobal(".OBJDIR", objdir);
877 if (getenv("MAKE_JOBS_FIFO") != NULL)
880 * Be compatible if user did not specify -j and did not explicitly
881 * turned compatibility on
883 if (!compatMake && !forceJobs)
887 * Initialize target and suffix modules in preparation for
888 * parsing the makefile(s)
897 * Set up the .TARGETS variable to contain the list of targets to be
898 * created. If none specified, make the variable empty -- the parser
899 * will fill the thing in with the default or .MAIN target.
901 if (Lst_IsEmpty(&create)) {
902 Var_SetGlobal(".TARGETS", "");
906 for (ln = Lst_First(&create); ln != NULL; ln = Lst_Succ(ln)) {
907 char *name = Lst_Datum(ln);
909 Var_Append(".TARGETS", name, VAR_GLOBAL);
915 * If no user-supplied system path was given (through the -m option)
916 * add the directories from the DEFSYSPATH (more than one may be given
917 * as dir1:...:dirn) to the system include path.
919 if (TAILQ_EMPTY(&sysIncPath)) {
920 char syspath[] = PATH_DEFSYSPATH;
922 for (start = syspath; *start != '\0'; start = cp) {
923 for (cp = start; *cp != '\0' && *cp != ':'; cp++)
926 Path_AddDir(&sysIncPath, start);
929 Path_AddDir(&sysIncPath, start);
935 * Read in the built-in rules first, followed by the specified
936 * makefile, if it was (makefile != (char *) NULL), or the default
937 * Makefile and makefile, in that order, if it wasn't.
941 Lst sysMkPath = Lst_Initializer(sysMkPath);
943 char defsysmk[] = PATH_DEFSYSMK;
945 Path_Expand(defsysmk, &sysIncPath, &sysMkPath);
946 if (Lst_IsEmpty(&sysMkPath))
947 Fatal("make: no system rules (%s).", PATH_DEFSYSMK);
948 LST_FOREACH(ln, &sysMkPath) {
949 if (!ReadMakefile(Lst_Datum(ln)))
953 Fatal("make: cannot open %s.", (char *)Lst_Datum(ln));
954 Lst_Destroy(&sysMkPath, free);
957 if (!Lst_IsEmpty(&makefiles)) {
960 LST_FOREACH(ln, &makefiles) {
961 if (!ReadMakefile(Lst_Datum(ln)))
965 Fatal("make: cannot open %s.", (char *)Lst_Datum(ln));
966 } else if (!ReadMakefile("BSDmakefile"))
967 if (!ReadMakefile("makefile"))
968 ReadMakefile("Makefile");
970 ReadMakefile(".depend");
972 /* Install all the flags into the MAKE envariable. */
973 if (((p = Var_Value(".MAKEFLAGS", VAR_GLOBAL)) != NULL) && *p)
974 setenv("MAKEFLAGS", p, 1);
977 * For compatibility, look at the directories in the VPATH variable
978 * and add them to the search path, if the variable is defined. The
979 * variable's value is in the same format as the PATH envariable, i.e.
980 * <directory>:<directory>:<directory>...
982 if (Var_Exists("VPATH", VAR_CMD)) {
984 * GCC stores string constants in read-only memory, but
985 * Var_Subst will want to write this thing, so store it
988 static char VPATH[] = "${VPATH}";
994 buf = Var_Subst(VPATH, VAR_CMD, FALSE);
996 vpath = Buf_Data(buf);
998 /* skip to end of directory */
999 for (ptr = vpath; *ptr != ':' && *ptr != '\0'; ptr++)
1002 /* Save terminator character so know when to stop */
1006 /* Add directory to search path */
1007 Path_AddDir(&dirSearchPath, vpath);
1010 } while (savec != '\0');
1012 Buf_Destroy(buf, TRUE);
1016 * Now that all search paths have been read for suffixes et al, it's
1017 * time to add the default search path to their lists...
1021 /* print the initial graph, if the user requested it */
1025 /* print the values of any variables requested by the user */
1026 if (Lst_IsEmpty(&variables)) {
1028 * Since the user has not requested that any variables
1029 * be printed, we can build targets.
1031 * Have read the entire graph and need to make a list of targets
1032 * to create. If none was given on the command line, we consult
1033 * the parsing module to find the main target(s) to create.
1035 Lst targs = Lst_Initializer(targs);
1037 if (Lst_IsEmpty(&create))
1038 Parse_MainName(&targs);
1040 Targ_FindList(&targs, &create, TARG_CREATE);
1044 * Compat_Init will take care of creating
1045 * all the targets as well as initializing
1052 * Initialize job module before traversing
1053 * the graph, now that any .BEGIN and .END
1054 * targets have been read. This is done
1055 * only if the -q flag wasn't given (to
1056 * prevent the .BEGIN from being executed
1064 /* Traverse the graph, checking on all the targets */
1065 outOfDate = Make_Run(&targs);
1067 Lst_Destroy(&targs, NOFREE);
1070 Var_Print(&variables, expandVars);
1073 Lst_Destroy(&variables, free);
1074 Lst_Destroy(&makefiles, free);
1075 Lst_Destroy(&create, free);
1077 /* print the graph now it's been processed if the user requested it */
1081 if (queryFlag && outOfDate)