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 * @(#) Copyright (c) 1988, 1989, 1990, 1993 The Regents of the University of California. All rights reserved.
39 * @(#)main.c 8.3 (Berkeley) 3/19/94
40 * $FreeBSD: src/usr.bin/make/main.c,v 1.118 2005/02/13 13:33:56 harti Exp $
41 * $DragonFly: src/usr.bin/make/main.c,v 1.110 2005/05/23 20:05:05 okumoto Exp $
46 * The main file for this entire program. Exit routines etc
49 * Utility functions defined in this file:
51 * Takes a line of arguments, breaks them and
52 * treats them as if they were given when first
53 * invoked. Used by the parse module to implement
58 #include <sys/utsname.h>
60 #include <sys/param.h>
63 #include <sys/queue.h>
64 #include <sys/resource.h>
80 #include "pathnames.h"
88 extern char **environ; /* XXX what header declares this variable? */
92 * This control the default concurrency. On no occasion will more
93 * than DEFMAXJOBS targets be created at once.
97 typedef struct MakeFlags {
98 /** ordered list of makefiles to read */
101 /** list of variables to print */
104 /** Targets to be made */
107 /** directories to search when looking for includes */
108 struct Path parseIncPath;
110 /** directories to search when looking for system includes */
111 struct Path sysIncPath;
113 Boolean expandVars; /* fully expand printed variables */
114 Boolean noBuiltins; /* -r flag */
115 Boolean forceJobs; /* -j argument given */
119 * TRUE if we aren't supposed to really make anything, just
120 * see if the targets are out-of-date
125 /* (-E) vars to override from env */
126 Lst envFirstVars = Lst_Initializer(envFirstVars);
128 Boolean allPrecious; /* .PRECIOUS given on line by itself */
129 Boolean beSilent; /* -s flag */
130 Boolean beVerbose; /* -v flag */
131 Boolean compatMake; /* -B argument */
132 Boolean debug; /* -d flag */
133 Boolean ignoreErrors; /* -i flag */
134 int jobLimit; /* -j argument */
135 Boolean jobsRunning; /* TRUE if the jobs might be running */
136 Boolean keepgoing; /* -k flag */
137 Boolean noExecute; /* -n flag */
138 Boolean touchFlag; /* -t flag */
139 Boolean usePipes; /* !-P flag */
140 uint32_t warn_cmd; /* command line warning flags */
141 uint32_t warn_flags; /* actual warning flags */
142 uint32_t warn_nocmd; /* command line no-warning flags */
144 time_t now; /* Time at start of make */
145 struct GNode *DEFAULT; /* .DEFAULT node */
149 * Exit with usage message.
155 "usage: make [-BPSXeiknqrstv] [-C directory] [-D variable]\n"
156 "\t[-d flags] [-E variable] [-f makefile] [-I directory]\n"
157 "\t[-j max_jobs] [-m directory] [-V variable]\n"
158 "\t[variable=value] [target ...]\n");
164 * Append a flag with an optional argument to MAKEFLAGS and MFLAGS
167 MFLAGS_append(const char *flag, char *arg)
171 Var_Append(".MAKEFLAGS", flag, VAR_GLOBAL);
173 str = MAKEFLAGS_quote(arg);
174 Var_Append(".MAKEFLAGS", str, VAR_GLOBAL);
178 Var_Append("MFLAGS", flag, VAR_GLOBAL);
180 str = MAKEFLAGS_quote(arg);
181 Var_Append("MFLAGS", str, VAR_GLOBAL);
187 * Open and parse the given makefile.
190 * TRUE if ok. FALSE if couldn't open file.
193 ReadMakefile(Parser *parser, MakeFlags *mf, const char file[], const char curdir[], const char objdir[])
195 char path[MAXPATHLEN];
200 if (!strcmp(file, "-")) {
201 Parse_File(parser, mf, "(stdin)", stdin);
202 Var_SetGlobal("MAKEFILE", "");
206 if (strcmp(curdir, objdir) == 0 || file[0] == '/') {
210 * we've chdir'd, rebuild the path name
212 snprintf(path, MAXPATHLEN, "%s/%s", curdir, file);
214 #if THIS_BREAKS_THINGS
216 * XXX The realpath stuff breaks relative includes
217 * XXX in some cases. The problem likely is in
218 * XXX parse.c where it does special things in
219 * XXX ParseDoInclude if the file is relateive
220 * XXX or absolute and not a system file. There
221 * XXX it assumes that if the current file that's
222 * XXX being included is absolute, that any files
223 * XXX that it includes shouldn't do the -I path
224 * XXX stuff, which is inconsistant with historical
225 * XXX behavior. However, I can't pentrate the mists
226 * XXX further, so I'm putting this workaround in
227 * XXX here until such time as the underlying bug
230 if (realpath(path, path) == NULL) {
233 stream = fopen(path, "r");
236 stream = fopen(path, "r");
238 if (stream != NULL) {
239 if (strcmp(file, ".depend") != 0)
240 Var_SetGlobal("MAKEFILE", file);
241 Parse_File(parser, mf, path, stream);
246 /* look in -I and system include directories. */
247 fname = estrdup(file);
250 name = Path_FindFile(fname, &mf->parseIncPath);
252 name = Path_FindFile(fname, &mf->sysIncPath);
255 stream = fopen(name, "r");
256 if (stream != NULL) {
258 * set the MAKEFILE variable desired by System V fans
259 * -- the placement of the setting here means it gets
260 * set to the last makefile specified, as it is set
263 if (strcmp(file, ".depend") != 0)
264 Var_SetGlobal("MAKEFILE", name);
265 Parse_File(parser, mf, name, stream);
271 return (FALSE); /* no makefile found */
275 * Read in the built-in rules first, followed by the specified
276 * makefiles or the one of the default makefiles. Finally .depend
280 ReadInputFiles(Parser *parser, MakeFlags *mf, const char curdir[], const char objdir[])
282 if (!mf->noBuiltins) {
284 Lst sysMkPath = Lst_Initializer(sysMkPath);
286 char defsysmk[] = PATH_DEFSYSMK;
288 Path_Expand(defsysmk, &mf->sysIncPath, &sysMkPath);
289 if (Lst_IsEmpty(&sysMkPath))
290 Fatal("make: no system rules (%s).", PATH_DEFSYSMK);
291 LST_FOREACH(ln, &sysMkPath) {
292 if (!ReadMakefile(parser, mf, Lst_Datum(ln), curdir, objdir))
296 Fatal("make: cannot open %s.", (char *)Lst_Datum(ln));
297 Lst_Destroy(&sysMkPath, free);
300 if (!Lst_IsEmpty(&mf->makefiles)) {
303 LST_FOREACH(ln, &mf->makefiles) {
304 if (!ReadMakefile(parser, mf, Lst_Datum(ln), curdir, objdir))
308 Fatal("make: cannot open %s.", (char *)Lst_Datum(ln));
309 } else if (ReadMakefile(parser, mf, "BSDmakefile", curdir, objdir)) {
310 /* read BSDmakefile */
311 } else if (ReadMakefile(parser, mf, "makefile", curdir, objdir)) {
313 } else if (ReadMakefile(parser, mf, "Makefile", curdir, objdir)) {
316 /* No Makefile found */
319 ReadMakefile(parser, mf, ".depend", curdir, objdir);
325 * Handle argument to warning option.
328 Main_ParseWarn(const char *arg, int iscmd)
332 static const struct {
336 { "dirsyntax", WARN_DIRSYNTAX },
341 if (arg[0] == 'n' && arg[1] == 'o') {
346 for (i = 0; options[i].option != NULL; i++)
347 if (strcmp(arg, options[i].option) == 0)
350 if (options[i].option == NULL)
356 warn_cmd |= options[i].flag;
357 warn_nocmd &= ~options[i].flag;
358 warn_flags |= options[i].flag;
360 warn_nocmd |= options[i].flag;
361 warn_cmd &= ~options[i].flag;
362 warn_flags &= ~options[i].flag;
366 warn_flags |= (options[i].flag & ~warn_nocmd);
368 warn_flags &= ~(options[i].flag | warn_cmd);
376 * Parse a given argument vector. Called from main() and from
377 * Main_ParseArgLine() when the .MAKEFLAGS target is used.
379 * XXX: Deal with command line overriding .MAKEFLAGS in makefile
382 * Various global and local flags will be set depending on the flags
386 MainParseArgs(MakeFlags *mf, int argc, char **argv)
389 Boolean found_dd = FALSE;
392 optind = 1; /* since we're called more than once */
394 #define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nqrstvx:"
396 if ((optind < argc) && strcmp(argv[optind], "--") == 0) {
399 if ((c = getopt(argc, argv, OPTFLAGS)) == -1) {
406 MFLAGS_append("-A", NULL);
409 if (chdir(optarg) == -1)
410 err(1, "chdir %s", optarg);
413 Var_SetGlobal(optarg, "1");
414 MFLAGS_append("-D", optarg);
417 Path_AddDir(&mf->parseIncPath, optarg);
418 MFLAGS_append("-I", optarg);
421 Lst_AtEnd(&mf->variables, estrdup(optarg));
422 MFLAGS_append("-V", optarg);
425 mf->expandVars = FALSE;
429 MFLAGS_append("-B", NULL);
430 unsetenv("MAKE_JOBS_FIFO");
434 MFLAGS_append("-P", NULL);
438 MFLAGS_append("-S", NULL);
441 char *modules = optarg;
443 for (; *modules; ++modules)
461 if (modules[1] == '1') {
462 debug |= DEBUG_GRAPH1;
465 else if (modules[1] == '2') {
466 debug |= DEBUG_GRAPH2;
489 warnx("illegal argument to d option "
493 MFLAGS_append("-d", optarg);
497 Lst_AtEnd(&envFirstVars, estrdup(optarg));
498 MFLAGS_append("-E", optarg);
501 checkEnvFirst = TRUE;
502 MFLAGS_append("-e", NULL);
505 Lst_AtEnd(&mf->makefiles, estrdup(optarg));
509 MFLAGS_append("-i", NULL);
514 mf->forceJobs = TRUE;
515 jobLimit = strtol(optarg, &endptr, 10);
516 if (jobLimit <= 0 || *endptr != '\0') {
517 warnx("illegal number, -j argument -- %s",
521 MFLAGS_append("-j", optarg);
526 MFLAGS_append("-k", NULL);
529 Path_AddDir(&mf->sysIncPath, optarg);
530 MFLAGS_append("-m", optarg);
534 MFLAGS_append("-n", NULL);
537 mf->queryFlag = TRUE;
538 /* Kind of nonsensical, wot? */
539 MFLAGS_append("-q", NULL);
542 mf->noBuiltins = TRUE;
543 MFLAGS_append("-r", NULL);
547 MFLAGS_append("-s", NULL);
551 MFLAGS_append("-t", NULL);
555 MFLAGS_append("-v", NULL);
558 if (Main_ParseWarn(optarg, 1) != -1)
559 MFLAGS_append("-x", optarg);
572 * Parse the rest of the arguments.
573 * o Check for variable assignments and perform them if so.
574 * o Check for more flags and restart getopt if so.
575 * o Anything else is taken to be a target and added
576 * to the end of the "create" list.
578 for (; *argv != NULL; ++argv, --argc) {
579 if (Parse_IsVar(*argv)) {
580 char *ptr = MAKEFLAGS_quote(*argv);
582 Var_Append(".MAKEFLAGS", ptr, VAR_GLOBAL);
583 Parse_DoVar(*argv, VAR_CMD);
586 } else if ((*argv)[0] == '-') {
587 if ((*argv)[1] == '\0') {
589 * (*argv) is a single dash, so we
592 } else if (found_dd) {
594 * Double dash has been found, ignore
595 * any more options. But what do we do
596 * with it? For now treat it like a target.
598 Lst_AtEnd(&mf->create, estrdup(*argv));
601 * (*argv) is a -flag, so backup argv and
602 * argc. getopt() expects options to start
603 * in the 2nd position.
610 } else if ((*argv)[0] == '\0') {
611 Punt("illegal (null) argument.");
614 Lst_AtEnd(&mf->create, estrdup(*argv));
621 * Used by the parse module when a .MFLAGS or .MAKEFLAGS target
622 * is encountered and by main() when reading the .MAKEFLAGS envariable.
623 * Takes a line of arguments and breaks it into its
624 * component words and passes those words and the number of them to the
625 * MainParseArgs function.
626 * The line should have all its leading whitespace removed.
629 * Only those that come from the various arguments.
632 Main_ParseArgLine(MakeFlags *mf, char line[], int mflags)
638 for (; *line == ' '; ++line)
644 MAKEFLAGS_break(&aa, line);
646 brk_string(&aa, line, TRUE);
648 MainParseArgs(mf, aa.argc, aa.argv);
653 * Try to change the current working directory into path.
656 chdir_verify_path(const char path[], char newdir[])
661 * Check if the path is a directory. If not fail without reporting
664 if (stat(path, &sb) < 0) {
665 return (0); /* fail but no report */
667 if (S_ISDIR(sb.st_mode) == 0) {
672 * The path refers to a directory, so we try to change into it. If we
673 * fail, or we fail to obtain the path from root to the directory,
674 * then report an error and fail.
676 if (chdir(path) < 0) {
677 warn("warning: %s", path);
680 if (getcwd(newdir, MAXPATHLEN) == NULL) {
681 warn("warning: %s", path);
688 determine_objdir(const char machine[], char curdir[], char objdir[])
691 char newdir[MAXPATHLEN];
692 char mdpath[MAXPATHLEN];
696 * Find a path to where we are... [-C directory] might have changed
697 * our current directory.
699 if (getcwd(curdir, MAXPATHLEN) == NULL)
702 if (stat(curdir, &sa) == -1)
703 err(2, "%s", curdir);
706 * The object directory location is determined using the
707 * following order of preference:
709 * 1. MAKEOBJDIRPREFIX`cwd`
711 * 3. PATH_OBJDIR.${MACHINE}
713 * 5. PATH_OBJDIRPREFIX`cwd`
715 * If one of the first two fails, use the current directory.
716 * If the remaining three all fail, use the current directory.
718 if ((env = getenv("MAKEOBJDIRPREFIX")) != NULL) {
719 snprintf(mdpath, MAXPATHLEN, "%s%s", env, curdir);
720 if (chdir_verify_path(mdpath, newdir)) {
721 strcpy(objdir, newdir);
724 strcpy(objdir, curdir);
728 if ((env = getenv("MAKEOBJDIR")) != NULL) {
729 if (chdir_verify_path(env, newdir)) {
730 strcpy(objdir, newdir);
733 strcpy(objdir, curdir);
737 snprintf(mdpath, MAXPATHLEN, "%s.%s", PATH_OBJDIR, machine);
738 if (chdir_verify_path(mdpath, newdir)) {
739 strcpy(objdir, newdir);
743 if (chdir_verify_path(PATH_OBJDIR, newdir)) {
744 strcpy(objdir, newdir);
748 snprintf(mdpath, MAXPATHLEN, "%s%s", PATH_OBJDIRPREFIX, curdir);
749 if (chdir_verify_path(mdpath, newdir)) {
750 strcpy(objdir, newdir);
754 strcpy(objdir, curdir);
758 * Initialize various make variables.
759 * MAKE also gets this name, for compatibility
760 * .MAKEFLAGS gets set to the empty string just in case.
761 * MFLAGS also gets initialized empty, for compatibility.
764 InitVariables(MakeFlags *mf, int argc, char *argv[], char curdir[], char objdir[])
767 const char *machine_arch;
768 const char *machine_cpu;
773 Var_SetGlobal("MAKE", argv[0]);
774 Var_SetGlobal(".MAKEFLAGS", "");
775 Var_SetGlobal("MFLAGS", "");
777 Var_SetGlobal(".DIRECTIVE_MAKEENV", "YES");
778 Var_SetGlobal(".ST_EXPORTVAR", "YES");
780 Var_SetGlobal("MAKE_VERSION", MAKE_VERSION);
784 * Get the name of this type of MACHINE from utsname
785 * so we can share an executable for similar machines.
786 * (i.e. m68k: amiga hp300, mac68k, sun3, ...)
788 * Note that while MACHINE is decided at run-time,
789 * MACHINE_ARCH is always known at compile time.
791 if ((machine = getenv("MACHINE")) == NULL) {
795 static struct utsname utsname;
796 if (uname(&utsname) == -1)
798 machine = utsname.machine;
802 if ((machine_arch = getenv("MACHINE_ARCH")) == NULL) {
804 machine_arch = MACHINE_ARCH;
806 machine_arch = "unknown";
811 * Set machine_cpu to the minumum supported CPU revision based
812 * on the target architecture, if not already set.
814 if ((machine_cpu = getenv("MACHINE_CPU")) == NULL) {
815 if (!strcmp(machine_arch, "i386"))
816 machine_cpu = "i386";
817 else if (!strcmp(machine_arch, "alpha"))
820 machine_cpu = "unknown";
823 Var_SetGlobal("MACHINE", machine);
824 Var_SetGlobal("MACHINE_ARCH", machine_arch);
825 Var_SetGlobal("MACHINE_CPU", machine_cpu);
828 * First snag things out of the MAKEFLAGS environment
829 * variable. Then parse the command line arguments.
831 Main_ParseArgLine(mf, getenv("MAKEFLAGS"), 1);
833 MainParseArgs(mf, argc, argv);
835 determine_objdir(machine, curdir, objdir);
836 Var_SetGlobal(".CURDIR", curdir);
837 Var_SetGlobal(".OBJDIR", objdir);
840 * Set up the .TARGETS variable to contain the list of targets to be
841 * created. If none specified, make the variable empty -- the parser
842 * will fill the thing in with the default or .MAIN target.
844 if (Lst_IsEmpty(&mf->create)) {
845 Var_SetGlobal(".TARGETS", "");
849 for (ln = Lst_First(&mf->create); ln != NULL; ln = Lst_Succ(ln)) {
850 char *name = Lst_Datum(ln);
852 Var_Append(".TARGETS", name, VAR_GLOBAL);
859 * The main function, for obvious reasons. Initializes variables
860 * and a few modules, then parses the arguments give it in the
861 * environment and on the command line. Reads the system makefile
862 * followed by either Makefile, makefile or the file given by the
863 * -f argument. Sets the .MAKEFLAGS PMake variable based on all the
864 * flags it has received by then uses either the Make or the Compat
865 * module to create the initial list of targets.
868 * If -q was given, exits -1 if anything was out-of-date. Else it exits
872 * The program exits when done. Targets are created. etc. etc. etc.
875 main(int argc, char **argv)
879 Boolean outOfDate = TRUE; /* FALSE if all targets up to date */
881 char curdir[MAXPATHLEN]; /* startup directory */
882 char objdir[MAXPATHLEN]; /* where we chdir'ed to */
885 * Initialize program global variables.
887 beSilent = FALSE; /* Print commands as executed */
888 ignoreErrors = FALSE; /* Pay attention to non-zero returns */
889 noExecute = FALSE; /* Execute all commands */
890 keepgoing = FALSE; /* Stop on error */
891 allPrecious = FALSE; /* Remove targets when interrupted */
892 touchFlag = FALSE; /* Actually update targets */
893 usePipes = TRUE; /* Catch child output in pipes */
894 debug = 0; /* No debug verbosity, please. */
897 jobLimit = DEFMAXJOBS;
898 compatMake = FALSE; /* No compat mode */
901 * Initialize make flags variable.
903 Lst_Init(&mf.makefiles);
904 Lst_Init(&mf.variables);
905 Lst_Init(&mf.create);
906 TAILQ_INIT(&mf.parseIncPath);
907 TAILQ_INIT(&mf.sysIncPath);
909 mf.expandVars = TRUE;
910 mf.noBuiltins = FALSE; /* Read the built-in rules */
911 mf.queryFlag = FALSE;
913 if (getenv("MAKE_JOBS_FIFO") == NULL)
914 mf.forceJobs = FALSE;
918 parser.create = &mf.create;
919 parser.parseIncPath = &mf.parseIncPath;
920 parser.sysIncPath = &mf.sysIncPath;
923 * Initialize the parsing, directory and variable modules to prepare
924 * for the reading of inclusion paths and variable settings on the
930 InitVariables(&mf, argc, argv, curdir, objdir);
933 * Once things are initialized, add the original directory to the
934 * search path. The current directory is also placed as a variable
939 Dir_InitDot(); /* Initialize the "." directory */
941 if (strcmp(objdir, curdir) != 0)
942 Path_AddDir(&dirSearchPath, curdir);
945 * Be compatible if user did not specify -j and did not explicitly
946 * turned compatibility on
948 if (!compatMake && !mf.forceJobs)
952 * Initialize target and suffix modules in preparation for
953 * parsing the makefile(s)
962 * If no user-supplied system path was given (through the -m option)
963 * add the directories from the DEFSYSPATH (more than one may be given
964 * as dir1:...:dirn) to the system include path.
966 if (TAILQ_EMPTY(&mf.sysIncPath)) {
967 char syspath[] = PATH_DEFSYSPATH;
971 for (start = syspath; *start != '\0'; start = cp) {
972 for (cp = start; *cp != '\0' && *cp != ':'; cp++)
975 Path_AddDir(&mf.sysIncPath, start);
978 Path_AddDir(&mf.sysIncPath, start);
983 ReadInputFiles(&parser, &mf, curdir, objdir);
985 /* Install all the flags into the MAKE envariable. */
989 if (((p = Var_Value(".MAKEFLAGS", VAR_GLOBAL)) != NULL) && *p)
990 setenv("MAKEFLAGS", p, 1);
994 * For compatibility, look at the directories in the VPATH variable
995 * and add them to the search path, if the variable is defined. The
996 * variable's value is in the same format as the PATH envariable, i.e.
997 * <directory>:<directory>:<directory>...
999 if (Var_Exists("VPATH", VAR_CMD)) {
1004 buf = Var_Subst("${VPATH}", VAR_CMD, FALSE);
1005 vpath = Buf_Data(buf);
1008 /* skip to end of directory */
1009 for (ptr = vpath; *ptr != ':' && *ptr != '\0'; ptr++)
1012 /* Save terminator character so know when to stop */
1016 /* Add directory to search path */
1017 Path_AddDir(&dirSearchPath, vpath);
1020 } while (savec != '\0');
1022 Buf_Destroy(buf, TRUE);
1026 * Now that all search paths have been read for suffixes et al, it's
1027 * time to add the default search path to their lists...
1031 /* print the initial graph, if the user requested it */
1035 /* print the values of any variables requested by the user */
1036 if (Lst_IsEmpty(&mf.variables)) {
1038 * Since the user has not requested that any variables
1039 * be printed, we can build targets.
1041 * Have read the entire graph and need to make a list of targets
1042 * to create. If none was given on the command line, we consult
1043 * the parsing module to find the main target(s) to create.
1045 Lst targs = Lst_Initializer(targs);
1047 if (Lst_IsEmpty(&mf.create))
1048 Parse_MainName(&targs);
1050 Targ_FindList(&targs, &mf.create, TARG_CREATE);
1052 /* Traverse the graph, checking on all the targets */
1054 outOfDate = Compat_Run(&targs, mf.queryFlag);
1056 outOfDate = Make_Run(&targs, mf.queryFlag);
1058 Lst_Destroy(&targs, NOFREE);
1061 Var_Print(&mf.variables, mf.expandVars);
1065 TAILQ_DESTROY(&mf.sysIncPath);
1066 TAILQ_DESTROY(&mf.parseIncPath);
1068 Lst_Destroy(&mf.create, free);
1069 Lst_Destroy(&mf.makefiles, free);
1070 Lst_Destroy(&mf.variables, free);
1072 /* print the graph now it's been processed if the user requested it */
1076 if (mf.queryFlag && outOfDate)