Relax machine directives a little.

Currently, you can have multiple machine directives if they are otherwise
identical. Relax this so that only the machinename part is the same. This allows
one to change the machine arch in a different config file you've included easily.
This commit is contained in:
Warner Losh 2020-02-23 23:36:56 +00:00
parent 97b116ad0a
commit 9bcb741864
2 changed files with 7 additions and 3 deletions

View File

@ -283,7 +283,8 @@ corresponds to MACHINE_ARCH.
.Pp .Pp
A kernel configuration file may have only one A kernel configuration file may have only one
.Ic machine .Ic machine
directive. directive, unless the second one matches the
machine argument in the first one exactly.
.\" -------- MAKEOPTION -------- .\" -------- MAKEOPTION --------
.Pp .Pp
.It Ic makeoption Ar options .It Ic makeoption Ar options

View File

@ -155,8 +155,11 @@ Config_spec:
machinearch = $2; machinearch = $2;
} | } |
ARCH Save_id Save_id { ARCH Save_id Save_id {
if (machinename != NULL && /*
!(eq($2, machinename) && eq($3, machinearch))) * Allow the machinearch to change with a second machine directive,
* but still enforce no changes to the machinename.
*/
if (machinename != NULL && !eq($2, machinename))
errx(1, "%s:%d: only one machine directive is allowed", errx(1, "%s:%d: only one machine directive is allowed",
yyfile, yyline); yyfile, yyline);
machinename = $2; machinename = $2;