Index: stable/11/usr.sbin/config/config.5 =================================================================== --- stable/11/usr.sbin/config/config.5 (revision 336342) +++ stable/11/usr.sbin/config/config.5 (revision 336343) @@ -1,422 +1,440 @@ .\" Copyright (c) 2003 Joseph Koshy .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" -.Dd June 22, 2018 +.Dd June 26, 2018 .Dt CONFIG 5 .Os .Sh NAME .Nm config .Nd kernel configuration file format .Sh DESCRIPTION A kernel configuration file specifies the configuration of a .Fx kernel. It is processed by .Xr config 8 to create a build environment where a kernel may be built using .Xr make 1 . .Ss Lexical Structure A kernel configuration file comprises a sequence of specification directives. .Pp A specification directive starts with a keyword at the beginning of the line and is followed by additional parameters. .Pp A specification directive may be terminated by a semicolon .Ql \&; or by a newline. Long input lines may be broken into shorter lines by starting the second and subsequent lines with a white space character. .Pp Case is significant, .Dq Li machine and .Dq Li MACHINE are different tokens. .Pp A double quote character .Ql \[dq] starts a quoted string. All characters up to the next quote character form the value of the quoted string. A .Ql \[dq] character may be inserted into a quoted string by using the sequence .Ql \e\[dq] . .Pp Numbers are specified using .Tn C Ns -style syntax. .Pp A .Ql # character starts a comment; all characters from the .Ql # character till the end of the current line are ignored. .Pp Whitespace between tokens is ignored, except inside quoted strings. Whitespace following a comment line is ignored. .Ss Configuration Directives Kernel configuration directives may appear in any order in a kernel configuration file. Directives are processed in order of appearance with subsequent directive lines overriding the effect of prior ones. .Pp The list of keywords and their meanings are as follows: .Pp .Bl -tag -width indent -compact .\" -------- CPU -------- .It Ic cpu Ar cputype Specify the CPU this kernel will run on. There can be more than one .Ic cpu directive in a configuration file. The allowed list of CPU names is architecture specific and is defined in the file .Pa sys/conf/options. Ns Aq Ar arch . .\" -------- DEVICE -------- .Pp .It Ic device Ar name Op , Ar name Op ... .It Ic devices Ar name Op , Ar name Op ... Configures the specified devices for inclusion into the kernel image. Devices that are common to all architectures are defined in the file .Pa sys/conf/files . Devices that are specific to architecture .Ar arch are defined in the file .Pa sys/conf/files. Ns Aq Ar arch . .\" -------- ENV -------- .Pp .It Ic env Ar filename Specifies a filename containing a kernel environment definition. The kernel normally uses an environment prepared for it at boot time by .Xr loader 8 . This directive makes the kernel ignore the boot environment and use the compiled-in environment instead, unless the boot environment contains .Va static_env.disabled=1 . .Pp This directive is useful for setting kernel tunables in embedded environments that do not start from .Xr loader 8 . +.Pp +All +.Ic env +and +.Ic envvar +directives will be processed and added to the static environment in reversed +order of appearance so that later specified variables properly override earlier +specified variables. +Note that within +.Ar filename , +the first appearance of a given variable will be the first one seen by the +kernel, effectively shadowing any later appearances of the same variable within +.Ar filename . .\" -------- ENVVAR -------- .Pp .It Ic envvar Ar setting Specifies an individual environment setting to be added to the kernel's compiled-in environment. .Ar setting must be of the form .Dq Va name=value . Optional quotes are supported in both name and value. -All environment variables specified with -.Ic envvar -will be set after any +.Pp +All .Ic env -files are included. +and +.Ic envvar +directives will be processed and added to the static environment in reversed +order of appearance so that later specified variables properly override earlier +specified variables. .\" -------- FILES -------- .Pp .It Ic files Ar filename Specifies a file containing a list of files specific to that kernel configuration file (a la .Pa files. Ns Aq Ar arch ) . .\" -------- HINTS -------- .Pp .It Ic hints Ar filename Specifies a file to load a static device configuration specification from. From .Fx 5.0 onwards, the kernel reads the system's device configuration at boot time (see .Xr device.hints 5 ) . This directive configures the kernel to use the static device configuration listed in .Ar filename , unless the boot environment contains .Va static_hints.disabled=1 . The file .Ar filename must conform to the syntax specified by .Xr device.hints 5 . Multiple hints lines are allowed. -The resulting hints will be the files concatenated in the order of appearance. +The resulting hints will be the files concatenated in reverse order of +appearance so that hints in later files properly override hints in earlier +files. .\" -------- IDENT -------- .Pp .It Ic ident Ar name Set the kernel name to .Ar name . At least one .Ic ident directive is required. .\" -------- INCLUDE -------- .Pp .It Ic include Ar filename Read subsequent text from file .Ar filename and return to the current file after .Ar filename is successfully processed. .\" -------- MACHINE -------- .Pp .It Ic machine Ar arch Op Ar cpuarch Specifies the architecture of the machine the kernel is being compiled for. Legal values for .Ar arch include: .Pp .Bl -tag -width ".Cm powerpc" -compact .It Cm alpha The DEC Alpha architecture. .It Cm arm The ARM architecture. .It Cm amd64 The AMD x86-64 architecture. .It Cm i386 The Intel x86 based PC architecture. .It Cm mips The MIPS architecture. .It Cm pc98 The PC98 architecture. .It Cm powerpc The IBM PowerPC architecture. .It Cm sparc64 The Sun Sparc64 architecture. .El .Pp If argument .Ar cpuarch is specified, it points .Xr config 8 to the cpu architecture of the machine. Currently the .Cm pc98 architecture requires its cpu architecture to be set to .Cm i386 . When .Ar cpuarch is not specified, it is assumed to be the same as .Ar arch . .Ar arch corresponds to MACHINE. .Ar cpuarch corresponds to MACHINE_ARCH. .Pp A kernel configuration file may have only one .Ic machine directive. .\" -------- MAKEOPTION -------- .Pp .It Ic makeoption Ar options .It Ic makeoptions Ar options Add .Ar options to the generated makefile. .Pp The .Ar options argument is a comma separated list of one or more option specifications. Each option specification has the form .Pp .D1 Ar MakeVariableName Ns Op = Ns Ar Value .D1 Ar MakeVariableName Ns += Ns Ar Value .Pp and results in the appropriate .Xr make 1 variable definition being inserted into the generated makefile. If only the name of the .Xr make 1 variable is specified, .Ar value is assumed to be the empty string. .Pp Example: .Bd -literal -offset indent -compact makeoptions MYMAKEOPTION="foo" makeoptions MYMAKEOPTION+="bar" makeoptions MYNULLMAKEOPTION .Ed .\" -------- MAXUSERS -------- .Pp .It Ic maxusers Ar number This optional directive is used to configure the size of some kernel data structures. The parameter .Ar number can be 0 (the default) or an integer greater than or equal to 2. A value of 0 indicates that the kernel should configure its data structures according to the size of available physical memory. If auto configuration is requested, the kernel will set this tunable to a value between 32 and 384. .Pp As explained in .Xr tuning 7 , this tunable can also be set at boot time using .Xr loader 8 . .\" -------- NOCPU -------- .Pp .It Ic nocpu Ar cputype Remove the specified CPU from the list of previously selected CPUs. This directive can be used to cancel the effect of .Ic cpu directives in files included using .Ic include . .\" -------- NODEVICE -------- .Pp .It Ic nodevice Ar name Op , Ar name Op ... .It Ic nodevices Ar name Op , Ar name Op ... Remove the specified devices from the list of previously selected devices. This directive can be used to cancel the effects of .Ic device or .Ic devices directives in files included using .Ic include . .\" -------- NOMAKEOPTION -------- .Pp .It Ic nomakeoption Ar name .It Ic nomakeoptions Ar name Removes previously defined .Xr make 1 option .Ar name from the kernel build. This directive can be used to cancel the effects of .Ic makeoption directives in files included using .Ic include . .\" -------- NOOPTION -------- .Pp .It Ic nooption Ar name Op , Ar name Op ... .It Ic nooptions Ar name Op , Ar name Op ... Remove the specified kernel options from the list of previously defined options. This directive can be used to cancel the effects of .Ic option or .Ic options directives in files included using .Ic include . .\" -------- OPTIONS -------- .Pp .It Ic option Ar optionspec Op , Ar optionspec Op ... .It Ic options Ar optionspec Op , Ar optionspec Op ... Add compile time kernel options to the kernel build. Each option specification has the form .Pp .D1 Ar name Ns Op = Ns Ar value .Pp If .Ar value is not specified, it is assumed to be .Dv NULL . Options common to all architectures are specified in the file .Pa sys/conf/options . Options specific to architecture .Ar arch are specified in the file .Pa sys/conf/options. Ns Aq Ar arch . .\" -------- PROFILE -------- .Pp .It Ic profile Ar number Enables kernel profiling if .Ar number is non-zero. If .Ar number is 2 or greater, the kernel is configured for high-resolution profiling. Kernels can also be built for profiling using the .Fl p option to .Xr config 8 . .El .Ss Obsolete Directives The following kernel configuration directives are obsolete. .Bl -tag -width indent .\" -------- CONFIG -------- .It Ic config This directive was used to specify the device to be used for the root file system. From .Fx 4.0 onwards, this information is passed to a booting kernel by .Xr loader 8 . .El .Sh FILES .Bl -tag -width ".Pa sys/conf/Makefile. Ns Ar arch" -compact .It Pa sys/compile/ Ns Ar NAME Compile directory created from a kernel configuration. .It Pa sys/conf/Makefile. Ns Ar arch .Pa Makefile fragments for architecture .Ar arch . .It Pa sys/conf/files Devices common to all architectures. .It Pa sys/conf/files. Ns Ar arch Devices for architecture .Ar arch . .It Pa sys/conf/options Options common to all architectures. .It Pa sys/conf/options. Ns Ar arch Options for architecture .Ar arch . .El .Sh SEE ALSO .Xr kenv 1 , .Xr make 1 , .Xr device.hints 5 , .Xr loader.conf 5 , .Xr config 8 , .Xr kldload 8 , .Xr loader 8 .Rs .%T "Building 4.4BSD Kernels with Config" .%A "Samuel J. Leffler" .%A "Michael J. Karels" .Re .Sh HISTORY The .Xr config 8 utility first appeared in .Bx 4.1 , and was subsequently revised in .Bx 4.4 . .Pp The kernel configuration mechanism changed further in .Fx 4.0 and .Fx 5.0 , moving toward an architecture supporting dynamic kernel configuration. Index: stable/11/usr.sbin/config/config.h =================================================================== --- stable/11/usr.sbin/config/config.h (revision 336342) +++ stable/11/usr.sbin/config/config.h (revision 336343) @@ -1,218 +1,219 @@ /* * Copyright (c) 1980, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)config.h 8.1 (Berkeley) 6/6/93 * $FreeBSD$ */ /* * Config. */ #include #include +#include #include #include struct cfgfile { STAILQ_ENTRY(cfgfile) cfg_next; char *cfg_path; }; STAILQ_HEAD(, cfgfile) cfgfiles; struct file_list { STAILQ_ENTRY(file_list) f_next; char *f_fn; /* the name */ int f_type; /* type */ u_char f_flags; /* see below */ char *f_compilewith; /* special make rule if present */ char *f_depends; /* additional dependencies */ char *f_clean; /* File list to add to clean rule */ char *f_warn; /* warning message */ const char *f_objprefix; /* prefix string for object name */ }; struct files_name { char *f_name; STAILQ_ENTRY(files_name) f_next; }; /* * Types. */ #define NORMAL 1 #define PROFILING 3 #define NODEPEND 4 #define LOCAL 5 #define DEVDONE 0x80000000 #define TYPEMASK 0x7fffffff /* * Attributes (flags). */ #define NO_IMPLCT_RULE 1 #define NO_OBJ 2 #define BEFORE_DEPEND 4 #define NOWERROR 16 struct device { int d_done; /* processed */ char *d_name; /* name of device (e.g. rk11) */ #define UNKNOWN -2 /* -2 means not set yet */ STAILQ_ENTRY(device) d_next; /* Next one in list */ }; struct config { char *s_sysname; }; /* * Config has a global notion of which machine type is * being used. It uses the name of the machine in choosing * files and directories. Thus if the name of the machine is ``i386'', * it will build from ``Makefile.i386'' and use ``../i386/inline'' * in the makerules, etc. machinearch is the global notion of the * MACHINE_ARCH for this MACHINE. */ char *machinename; char *machinearch; /* * For each machine, a set of CPU's may be specified as supported. * These and the options (below) are put in the C flags in the makefile. */ struct cputype { char *cpu_name; SLIST_ENTRY(cputype) cpu_next; }; SLIST_HEAD(, cputype) cputype; /* * A set of options may also be specified which are like CPU types, * but which may also specify values for the options. * A separate set of options may be defined for make-style options. */ struct opt { char *op_name; char *op_value; int op_ownfile; /* true = own file, false = makefile */ SLIST_ENTRY(opt) op_next; SLIST_ENTRY(opt) op_append; }; SLIST_HEAD(opt_head, opt) opt, mkopt, rmopts; struct opt_list { char *o_name; char *o_file; int o_flags; #define OL_ALIAS 1 SLIST_ENTRY(opt_list) o_next; }; SLIST_HEAD(, opt_list) otab; struct envvar { char *env_str; + bool env_is_file; STAILQ_ENTRY(envvar) envvar_next; }; STAILQ_HEAD(envvar_head, envvar) envvars; struct hint { char *hint_name; STAILQ_ENTRY(hint) hint_next; }; STAILQ_HEAD(hint_head, hint) hints; struct includepath { char *path; SLIST_ENTRY(includepath) path_next; }; SLIST_HEAD(, includepath) includepath; /* * Tag present in the kernelconf.tmlp template file. It's mandatory for those * two strings to be the same. Otherwise you'll get into trouble. */ #define KERNCONFTAG "%%KERNCONFFILE%%" /* * Faked option to note, that the configuration file has been taken from the * kernel file and inclusion of DEFAULTS etc.. isn't nessesery, because we * already have a list of all required devices. */ #define OPT_AUTOGEN "CONFIG_AUTOGENERATED" extern char *ident; -extern char *env; extern char kernconfstr[]; extern int do_trace; extern int envmode; extern int hintmode; extern int incignore; char *get_word(FILE *); char *get_quoted_word(FILE *); char *path(const char *); char *raisestr(char *); void remember(const char *); void moveifchanged(const char *, const char *); int yylex(void); void options(void); void makefile(void); void makeenv(void); void makehints(void); void headers(void); void cfgfile_add(const char *); void cfgfile_removeall(void); FILE *open_makefile_template(void); extern STAILQ_HEAD(device_head, device) dtab; extern char errbuf[80]; extern int yyline; extern const char *yyfile; extern STAILQ_HEAD(file_list_head, file_list) ftab; extern STAILQ_HEAD(files_name_head, files_name) fntab; extern int profiling; extern int debugging; extern int found_defaults; extern int maxusers; extern char *PREFIX; /* Config file name - for error messages */ extern char srcdir[]; /* root of the kernel source tree */ #define eq(a,b) (!strcmp(a,b)) #define ns(s) strdup(s) Index: stable/11/usr.sbin/config/config.y =================================================================== --- stable/11/usr.sbin/config/config.y (revision 336342) +++ stable/11/usr.sbin/config/config.y (revision 336343) @@ -1,481 +1,483 @@ %union { char *str; int val; struct file_list *file; } %token ARCH %token COMMA %token CONFIG %token CPU %token NOCPU %token DEVICE %token NODEVICE %token ENV %token ENVVAR %token EQUALS %token PLUSEQUALS %token HINTS %token IDENT %token MAXUSERS %token PROFILE %token OPTIONS %token NOOPTION %token MAKEOPTIONS %token NOMAKEOPTION %token SEMICOLON %token INCLUDE %token FILES %token ENVLINE %token ID %token NUMBER %type Save_id %type Opt_value %type Dev %token PATH %{ /* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)config.y 8.1 (Berkeley) 6/6/93 * $FreeBSD$ */ #include #include #include #include #include #include "config.h" struct device_head dtab; char *ident; -char *env; int envmode; int hintmode; int yyline; const char *yyfile; struct file_list_head ftab; struct files_name_head fntab; char errbuf[80]; int maxusers; #define ns(s) strdup(s) int include(const char *, int); void yyerror(const char *s); int yywrap(void); static void newdev(char *name); static void newfile(char *name); +static void newenvvar(char *name, bool is_file); static void rmdev_schedule(struct device_head *dh, char *name); static void newopt(struct opt_head *list, char *name, char *value, int append); static void rmopt_schedule(struct opt_head *list, char *name); static char * devopt(char *dev) { char *ret = malloc(strlen(dev) + 5); sprintf(ret, "DEV_%s", dev); raisestr(ret); return ret; } %} %% Configuration: Many_specs ; Many_specs: Many_specs Spec | /* lambda */ ; Spec: Device_spec SEMICOLON | Config_spec SEMICOLON | INCLUDE PATH SEMICOLON { if (incignore == 0) include($2, 0); }; | INCLUDE ID SEMICOLON { if (incignore == 0) include($2, 0); }; | FILES ID SEMICOLON { newfile($2); }; | SEMICOLON | error SEMICOLON ; Config_spec: ARCH Save_id { if (machinename != NULL && !eq($2, machinename)) errx(1, "%s:%d: only one machine directive is allowed", yyfile, yyline); machinename = $2; machinearch = $2; } | ARCH Save_id Save_id { if (machinename != NULL && !(eq($2, machinename) && eq($3, machinearch))) errx(1, "%s:%d: only one machine directive is allowed", yyfile, yyline); machinename = $2; machinearch = $3; } | CPU Save_id { struct cputype *cp = (struct cputype *)calloc(1, sizeof (struct cputype)); if (cp == NULL) err(EXIT_FAILURE, "calloc"); cp->cpu_name = $2; SLIST_INSERT_HEAD(&cputype, cp, cpu_next); } | NOCPU Save_id { struct cputype *cp, *cp2; SLIST_FOREACH_SAFE(cp, &cputype, cpu_next, cp2) { if (eq(cp->cpu_name, $2)) { SLIST_REMOVE(&cputype, cp, cputype, cpu_next); free(cp); } } } | OPTIONS Opt_list | NOOPTION NoOpt_list | MAKEOPTIONS Mkopt_list | NOMAKEOPTION Save_id { rmopt_schedule(&mkopt, $2); } | IDENT ID { ident = $2; } | System_spec | MAXUSERS NUMBER { maxusers = $2; } | PROFILE NUMBER { profiling = $2; } | - ENV ID { - env = $2; - envmode = 1; - } | - ENVVAR ENVLINE { - struct envvar *envvar; - - envvar = (struct envvar *)calloc(1, sizeof (struct envvar)); - if (envvar == NULL) - err(EXIT_FAILURE, "calloc"); - envvar->env_str = $2; - STAILQ_INSERT_TAIL(&envvars, envvar, envvar_next); - envmode = 1; - } | + ENV ID { newenvvar($2, true); } | + ENVVAR ENVLINE { newenvvar($2, false); } | HINTS ID { struct hint *hint; hint = (struct hint *)calloc(1, sizeof (struct hint)); if (hint == NULL) err(EXIT_FAILURE, "calloc"); hint->hint_name = $2; - STAILQ_INSERT_TAIL(&hints, hint, hint_next); + STAILQ_INSERT_HEAD(&hints, hint, hint_next); hintmode = 1; } System_spec: CONFIG System_id System_parameter_list { errx(1, "%s:%d: root/dump/swap specifications obsolete", yyfile, yyline); } | CONFIG System_id ; System_id: Save_id { newopt(&mkopt, ns("KERNEL"), $1, 0); }; System_parameter_list: System_parameter_list ID | ID ; Opt_list: Opt_list COMMA Option | Option ; NoOpt_list: NoOpt_list COMMA NoOption | NoOption ; Option: Save_id { newopt(&opt, $1, NULL, 0); if (strchr($1, '=') != NULL) errx(1, "%s:%d: The `=' in options should not be " "quoted", yyfile, yyline); } | Save_id EQUALS Opt_value { newopt(&opt, $1, $3, 0); } ; NoOption: Save_id { rmopt_schedule(&opt, $1); }; Opt_value: ID { $$ = $1; } | NUMBER { char buf[80]; (void) snprintf(buf, sizeof(buf), "%d", $1); $$ = ns(buf); } ; Save_id: ID { $$ = $1; } ; Mkopt_list: Mkopt_list COMMA Mkoption | Mkoption ; Mkoption: Save_id { newopt(&mkopt, $1, ns(""), 0); } | Save_id EQUALS { newopt(&mkopt, $1, ns(""), 0); } | Save_id EQUALS Opt_value { newopt(&mkopt, $1, $3, 0); } | Save_id PLUSEQUALS Opt_value { newopt(&mkopt, $1, $3, 1); } ; Dev: ID { $$ = $1; } ; Device_spec: DEVICE Dev_list | NODEVICE NoDev_list ; Dev_list: Dev_list COMMA Device | Device ; NoDev_list: NoDev_list COMMA NoDevice | NoDevice ; Device: Dev { newopt(&opt, devopt($1), ns("1"), 0); /* and the device part */ newdev($1); } NoDevice: Dev { char *s = devopt($1); rmopt_schedule(&opt, s); free(s); /* and the device part */ rmdev_schedule(&dtab, $1); } ; %% void yyerror(const char *s) { errx(1, "%s:%d: %s", yyfile, yyline + 1, s); } int yywrap(void) { if (found_defaults) { if (freopen(PREFIX, "r", stdin) == NULL) err(2, "%s", PREFIX); yyfile = PREFIX; yyline = 0; found_defaults = 0; return 0; } return 1; } /* * Add a new file to the list of files. */ static void newfile(char *name) { struct files_name *nl; nl = (struct files_name *) calloc(1, sizeof *nl); if (nl == NULL) err(EXIT_FAILURE, "calloc"); nl->f_name = name; STAILQ_INSERT_TAIL(&fntab, nl, f_next); } - + +static void +newenvvar(char *name, bool is_file) +{ + struct envvar *envvar; + + envvar = (struct envvar *)calloc(1, sizeof (struct envvar)); + if (envvar == NULL) + err(EXIT_FAILURE, "calloc"); + envvar->env_str = name; + envvar->env_is_file = is_file; + STAILQ_INSERT_HEAD(&envvars, envvar, envvar_next); + envmode = 1; +} + /* * Find a device in the list of devices. */ static struct device * finddev(struct device_head *dlist, char *name) { struct device *dp; STAILQ_FOREACH(dp, dlist, d_next) if (eq(dp->d_name, name)) return (dp); return (NULL); } /* * Add a device to the list of devices. */ static void newdev(char *name) { struct device *np; if (finddev(&dtab, name)) { fprintf(stderr, "WARNING: duplicate device `%s' encountered.\n", name); return; } np = (struct device *) calloc(1, sizeof *np); if (np == NULL) err(EXIT_FAILURE, "calloc"); np->d_name = name; STAILQ_INSERT_TAIL(&dtab, np, d_next); } /* * Schedule a device to removal. */ static void rmdev_schedule(struct device_head *dh, char *name) { struct device *dp; dp = finddev(dh, name); if (dp != NULL) { STAILQ_REMOVE(dh, dp, device, d_next); free(dp->d_name); free(dp); } } /* * Find an option in the list of options. */ static struct opt * findopt(struct opt_head *list, char *name) { struct opt *op; SLIST_FOREACH(op, list, op_next) if (eq(op->op_name, name)) return (op); return (NULL); } /* * Add an option to the list of options. */ static void newopt(struct opt_head *list, char *name, char *value, int append) { struct opt *op, *op2; /* * Ignore inclusions listed explicitly for configuration files. */ if (eq(name, OPT_AUTOGEN)) { incignore = 1; return; } op2 = findopt(list, name); if (op2 != NULL && !append) { fprintf(stderr, "WARNING: duplicate option `%s' encountered.\n", name); return; } op = (struct opt *)calloc(1, sizeof (struct opt)); if (op == NULL) err(EXIT_FAILURE, "calloc"); op->op_name = name; op->op_ownfile = 0; op->op_value = value; if (op2 != NULL) { while (SLIST_NEXT(op2, op_append) != NULL) op2 = SLIST_NEXT(op2, op_append); SLIST_NEXT(op2, op_append) = op; } else SLIST_INSERT_HEAD(list, op, op_next); } /* * Remove an option from the list of options. */ static void rmopt_schedule(struct opt_head *list, char *name) { struct opt *op; op = findopt(list, name); if (op != NULL) { SLIST_REMOVE(list, op, opt, op_next); free(op->op_name); free(op); } } Index: stable/11/usr.sbin/config/mkmakefile.c =================================================================== --- stable/11/usr.sbin/config/mkmakefile.c (revision 336342) +++ stable/11/usr.sbin/config/mkmakefile.c (revision 336343) @@ -1,822 +1,818 @@ /* * Copyright (c) 1980, 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef lint #if 0 static char sccsid[] = "@(#)mkmakefile.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ /* * Build the makefile for the system, from * the information in the files files and the * additional files for the machine being compiled to. */ #include #include #include #include #include #include #include #include "y.tab.h" #include "config.h" #include "configvers.h" static char *tail(char *); static void do_clean(FILE *); static void do_rules(FILE *); static void do_xxfiles(char *, FILE *); static void do_objs(FILE *); static void do_before_depend(FILE *); static int opteq(const char *, const char *); static void read_files(void); static void errout(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); exit(1); } /* * Lookup a file, by name. */ static struct file_list * fl_lookup(char *file) { struct file_list *fp; STAILQ_FOREACH(fp, &ftab, f_next) { if (eq(fp->f_fn, file)) return (fp); } return (0); } /* * Make a new file list entry */ static struct file_list * new_fent(void) { struct file_list *fp; fp = (struct file_list *) calloc(1, sizeof *fp); if (fp == NULL) err(EXIT_FAILURE, "calloc"); STAILQ_INSERT_TAIL(&ftab, fp, f_next); return (fp); } /* * Open the correct Makefile and return it, or error out. */ FILE * open_makefile_template(void) { FILE *ifp; char line[BUFSIZ]; snprintf(line, sizeof(line), "../../conf/Makefile.%s", machinename); ifp = fopen(line, "r"); if (ifp == NULL) { snprintf(line, sizeof(line), "Makefile.%s", machinename); ifp = fopen(line, "r"); } if (ifp == NULL) err(1, "%s", line); return (ifp); } /* * Build the makefile from the skeleton */ void makefile(void) { FILE *ifp, *ofp; char line[BUFSIZ]; struct opt *op, *t; read_files(); ifp = open_makefile_template(); ofp = fopen(path("Makefile.new"), "w"); if (ofp == NULL) err(1, "%s", path("Makefile.new")); fprintf(ofp, "KERN_IDENT=%s\n", ident); fprintf(ofp, "MACHINE=%s\n", machinename); fprintf(ofp, "MACHINE_ARCH=%s\n", machinearch); SLIST_FOREACH_SAFE(op, &mkopt, op_next, t) { fprintf(ofp, "%s=%s", op->op_name, op->op_value); while ((op = SLIST_NEXT(op, op_append)) != NULL) fprintf(ofp, " %s", op->op_value); fprintf(ofp, "\n"); } if (debugging) fprintf(ofp, "DEBUG=-g\n"); if (profiling) fprintf(ofp, "PROFLEVEL=%d\n", profiling); if (*srcdir != '\0') fprintf(ofp,"S=%s\n", srcdir); while (fgets(line, BUFSIZ, ifp) != NULL) { if (*line != '%') { fprintf(ofp, "%s", line); continue; } if (eq(line, "%BEFORE_DEPEND\n")) do_before_depend(ofp); else if (eq(line, "%OBJS\n")) do_objs(ofp); else if (strncmp(line, "%FILES.", 7) == 0) do_xxfiles(line, ofp); else if (eq(line, "%RULES\n")) do_rules(ofp); else if (eq(line, "%CLEAN\n")) do_clean(ofp); else if (strncmp(line, "%VERSREQ=", 9) == 0) line[0] = '\0'; /* handled elsewhere */ else fprintf(stderr, "Unknown %% construct in generic makefile: %s", line); } (void) fclose(ifp); (void) fclose(ofp); moveifchanged(path("Makefile.new"), path("Makefile")); } /* * Build hints.c from the skeleton */ void makehints(void) { FILE *ifp, *ofp; char line[BUFSIZ]; char *s; struct hint *hint; ofp = fopen(path("hints.c.new"), "w"); if (ofp == NULL) err(1, "%s", path("hints.c.new")); fprintf(ofp, "#include \n"); fprintf(ofp, "#include \n"); fprintf(ofp, "\n"); fprintf(ofp, "int hintmode = %d;\n", hintmode); fprintf(ofp, "char static_hints[] = {\n"); STAILQ_FOREACH(hint, &hints, hint_next) { ifp = fopen(hint->hint_name, "r"); if (ifp == NULL) err(1, "%s", hint->hint_name); while (fgets(line, BUFSIZ, ifp) != NULL) { /* zap trailing CR and/or LF */ while ((s = strrchr(line, '\n')) != NULL) *s = '\0'; while ((s = strrchr(line, '\r')) != NULL) *s = '\0'; /* remove # comments */ s = strchr(line, '#'); if (s) *s = '\0'; /* remove any whitespace and " characters */ s = line; while (*s) { if (*s == ' ' || *s == '\t' || *s == '"') { while (*s) { s[0] = s[1]; s++; } /* start over */ s = line; continue; } s++; } /* anything left? */ if (*line == '\0') continue; fprintf(ofp, "\"%s\\0\"\n", line); } fclose(ifp); } fprintf(ofp, "\"\\0\"\n};\n"); fclose(ofp); moveifchanged(path("hints.c.new"), path("hints.c")); } static void sanitize_envline(char *result, const char *src) { const char *eq; char c, *dst; bool leading; /* If there is no '=' it's not a well-formed name=value line. */ if ((eq = strchr(src, '=')) == NULL) { *result = 0; return; } dst = result; /* Copy chars before the '=', skipping any leading spaces/quotes. */ leading = true; while (src < eq) { c = *src++; if (leading && (isspace(c) || c == '"')) continue; *dst++ = c; leading = false; } /* If it was all leading space, we don't have a well-formed line. */ if (leading) { *result = 0; return; } /* Trim spaces/quotes immediately before the '=', then copy the '='. */ while (isspace(dst[-1]) || dst[-1] == '"') --dst; *dst++ = *src++; /* Copy chars after the '=', skipping any leading whitespace. */ leading = true; while ((c = *src++) != 0) { if (leading && (isspace(c) || c == '"')) continue; *dst++ = c; leading = false; } /* If it was all leading space, it's a valid 'var=' (nil value). */ if (leading) { *dst = 0; return; } /* Trim trailing whitespace and quotes. */ while (isspace(dst[-1]) || dst[-1] == '"') --dst; *dst = 0; } /* * Build env.c from the skeleton */ void makeenv(void) { FILE *ifp, *ofp; char line[BUFSIZ], result[BUFSIZ], *linep; struct envvar *envvar; - if (env) { - ifp = fopen(env, "r"); - if (ifp == NULL) - err(1, "%s", env); - } else { - ifp = NULL; - } ofp = fopen(path("env.c.new"), "w"); if (ofp == NULL) err(1, "%s", path("env.c.new")); fprintf(ofp, "#include \n"); fprintf(ofp, "#include \n"); fprintf(ofp, "\n"); fprintf(ofp, "int envmode = %d;\n", envmode); fprintf(ofp, "char static_env[] = {\n"); - if (ifp) { - while (fgets(line, BUFSIZ, ifp) != NULL) { - sanitize_envline(result, line); - /* anything left? */ + STAILQ_FOREACH(envvar, &envvars, envvar_next) { + if (envvar->env_is_file) { + ifp = fopen(envvar->env_str, "r"); + if (ifp == NULL) + err(1, "%s", envvar->env_str); + while (fgets(line, BUFSIZ, ifp) != NULL) { + sanitize_envline(result, line); + /* anything left? */ + if (*result == '\0') + continue; + fprintf(ofp, "\"%s\\0\"\n", result); + } + fclose(ifp); + } else { + linep = envvar->env_str; + sanitize_envline(result, linep); if (*result == '\0') continue; fprintf(ofp, "\"%s\\0\"\n", result); } } - STAILQ_FOREACH(envvar, &envvars, envvar_next) { - linep = envvar->env_str; - sanitize_envline(result, linep); - if (*result == '\0') - continue; - fprintf(ofp, "\"%s\\0\"\n", result); - } fprintf(ofp, "\"\\0\"\n};\n"); - if (ifp) - fclose(ifp); fclose(ofp); moveifchanged(path("env.c.new"), path("env.c")); } static void read_file(char *fname) { char ifname[MAXPATHLEN]; FILE *fp; struct file_list *tp; struct device *dp; struct opt *op; char *wd, *this, *compilewith, *depends, *clean, *warning; const char *objprefix; int compile, match, nreqs, std, filetype, not, imp_rule, no_obj, before_depend, nowerror; fp = fopen(fname, "r"); if (fp == NULL) err(1, "%s", fname); next: /* * include "filename" * filename [ standard | optional ] * [ dev* [ | dev* ... ] | profiling-routine ] [ no-obj ] * [ compile-with "compile rule" [no-implicit-rule] ] * [ dependency "dependency-list"] [ before-depend ] * [ clean "file-list"] [ warning "text warning" ] * [ obj-prefix "file prefix"] */ wd = get_word(fp); if (wd == (char *)EOF) { (void) fclose(fp); return; } if (wd == NULL) goto next; if (wd[0] == '#') { while (((wd = get_word(fp)) != (char *)EOF) && wd) ; goto next; } if (eq(wd, "include")) { wd = get_quoted_word(fp); if (wd == (char *)EOF || wd == NULL) errout("%s: missing include filename.\n", fname); (void) snprintf(ifname, sizeof(ifname), "../../%s", wd); read_file(ifname); while (((wd = get_word(fp)) != (char *)EOF) && wd) ; goto next; } this = ns(wd); wd = get_word(fp); if (wd == (char *)EOF) return; if (wd == NULL) errout("%s: No type for %s.\n", fname, this); tp = fl_lookup(this); compile = 0; match = 1; nreqs = 0; compilewith = 0; depends = 0; clean = 0; warning = 0; std = 0; imp_rule = 0; no_obj = 0; before_depend = 0; nowerror = 0; not = 0; filetype = NORMAL; objprefix = ""; if (eq(wd, "standard")) std = 1; else if (!eq(wd, "optional")) errout("%s: \"%s\" %s must be optional or standard\n", fname, wd, this); for (wd = get_word(fp); wd; wd = get_word(fp)) { if (wd == (char *)EOF) return; if (eq(wd, "!")) { not = 1; continue; } if (eq(wd, "|")) { if (nreqs == 0) errout("%s: syntax error describing %s\n", fname, this); compile += match; match = 1; nreqs = 0; continue; } if (eq(wd, "no-obj")) { no_obj++; continue; } if (eq(wd, "no-implicit-rule")) { if (compilewith == NULL) errout("%s: alternate rule required when " "\"no-implicit-rule\" is specified for" " %s.\n", fname, this); imp_rule++; continue; } if (eq(wd, "before-depend")) { before_depend++; continue; } if (eq(wd, "dependency")) { wd = get_quoted_word(fp); if (wd == (char *)EOF || wd == NULL) errout("%s: %s missing dependency string.\n", fname, this); depends = ns(wd); continue; } if (eq(wd, "clean")) { wd = get_quoted_word(fp); if (wd == (char *)EOF || wd == NULL) errout("%s: %s missing clean file list.\n", fname, this); clean = ns(wd); continue; } if (eq(wd, "compile-with")) { wd = get_quoted_word(fp); if (wd == (char *)EOF || wd == NULL) errout("%s: %s missing compile command string.\n", fname, this); compilewith = ns(wd); continue; } if (eq(wd, "warning")) { wd = get_quoted_word(fp); if (wd == (char *)EOF || wd == NULL) errout("%s: %s missing warning text string.\n", fname, this); warning = ns(wd); continue; } if (eq(wd, "obj-prefix")) { wd = get_quoted_word(fp); if (wd == (char *)EOF || wd == NULL) errout("%s: %s missing object prefix string.\n", fname, this); objprefix = ns(wd); continue; } if (eq(wd, "nowerror")) { nowerror = 1; continue; } if (eq(wd, "local")) { filetype = LOCAL; continue; } if (eq(wd, "no-depend")) { filetype = NODEPEND; continue; } nreqs++; if (eq(wd, "profiling-routine")) { filetype = PROFILING; continue; } if (std) errout("standard entry %s has optional inclusion specifier %s!\n", this, wd); STAILQ_FOREACH(dp, &dtab, d_next) if (eq(dp->d_name, wd)) { if (not) match = 0; else dp->d_done |= DEVDONE; goto nextparam; } SLIST_FOREACH(op, &opt, op_next) if (op->op_value == 0 && opteq(op->op_name, wd)) { if (not) match = 0; goto nextparam; } match &= not; nextparam:; not = 0; } compile += match; if (compile && tp == NULL) { if (std == 0 && nreqs == 0) errout("%s: what is %s optional on?\n", fname, this); if (filetype == PROFILING && profiling == 0) goto next; tp = new_fent(); tp->f_fn = this; tp->f_type = filetype; if (imp_rule) tp->f_flags |= NO_IMPLCT_RULE; if (no_obj) tp->f_flags |= NO_OBJ; if (before_depend) tp->f_flags |= BEFORE_DEPEND; if (nowerror) tp->f_flags |= NOWERROR; tp->f_compilewith = compilewith; tp->f_depends = depends; tp->f_clean = clean; tp->f_warn = warning; tp->f_objprefix = objprefix; } goto next; } /* * Read in the information about files used in making the system. * Store it in the ftab linked list. */ static void read_files(void) { char fname[MAXPATHLEN]; struct files_name *nl, *tnl; (void) snprintf(fname, sizeof(fname), "../../conf/files"); read_file(fname); (void) snprintf(fname, sizeof(fname), "../../conf/files.%s", machinename); read_file(fname); for (nl = STAILQ_FIRST(&fntab); nl != NULL; nl = tnl) { read_file(nl->f_name); tnl = STAILQ_NEXT(nl, f_next); free(nl->f_name); free(nl); } } static int opteq(const char *cp, const char *dp) { char c, d; for (; ; cp++, dp++) { if (*cp != *dp) { c = isupper(*cp) ? tolower(*cp) : *cp; d = isupper(*dp) ? tolower(*dp) : *dp; if (c != d) return (0); } if (*cp == 0) return (1); } } static void do_before_depend(FILE *fp) { struct file_list *tp; int lpos, len; fputs("BEFORE_DEPEND=", fp); lpos = 15; STAILQ_FOREACH(tp, &ftab, f_next) if (tp->f_flags & BEFORE_DEPEND) { len = strlen(tp->f_fn); if ((len = 3 + len) + lpos > 72) { lpos = 8; fputs("\\\n\t", fp); } if (tp->f_flags & NO_IMPLCT_RULE) fprintf(fp, "%s ", tp->f_fn); else fprintf(fp, "$S/%s ", tp->f_fn); lpos += len + 1; } if (lpos != 8) putc('\n', fp); } static void do_objs(FILE *fp) { struct file_list *tp; int lpos, len; char *cp, och, *sp; fprintf(fp, "OBJS="); lpos = 6; STAILQ_FOREACH(tp, &ftab, f_next) { if (tp->f_flags & NO_OBJ) continue; sp = tail(tp->f_fn); cp = sp + (len = strlen(sp)) - 1; och = *cp; *cp = 'o'; len += strlen(tp->f_objprefix); if (len + lpos > 72) { lpos = 8; fprintf(fp, "\\\n\t"); } fprintf(fp, "%s%s ", tp->f_objprefix, sp); lpos += len + 1; *cp = och; } if (lpos != 8) putc('\n', fp); } static void do_xxfiles(char *tag, FILE *fp) { struct file_list *tp; int lpos, len, slen; char *suff, *SUFF; if (tag[strlen(tag) - 1] == '\n') tag[strlen(tag) - 1] = '\0'; suff = ns(tag + 7); SUFF = ns(suff); raisestr(SUFF); slen = strlen(suff); fprintf(fp, "%sFILES=", SUFF); free(SUFF); lpos = 8; STAILQ_FOREACH(tp, &ftab, f_next) if (tp->f_type != NODEPEND) { len = strlen(tp->f_fn); if (tp->f_fn[len - slen - 1] != '.') continue; if (strcasecmp(&tp->f_fn[len - slen], suff) != 0) continue; if ((len = 3 + len) + lpos > 72) { lpos = 8; fputs("\\\n\t", fp); } if (tp->f_type != LOCAL) fprintf(fp, "$S/%s ", tp->f_fn); else fprintf(fp, "%s ", tp->f_fn); lpos += len + 1; } free(suff); if (lpos != 8) putc('\n', fp); } static char * tail(char *fn) { char *cp; cp = strrchr(fn, '/'); if (cp == NULL) return (fn); return (cp+1); } /* * Create the makerules for each file * which is part of the system. */ static void do_rules(FILE *f) { char *cp, *np, och; struct file_list *ftp; char *compilewith; char cmd[128]; STAILQ_FOREACH(ftp, &ftab, f_next) { if (ftp->f_warn) fprintf(stderr, "WARNING: %s\n", ftp->f_warn); cp = (np = ftp->f_fn) + strlen(ftp->f_fn) - 1; och = *cp; if (ftp->f_flags & NO_IMPLCT_RULE) { if (ftp->f_depends) fprintf(f, "%s%s: %s\n", ftp->f_objprefix, np, ftp->f_depends); else fprintf(f, "%s%s: \n", ftp->f_objprefix, np); } else { *cp = '\0'; if (och == 'o') { fprintf(f, "%s%so:\n\t-cp $S/%so .\n\n", ftp->f_objprefix, tail(np), np); continue; } if (ftp->f_depends) { fprintf(f, "%s%sln: $S/%s%c %s\n", ftp->f_objprefix, tail(np), np, och, ftp->f_depends); fprintf(f, "\t${NORMAL_LINT}\n\n"); fprintf(f, "%s%so: $S/%s%c %s\n", ftp->f_objprefix, tail(np), np, och, ftp->f_depends); } else { fprintf(f, "%s%sln: $S/%s%c\n", ftp->f_objprefix, tail(np), np, och); fprintf(f, "\t${NORMAL_LINT}\n\n"); fprintf(f, "%s%so: $S/%s%c\n", ftp->f_objprefix, tail(np), np, och); } } compilewith = ftp->f_compilewith; if (compilewith == NULL) { const char *ftype = NULL; switch (ftp->f_type) { case NORMAL: ftype = "NORMAL"; break; case PROFILING: if (!profiling) continue; ftype = "PROFILE"; break; default: fprintf(stderr, "config: don't know rules for %s\n", np); break; } snprintf(cmd, sizeof(cmd), "${%s_%c%s}", ftype, toupper(och), ftp->f_flags & NOWERROR ? "_NOWERROR" : ""); compilewith = cmd; } *cp = och; if (strlen(ftp->f_objprefix)) fprintf(f, "\t%s $S/%s\n", compilewith, np); else fprintf(f, "\t%s\n", compilewith); if (!(ftp->f_flags & NO_OBJ)) fprintf(f, "\t${NORMAL_CTFCONVERT}\n\n"); else fprintf(f, "\n"); } } static void do_clean(FILE *fp) { struct file_list *tp; int lpos, len; fputs("CLEAN=", fp); lpos = 7; STAILQ_FOREACH(tp, &ftab, f_next) if (tp->f_clean) { len = strlen(tp->f_clean); if (len + lpos > 72) { lpos = 8; fputs("\\\n\t", fp); } fprintf(fp, "%s ", tp->f_clean); lpos += len + 1; } if (lpos != 8) putc('\n', fp); } char * raisestr(char *str) { char *cp = str; while (*str) { if (islower(*str)) *str = toupper(*str); str++; } return (cp); } Index: stable/11 =================================================================== --- stable/11 (revision 336342) +++ stable/11 (revision 336343) Property changes on: stable/11 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r335652-335654