Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jan 2012 18:55:56 +0000 (UTC)
From:      Robert Millan <rmh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r230392 - head/usr.bin/make
Message-ID:  <201201201855.q0KItudc054360@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmh
Date: Fri Jan 20 18:55:56 2012
New Revision: 230392
URL: http://svn.freebsd.org/changeset/base/230392

Log:
  Map foreign architecture names to FreeBSD naming convention.
  
  Approved by:	kib (mentor)

Modified:
  head/usr.bin/make/main.c

Modified: head/usr.bin/make/main.c
==============================================================================
--- head/usr.bin/make/main.c	Fri Jan 20 18:52:31 2012	(r230391)
+++ head/usr.bin/make/main.c	Fri Jan 20 18:55:56 2012	(r230392)
@@ -146,6 +146,14 @@ uint32_t	warn_nocmd;	/* command line no-
 time_t		now;		/* Time at start of make */
 struct GNode	*DEFAULT;	/* .DEFAULT node */
 
+static struct {
+	const char *foreign_name;
+	const char *freebsd_name;
+} arch_aliases[] = {
+	{ "x86_64", "amd64" },
+	{ "mipsel", "mips" },
+};
+
 /**
  * Exit with usage message.
  */
@@ -939,10 +947,19 @@ main(int argc, char **argv)
 	 */
 	if ((machine = getenv("MACHINE")) == NULL) {
 		static struct utsname utsname;
+		unsigned int i;
 
 		if (uname(&utsname) == -1)
 			err(2, "uname");
 		machine = utsname.machine;
+
+		/* Canonicalize non-FreeBSD naming conventions */
+		for (i = 0; i < sizeof(arch_aliases)
+		     / sizeof(arch_aliases[0]); i++)
+			if (!strcmp(machine, arch_aliases[i].foreign_name)) {
+				machine = arch_aliases[i].freebsd_name;
+				break;
+			}
 	}
 
 	if ((machine_arch = getenv("MACHINE_ARCH")) == NULL) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201201855.q0KItudc054360>