From owner-svn-src-projects@FreeBSD.ORG Tue Jun 29 20:43:40 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E5D9106566C; Tue, 29 Jun 2010 20:43:40 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EDAF8FC08; Tue, 29 Jun 2010 20:43:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5TKheNP031555; Tue, 29 Jun 2010 20:43:40 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5TKhdFg031550; Tue, 29 Jun 2010 20:43:39 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201006292043.o5TKhdFg031550@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 29 Jun 2010 20:43:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209594 - projects/ppc64/usr.sbin/config X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2010 20:43:40 -0000 Author: nwhitehorn Date: Tue Jun 29 20:43:39 2010 New Revision: 209594 URL: http://svn.freebsd.org/changeset/base/209594 Log: Add some TBEMD-ness to config(8) in preparation for eliminating sys/powerpc64. This adds a -m option to config to allow things like make universe to know what MACHINE_ARCH applies to a given config file, and fakes MACHINE_ARCH as an option if it is present in the options.MACHINE file to allow architecture-dependent conditional compilation. This is under review by imp@ before merging to HEAD. Modified: projects/ppc64/usr.sbin/config/config.8 projects/ppc64/usr.sbin/config/configvers.h projects/ppc64/usr.sbin/config/main.c projects/ppc64/usr.sbin/config/mkoptions.c Modified: projects/ppc64/usr.sbin/config/config.8 ============================================================================== --- projects/ppc64/usr.sbin/config/config.8 Tue Jun 29 20:42:47 2010 (r209593) +++ projects/ppc64/usr.sbin/config/config.8 Tue Jun 29 20:43:39 2010 (r209594) @@ -78,6 +78,9 @@ Note that does not append .Ar SYSTEM_NAME to the directory given. +.It Fl m +Print the MACHINE and MACHINE_ARCH values for this +kernel and exit. .It Fl g Configure a system for debugging. .It Fl x Ar kernel Modified: projects/ppc64/usr.sbin/config/configvers.h ============================================================================== --- projects/ppc64/usr.sbin/config/configvers.h Tue Jun 29 20:42:47 2010 (r209593) +++ projects/ppc64/usr.sbin/config/configvers.h Tue Jun 29 20:43:39 2010 (r209594) @@ -49,5 +49,5 @@ * * $FreeBSD$ */ -#define CONFIGVERS 600009 +#define CONFIGVERS 600010 #define MAJOR_VERS(x) ((x) / 100000) Modified: projects/ppc64/usr.sbin/config/main.c ============================================================================== --- projects/ppc64/usr.sbin/config/main.c Tue Jun 29 20:42:47 2010 (r209593) +++ projects/ppc64/usr.sbin/config/main.c Tue Jun 29 20:43:39 2010 (r209594) @@ -110,13 +110,18 @@ main(int argc, char **argv) char *p; char xxx[MAXPATHLEN]; char *kernfile; + int printmachine; + printmachine = 0; kernfile = NULL; - while ((ch = getopt(argc, argv, "Cd:gpVx:")) != -1) + while ((ch = getopt(argc, argv, "Cd:gmpVx:")) != -1) switch (ch) { case 'C': filebased = 1; break; + case 'm': + printmachine = 1; + break; case 'd': if (*destdir == '\0') strlcpy(destdir, optarg, sizeof(destdir)); @@ -171,13 +176,6 @@ main(int argc, char **argv) strlcat(destdir, PREFIX, sizeof(destdir)); } - p = path((char *)NULL); - if (stat(p, &buf)) { - if (mkdir(p, 0777)) - err(2, "%s", p); - } else if (!S_ISDIR(buf.st_mode)) - errx(EXIT_FAILURE, "%s isn't a directory", p); - SLIST_INIT(&cputype); SLIST_INIT(&mkopt); SLIST_INIT(&opt); @@ -207,6 +205,19 @@ main(int argc, char **argv) } checkversion(); + if (printmachine) { + printf("%s\t%s\n",machinename,machinearch); + exit(0); + } + + /* Make compile directory */ + p = path((char *)NULL); + if (stat(p, &buf)) { + if (mkdir(p, 0777)) + err(2, "%s", p); + } else if (!S_ISDIR(buf.st_mode)) + errx(EXIT_FAILURE, "%s isn't a directory", p); + /* * make symbolic links in compilation directory * for "sys" (to make genassym.c work along with #include ) Modified: projects/ppc64/usr.sbin/config/mkoptions.c ============================================================================== --- projects/ppc64/usr.sbin/config/mkoptions.c Tue Jun 29 20:42:47 2010 (r209593) +++ projects/ppc64/usr.sbin/config/mkoptions.c Tue Jun 29 20:43:39 2010 (r209594) @@ -94,6 +94,20 @@ options(void) SLIST_INSERT_HEAD(&opt, op, op_next); read_options(); + + /* Fake the value of MACHINE_ARCH as an option if necessary */ + SLIST_FOREACH(ol, &otab, o_next) { + if (strcasecmp(ol->o_name, machinearch) != 0) + continue; + + op = (struct opt *)calloc(1, sizeof(*op)); + if (op == NULL) + err(EXIT_FAILURE, "calloc"); + op->op_name = ns(ol->o_name); + SLIST_INSERT_HEAD(&opt, op, op_next); + break; + } + SLIST_FOREACH(op, &opt, op_next) { SLIST_FOREACH(ol, &otab, o_next) { if (eq(op->op_name, ol->o_name) &&