From 51c1297a483806d379a883ef021464a041284790 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 1 Apr 2005 22:54:22 +0000 Subject: [PATCH] Allow one to specify a second parameter to the machine line. This allows us to specify the machine_arch as well as machine. If specified then a second link will be made, similar to machine, from $MACHINE_ARCH to $S/$MACHINE_ARCH/include. This is for ports where MACHINE != MACHINE_ARCH (pc98 today, others in the future?). Reviewed by: arch@, nyan@ --- usr.sbin/config/config.h | 4 +++- usr.sbin/config/config.y | 9 +++++++++ usr.sbin/config/configvers.h | 4 ++-- usr.sbin/config/main.c | 14 ++++++++++++++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index f3d292d3283e..436f78be64d9 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -91,9 +91,11 @@ struct config { * 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. + * 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. diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index 77a17fcf386b..018ec6197606 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -138,6 +138,15 @@ Config_spec: errx(1, "%s:%d: only one machine directive is allowed", yyfile, yyline); machinename = $2; + machinearch = $2; + } | + ARCH Save_id Save_id + = { + if (machinename != NULL) + errx(1, "%s:%d: only one machine directive is allowed", + yyfile, yyline); + machinename = $2; + machinearch = $3; } | CPU Save_id = { diff --git a/usr.sbin/config/configvers.h b/usr.sbin/config/configvers.h index 830cf20d058e..aa174cf5803d 100644 --- a/usr.sbin/config/configvers.h +++ b/usr.sbin/config/configvers.h @@ -1,6 +1,6 @@ /* * 6 digits of version. The most significant are branch indicators - * (eg: RELENG_2_2 = 22, -current presently = 50 etc). The least + * (eg: RELENG_2_2 = 22, -current presently = 60 etc). The least * significant digits are incremented for each incompatible change. * * The numbering scheme is inspired by the sys/conf/newvers.sh RELDATE @@ -8,4 +8,4 @@ * * $FreeBSD$ */ -#define CONFIGVERS 600001 +#define CONFIGVERS 600002 diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index a2002fb3abe9..675d3bb675b2 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -163,6 +163,20 @@ main(int argc, char **argv) srcdir, machinename); (void) unlink(path("machine")); (void) symlink(xxx, path("machine")); + if (strcmp(machinename, machinearch) != 0) { + /* + * make symbolic links in compilation directory for + * machinearch, if it is different than machinename. + */ + if (*srcdir == '\0') + (void)snprintf(xxx, sizeof(xxx), "../../../%s/include", + machinearch); + else + (void)snprintf(xxx, sizeof(xxx), "%s/%s/include", + srcdir, machinearch); + (void) unlink(path(machinearch)); + (void) symlink(xxx, path(machinearch)); + } options(); /* make options .h files */ makefile(); /* build Makefile */ headers(); /* make a lot of .h files */