⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mkmakefile.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 3 页
字号:
#ifndef lintstatic	char	*sccsid = "@(#)mkmakefile.c	4.3	(ULTRIX)  9/4/90";#endif lint/************************************************************************ *									* *			Copyright (c) 1988-1990 by			* *		Digital Equipment Corporation, Maynard, MA		* *			All rights reserved.				* *									* *   This software is furnished under a license and may be used and	* *   copied  only  in accordance with the terms of such license and	* *   with the  inclusion  of  the  above  copyright  notice.   This	* *   software  or  any  other copies thereof may not be provided or	* *   otherwise made available to any other person.  No title to and	* *   ownership of the software is hereby transferred.			* *									* *   This software is  derived  from  software  received  from  the	* *   University    of   California,   Berkeley,   and   from   Bell	* *   Laboratories.  Use, duplication, or disclosure is  subject  to	* *   restrictions  under  license  agreements  with  University  of	* *   California and with AT&T.						* *									* *   The information in this software is subject to change  without	* *   notice  and should not be construed as a commitment by Digital	* *   Equipment Corporation.						* *									* *   Digital assumes no responsibility for the use  or  reliability	* *   of its software on equipment which is not supplied by Digital.	* *									* ************************************************************************//* *	Modification History * * 20-Aug-90	Matt Thomas *	Modified mkmakefile to attempt to read in file.<name> for all pseudo *	devices. * * 08-Dec-89 	Pete Keilty *	Modified the making of the loadvmunix line by adding NEW ld flag *	-B to page align BSS space. SPT.o NEEDS to be the first object *	loaded so as to be page aligned.  *	VAX SRM requirement and the CIXCD adapter checks. * * 10-Nov-89	jaw *	make file wrong for profiling kernel. * * 19-July-89	robin *	Added vax device support to mips systems * * 12-Jun-89   gg *	Added configurable virtual memory parameters support. *	(like vasslop, maxdsiz, maxssiz, maxretry and swapfrag). *	Removed virtual memory configurable parameters dmmin and dmmax. * * 07-March-89  gmm *	Fixes for including kdb (for the new path names) * * 17-Feb-89	map (Mark Parenti) *	Make sure swapgeneric.o: section is generated for VAX. * * 13-Feb-89	map (Mark Parenti) *	Change #ifdef's to switches. *	Fix generation of swap files for vax. * * 02-Feb-89	map (Mark Parenti) *	Add machine switch for s-file compile line * * 13-Jun-88	chet *	Added configurable buffer cache support. * * 2-17-87	 Larry C. *	Fix bug in read_files that caused a core dump if files.SYSNAME did *	not have a duplicate entry that would override and entry in the *	default "files" files. * * 12-11-87	Robin L. and Larry C. *	Added portclass support to the system. * * 16-Apr-87 -- fred (Fred Canter) *	Removed the printtext.s kludge (found a better way). *	Added a function to make printtext.s. *	Added, but not kludged, same function to build QD template *	ram .h and .c files. * * 14-Apr-87 -- prs *	Added login to read in the contents of the filesystems file. *	Also, verify that at least one file system listed in filesystems *	file is configured into kernel. * * 19-Mar-87 -- fred (Fred Canter) *	X in the kernel broke the 150 files limit, raised it to 300. *	Added a kludge needed to build one of the monochrome *	device dependent X files (printtext.s). * * 06-Aug-86 -- prs *	Added changes to support the merging of the swapboot and *	swapgeneric files. * * 15-Apr-86 -- afd *	Removed references to MACHINE_MVAX. * * 01 Apr 86 -- depp *	Added in shared memory configurable items * * 05-Mar-86 -- bjg *	Removed msgbuf.h dependency (for assym.s); *	msgbuf removed from kernel * * 25-Feb-86 -- jrs *	Changed to allow multiple "needs" files per files.* line *	Changed to support "swap on boot" similar to "swap on generic" *	Also changed maxusers check to warning rather than hard bound of 8 * * 05-Feb-86 -- jrs *	Moved cpu aliasing out to parser for earlier resolution * * 08 Aug 85 -- darrell *	Added rules for making genassym.c. * * 19-Jul-85 -- tresvik *	Increased maxusers limit from 128 to 256 for larger systems. *	Also, force on -DVAX8600 whenever VAX8650 is defined as a cpu. * * 18 Jun 85 -- reilly *      Fix the emulation problem when doing the -s option in *      the target directory.  * * 24 Mar 85 -- depp *	Added new config specs "release" and "version".  Since this is *	a System V convention, release indicates 1.0, 1.1, 1.2, 2.0, etc. *	Version indicates a subrelease 0, 1, 2, ... * * 11 Apr 85 -- depp *	Modified do_cfiles to restrict the size of CFILES.  Additional *	files are now placed in CFILES1. * * 22 Mar 85 -- reilly *	Added code for the EMULFLT option ( float point emulation ) * * 06 Mar 85 -- reilly *	Modified so that the option BINARY is done correctly. * * 25 Oct 84 -- rjl *	Added support for  MicroVAX binary kits. In line emulation code *	and name change to BINARY.machinename format for BINARY directory. *//* * Build the makefile for the system, from * the information in the files files and the * additional files for the machine being compiled to. */#include <stdio.h>#include <ctype.h>#include "y.tab.h"#include "config.h"#include <machine/param.h>#include <machine/vmparam.h>/* largest segment that we currently support */#define	GIG	1024	/* units of 1 meg */int	source = 0;int	kdebug = 0;static	struct file_list *fcur;char *tail();/* * Lookup a file, by make. */struct file_list *fl_lookup(file)	register char *file;{	register struct file_list *fp;	for (fp = ftab ; fp != 0; fp = fp->f_next) {		if (eq(fp->f_fn, file))			return (fp);	}	return (0);}/* * Lookup a file, by final component name. */struct file_list *fltail_lookup(file)	register char *file;{	register struct file_list *fp;	for (fp = ftab ; fp != 0; fp = fp->f_next) {		if (eq(tail(fp->f_fn), tail(file)))			return (fp);	}	return (0);}/* * Make a new file list entry */struct file_list *new_fent(){	register struct file_list *fp;	int i;	fp = (struct file_list *) malloc(sizeof *fp);	for (i = 0; i < NNEEDS; i++) {		fp->f_needs[i] = 0;	}	fp->f_next = 0;	fp->f_flags = 0;	fp->f_type = 0;	if (fcur == 0)		fcur = ftab = fp;	else		fcur->f_next = fp;	fcur = fp;	return (fp);}char	*COPTS;/* *  Dont't load if the BINARY option is specified */int dontload = 0;/* * Emulation flag */int emulation_float = 0;/* * Build the makefile from the skeleton */makefile(){	FILE *ifp, *ofp;	char line[BUFSIZ];	struct opt *op;	struct file_sys *fs;	int found = 0;	int found_ufs = 0;	int min_swapfrag; /* min size of swapfrag - min vmem allocation chunk */	int maxbufcache;	/* used for configurable buffer cache */	read_files();	read_filesystems();	/*	 * The next two for loops will traverse the option and file	 * system linked lists, to verify at least one file system	 * that is listed in the filesystems file is configured.	 */	for (op = opt; op; op = op->op_next)		for (fs = file_sys; fs; fs = fs->fs_next)			if (!strcmp(op->op_name, fs->fs_name)) {				if (!strcmp(fs->fs_name, "UFS"))					found_ufs = 1;				found = 1;			}	/*	 * If no match was found, report fatal error and return	 */	if (!found) {		fprintf(stderr,"config: One or more entries listed in filesystems file must be specified\n");		exit(1);	}	/*	 * If UFS was not configured, report warning only	 */	if (!found_ufs)		fprintf(stderr, "Warning: UFS not configured\n");	strcpy(line, "makefile.");	(void) strcat(line, machinename);	ifp = fopen(line, "r");	if (ifp == 0) {		perror(line);		exit(1);	}	ofp = fopen(path("makefile"), "w");	if (ofp == 0) {		perror(path("makefile"));		exit(1);	}	fprintf(ofp, "IDENT=-I. -I.. -D%s", raise(ident));	if (profiling)		fprintf(ofp, " -DGPROF");	if (machine == MACHINE_VAX)		if (kdebug)			fprintf(ofp, " -DKDEBUG");	if (cputype == 0) {		printf("cpu type must be specified\n");		exit(1);	}	{ struct cputype *cp, *prevp;	  for (cp = cputype; cp; cp = cp->cpu_next) {		for (prevp = cputype; prevp != cp; prevp = prevp->cpu_next) {			if (strcmp(cp->cpu_name, prevp->cpu_name) == 0) {				break;			}		}		if (prevp == cp) {			fprintf(ofp, " -D%s", cp->cpu_name);		}	  }	}	if (source)		fprintf(ofp," -DRELEASE='\"'%3.1f'\"' -DVERSION='\"'%d'\"'",				release,version);	for (op = opt; op; op = op->op_next)		if (op->op_value)			fprintf(ofp, " -D%s=\"%s\"", op->op_name, op->op_value);		else {			if (eq(op->op_name,"GFLOAT"))				fprintf(ofp, " -Mg");			else if (eq(op->op_name,"BINARY")) 				/*			 	 *  BINARY option specified then set			 	 *  dontload flag			 	 */				dontload++;			else if (eq(op->op_name,"EMULFLT"))				/* For the floating emulation */				emulation_float++;			fprintf(ofp, " -D%s", op->op_name);		}	fprintf(ofp, "\n");	if (hadtz == 0)		printf("timezone not specified; gmt assumed\n");	switch (machine) {	case MACHINE_VAX:	case MACHINE_MIPS:	   if (maxusers == 0) {		printf("maxusers not specified; 24 assumed\n");		maxusers = 24;	   } else if (maxusers < 8) {		printf("maxusers less than 8 not recommended\n");	   } else if (maxusers > 256) {		printf("maxusers truncated to 256\n");		maxusers = 256;	   }	   min_swapfrag = (CLSIZE * KLMAX * NBPG)/1024; /* min value of swapfrag in Kbytes*/	   if(dmmin)		fprintf(stderr,"Warning: dmmin is no longer supported\n");	   if(swapfrag) {		if(min_swapfrag > swapfrag) {			printf("swapfrag (%d) is too small, set to %d\n", swapfrag, min_swapfrag);			swapfrag = ctod((min_swapfrag * 1024)/NBPG); /* ultimately it should 									be in disk blocks 									for allocation */	   	}	   	else if (swapfrag % min_swapfrag != 0) {			printf("swapfrag (%d) must be a multiple of CLSIZE*KLMAX (%d), swapfrag set to %d\n"			       , swapfrag , min_swapfrag, min_swapfrag);			swapfrag = ctod((min_swapfrag * 1024)/NBPG); /* ultimately it should									be in disk blocks 									for allocation */	   	}		else {			swapfrag = ctod((swapfrag * 1024)/NBPG); /* convert user given 								    Kbytes to disk blocks 								    with portability 								    aspect in mind */		}	   }	   if(dmmax)		fprintf(stderr,"Warning: dmmax is no longer supported\n");	   if (maxuprc == 0 ) {		printf("maxuprc not specified; 50 assumed\n");		maxuprc = 50;	   }	   if (physmem < MINMEM_MB) {		printf("physmem not specified or too small; %d megabytes assumed\n", MINMEM_MB);		physmem = MINMEM_MB;	   }	   if(smsmat && smsmat > (GIG << 20)) {			printf("smsmat too large, reduced to %u bytes\n", 			    (GIG << 20));			smsmat = (GIG << 20);	   }	   if(maxtsiz && maxtsiz > GIG) {			printf("maxtsiz (%u) too large, reduced to %d megabytes\n", 			    maxtsiz, GIG);			maxtsiz = GIG;	   }	if(maxdsiz) {		/* bytes */		if(maxdsiz > GIG ){			printf("maxdsiz (%d) too large, reduced to %d megabytes\n", 			maxdsiz, GIG);			maxdsiz = (GIG << 20);		} else			maxdsiz <<= 20;	}	if(maxssiz) {		/* bytes */		if(maxssiz > GIG){			printf("maxssiz (%d) too large, reduced to %d megabytes\n", 			maxssiz, GIG);			maxssiz = (GIG << 20);		} else			maxssiz <<= 20;	}	   /*	    * Configurable buffer cache	    *	    * Only recognized in a machine specific config file.	    * This is a  percentage of memory to be allocated for buffer cache.	    * Assign a default, if necessary, and run sanity tests.	    * The computation for legal maximum depends upon the MINMEM_MB	    * value in machine/param.h. This allows the user to use everything	    * but what's required to boot for the buffer cache.	    */#define MINBUFCACHE	10	   if (source) {	/* BINARY */	    if (bufcache != 0)		printf("bufcache value ignored\n");           } else {	/* machine specific */	    if (bufcache == 0 ) {/*		printf("bufcache not specified; %d%% of memory assumed\n",		    MINBUFCACHE);*/		bufcache = MINBUFCACHE;            } else if (bufcache < MINBUFCACHE) {		printf("illegal bufcache value; %d%% of memory used\n",		   MINBUFCACHE);		bufcache = MINBUFCACHE;            } else if (bufcache > 99) {		bufcache = 99;	    }/*	    maxbufcache = ((float)(physmem - MINMEM_MB) / physmem) * 100;	    if (bufcache > MINBUFCACHE  &&  bufcache > maxbufcache) {		printf("bufcache too large; %d%% of memory used\n",		   maxbufcache);		bufcache = maxbufcache;	    }*/           }	   if (processors == 0 ) {		printf("processors not specified; 1 assumed\n");		processors = 1;	   }	break;		case MACHINE_SUN:	   if (maxusers == 0) {		printf("maxusers not specified; 8 assumed\n");		maxusers = 8;	   } else if (maxusers < 2) {		printf("minimum of 2 maxusers assumed\n");		maxusers = 2;	   } else if (maxusers > 32) {		printf("maxusers truncated to 32\n");		maxusers = 32;	   }	break;	}	fprintf(ofp, "PARAM=-DTIMEZONE=%d -DDST=%d -DMAXUSERS=%d -DMAXUPRC=%d -DPHYSMEM=%d -DNCPU=%d ",		timezone, dst, maxusers, maxuprc, physmem,		processors);	if (!source)		fprintf(ofp, "-DBUFCACHE=%d ", bufcache);	if (smmin)		fprintf(ofp,"-DSMMIN=%d ",smmin);	if (smmax)		fprintf(ofp,"-DSMMAX=%d ",smmax);	if (smbrk)		fprintf(ofp,"-DSMBRK=%d ",smbrk);	if (smseg)		fprintf(ofp,"-DSMSEG=%d ",smseg);	if (smsmat)		fprintf(ofp,"-DSMSMAT=%d ",smsmat);	if (maxtsiz) 		fprintf(ofp,"-DMAXTSEG=%u ", maxtsiz);	if (maxdsiz)		fprintf(ofp,"-DMAXDSIZ=%u ", maxdsiz);	if (maxssiz) 		fprintf(ofp,"-DMAXSSIZ=%u ", maxssiz);	if (swapfrag)		fprintf(ofp,"-DSWAPFRAG=%d ", swapfrag);	if (maxuva)		fprintf(ofp,"-DMAXUVA=%d ", maxuva);	if (maxretry)		fprintf(ofp,"-DMAXRETRY=%d ", maxretry);	if (vasslop){		/*		 * User is giving in terms of Kbytes. Convert it to 		 * disk blocks and pass		 * Assume disk block size as 512 for lack of anything better.		 */		vasslop = (vasslop * 1024)/512;		fprintf(ofp,"-DVASSLOP=%d ", vasslop);	}		fprintf(ofp,"\n");	while (fgets(line, BUFSIZ, ifp) != 0) {		if (*line == '%')			goto percent;		if (profiling && strncmp(line, "COPTS=", 6) == 0) {			register char *cp;			fprintf(ofp, 			    "GPROF.EX=/usr/src/lib/libc/%s/csu/gmon.ex\n",			    machinename);			cp = index(line, '\n');			if (cp)				*cp = 0;			cp = line + 6;			while (*cp && (*cp == ' ' || *cp == '\t'))				cp++;			COPTS = malloc((unsigned)(strlen(cp) + 1));			if (COPTS == 0) {				printf("config: out of memory\n");				exit(1);			}			strcpy(COPTS, cp);			fprintf(ofp, "%s -pg\n", line);			continue;		}		fprintf(ofp, "%s", line);		continue;	percent:		if (eq(line, "%OBJS\n"))			do_objs(ofp);		else if (eq(line, "%EMULO\n"))			do_emulo(ofp);		else if (eq(line, "%EMULS\n"))			do_emuls(ofp);		else if (eq(line, "%CFILES\n"))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -