maxLocal = DEFMAXLOCAL;		 #ifdef notyet
main(argc, argv)	int argc;	char **argv;{	Lst targs;	/* target nodes to create -- passed to Make_Init */	Boolean outOfDate = TRUE; 	/* FALSE if all targets up to date */	struct stat sb, sa;	char *p, *p1, *path, *pwd, *getenv(), *getwd();	char mdpath[MAXPATHLEN + 1];	char obpath[MAXPATHLEN + 1];	char cdpath[MAXPATHLEN + 1];	struct utsname utsname;    	char *machine = getenv("MACHINE");	/*	 * Find where we are and take care of PWD for the automounter...	 * All this code is so that we know where we are when we start up	 * on a different machine with pmake.	 */	curdir = cdpath;	if (getcwd(curdir, MAXPATHLEN) == NULL) {		(void)fprintf(stderr, "make: %s.\n", strerror(errno));		exit(2);	}	if (stat(curdir, &sa) == -1) {	    (void)fprintf(stderr, "make: %s: %s.\n",			  curdir, strerror(errno));	    exit(2);	}	if ((pwd = getenv("PWD")) != NULL) {	    if (stat(pwd, &sb) == 0 && sa.st_ino == sb.st_ino &&		sa.st_dev == sb.st_dev) 		(void) strcpy(curdir, pwd);	}	/*	 * Get the name of this type of MACHINE from utsname	 * so we can share an executable for similar machines.	 * (i.e. m68k: amiga hp300, mac68k, sun3, ...)	 *	 * Note that while MACHINE is decided at run-time,	 * MACHINE_ARCH is always known at compile time.	 */    	if (!machine) {	    if (uname(&utsname)) {		    perror("make: uname");		    exit(2);	    }	    machine = utsname.machine;	}	/*	 * if the MAKEOBJDIR (or by default, the _PATH_OBJDIR) directory	 * exists, change into it and build there.  Once things are	 * initted, have to add the original directory to the search path,	 * and modify the paths for the Makefiles apropriately.  The	 * current directory is also placed as a variable for make scripts.	 */	if (!(path = getenv("MAKEOBJDIR"))) {		path = _PATH_OBJDIR;		(void) sprintf(mdpath, "%s.%s", path, machine);	}	else		(void) strncpy(mdpath, path, MAXPATHLEN + 1);		if (stat(mdpath, &sb) == 0 && S_ISDIR(sb.st_mode)) {		if (chdir(mdpath)) {			(void)fprintf(stderr, "make warning: %s: %s.\n",				      mdpath, strerror(errno));			objdir = curdir;		}		else {			if (mdpath[0] != '/') {				(void) sprintf(obpath, "%s/%s", curdir, mdpath);				objdir = obpath;			}			else				objdir = mdpath;		}	}	else {		if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) {			if (chdir(path)) {				(void)fprintf(stderr, "make warning: %s: %s.\n",					      path, strerror(errno));				objdir = curdir;			}			else {				if (path[0] != '/') {					(void) sprintf(obpath, "%s/%s", curdir,						       path);					objdir = obpath;				}				else					objdir = obpath;			}		}		else			objdir = curdir;	}	setenv("PWD", objdir, 1);	create = Lst_Init(FALSE);	makefiles = Lst_Init(FALSE);	beSilent = FALSE;		/* Print commands as executed */	ignoreErrors = FALSE;		/* Pay attention to non-zero returns */	noExecute = FALSE;		/* Execute all commands */	keepgoing = FALSE;		/* Stop on error */	allPrecious = FALSE;		/* Remove targets when interrupted */	queryFlag = FALSE;		/* This is not just a check-run */	noBuiltins = FALSE;		/* Read the built-in rules */	touchFlag = FALSE;		/* Actually update targets */	usePipes = TRUE;		/* Catch child output in pipes */	debug = 0;			/* No debug verbosity, please. */	jobsRunning = FALSE;	maxJobs = DEFMAXJOBS;		/* Set default max concurrency */	maxLocal = DEFMAXLOCAL;		/* Set default local max concurrency */#ifdef notyet	compatMake = FALSE;		/* No compat mode */#else	compatMake = TRUE;		/* No compat mode */#endif    	/*	 * Initialize the parsing, directory and variable modules to prepare	 * for the reading of inclusion paths and variable settings on the	 * command line	 */	Dir_Init();		/* Initialize directory structures so -I flags				 * can be processed correctly */	Parse_Init();		/* Need to initialize the paths of #include				 * directories */	Var_Init();		/* As well as the lists of variables for				 * parsing arguments */        str_init();	if (objdir != curdir)		Dir_AddDir(dirSearchPath, curdir);	Var_Set(".CURDIR", curdir, VAR_GLOBAL);	Var_Set(".OBJDIR", objdir, VAR_GLOBAL);	/*	 * Initialize various variables.	 *	MAKE also gets this name, for compatibility	 *	.MAKEFLAGS gets set to the empty string just in case.	 *	MFLAGS also gets initialized empty, for compatibility.	 */	Var_Set("MAKE", argv[0], VAR_GLOBAL);	Var_Set(MAKEFLAGS, "", VAR_GLOBAL);	Var_Set("MFLAGS", "", VAR_GLOBAL);	Var_Set("MACHINE", machine, VAR_GLOBAL);#ifdef MACHINE_ARCH	Var_Set("MACHINE_ARCH", MACHINE_ARCH, VAR_GLOBAL);#endif	/*	 * First snag any flags out of the MAKE environment variable.	 * (Note this is *not* MAKEFLAGS since /bin/make uses that and it's	 * in a different format).	 */#ifdef POSIX	Main_ParseArgLine(getenv("MAKEFLAGS"));#else	Main_ParseArgLine(getenv("MAKE"));#endif    	MainParseArgs(argc, argv);	/*	 * Initialize archive, target and suffix modules in preparation for	 * parsing the makefile(s)	 */	Arch_Init();	Targ_Init();	Suff_Init();	DEFAULT = NILGNODE;	(void)time(&now);	/*	 * Set up the .TARGETS variable to contain the list of targets to be	 * created. If none specified, make the variable empty -- the parser	 * will fill the thing in with the default or .MAIN target.	 */	if (!Lst_IsEmpty(create)) {		LstNode ln;		for (ln = Lst_First(create); ln != NILLNODE;		    ln = Lst_Succ(ln)) {			char *name = (char *)Lst_Datum(ln);			Var_Append(".TARGETS", name, VAR_GLOBAL);		}	} else		Var_Set(".TARGETS", "", VAR_GLOBAL);	/*	 * Read in the built-in rules first, followed by the specified makefile,	 * if it was (makefile != (char *) NULL), or the default Makefile and	 * makefile, in that order, if it wasn't.	 */	 if (!noBuiltins && !ReadMakefile(_PATH_DEFSYSMK))		Fatal("make: no system rules (%s).", _PATH_DEFSYSMK);	if (!Lst_IsEmpty(makefiles)) {		LstNode ln;		ln = Lst_Find(makefiles, (ClientData)NULL, ReadMakefile);		if (ln != NILLNODE)			Fatal("make: cannot open %s.", (char *)Lst_Datum(ln));	} else if (!ReadMakefile("makefile"))		(void)ReadMakefile("Makefile");	(void)ReadMakefile(".depend");	Var_Append("MFLAGS", Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1), VAR_GLOBAL);	if (p1)	    free(p1);	/* Install all the flags into the MAKE envariable. */	if (((p = Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1)) != NULL) && *p)#ifdef POSIX		setenv("MAKEFLAGS", p, 1);#else		setenv("MAKE", p, 1);#endif	if (p1)	    free(p1);	/*	 * For compatibility, look at the directories in the VPATH variable	 * and add them to the search path, if the variable is defined. The	 * variable's value is in the same format as the PATH envariable, i.e.	 * <directory>:<directory>:<directory>...	 */	if (Var_Exists("VPATH", VAR_CMD)) {		char *vpath, *path, *cp, savec;		/*		 * GCC stores string constants in read-only memory, but		 * Var_Subst will want to write this thing, so store it		 * in an array		 */		static char VPATH[] = "${VPATH}";		vpath = Var_Subst(NULL, VPATH, VAR_CMD, FALSE);		path = vpath;		do {			/* skip to end of directory */			for (cp = path; *cp != ':' && *cp != '\0'; cp++)				continue;			/* Save terminator character so know when to stop */			savec = *cp;			*cp = '\0';			/* Add directory to search path */			Dir_AddDir(dirSearchPath, path);			*cp = savec;			path = cp + 1;		} while (savec == ':');		(void)free((Address)vpath);	}	/*	 * Now that all search paths have been read for suffixes et al, it's	 * time to add the default search path to their lists...	 */	Suff_DoPaths();	/* print the initial graph, if the user requested it */	if (DEBUG(GRAPH1))		Targ_PrintGraph(1);	/*	 * Have now read the entire graph and need to make a list of targets	 * to create. If none was given on the command line, we consult the	 * parsing module to find the main target(s) to create.	 */	if (Lst_IsEmpty(create))		targs = Parse_MainName();	else		targs = Targ_FindList(create, TARG_CREATE);/* * this was original amMake -- want to allow parallelism, so put this * back in, eventually. */	if (!compatMake) {		/*		 * Initialize job module before traversing the graph, now that		 * any .BEGIN and .END targets have been read.  This is done		 * only if the -q flag wasn't given (to prevent the .BEGIN from		 * being executed should it exist).		 */		if (!queryFlag) {			if (maxLocal == -1)				maxLocal = maxJobs;			Job_Init(maxJobs, maxLocal);			jobsRunning = TRUE;		}		/* Traverse the graph, checking on all the targets */		outOfDate = Make_Run(targs);	} else		/*		 * Compat_Init will take care of creating all the targets as		 * well as initializing the module.		 */		Compat_Run(targs);    	Lst_Destroy(targs, NOFREE);	Lst_Destroy(makefiles, NOFREE);	Lst_Destroy(create, (void (*) __P((ClientData))) free);	/* print the graph now it's been processed if the user requested it */	if (DEBUG(GRAPH2))		Targ_PrintGraph(2);	Suff_End();        Targ_End();	Arch_End();	str_end();	Var_End();	Parse_End();	Dir_End();	if (queryFlag && outOfDate)		return(1);	else		return(0);}