aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Millan <rmh@FreeBSD.org>2012-01-20 18:55:56 +0000
committerRobert Millan <rmh@FreeBSD.org>2012-01-20 18:55:56 +0000
commit475cc570f4fe5683f858d5b774f5a56e087fb9f5 (patch)
treed8d2260c2fab35332a38876eb0be83ab9a4fc657
parent618abe8ba158cbd76ce7ca5348fb1cf8429d3178 (diff)
downloadsrc-475cc570f4fe5683f858d5b774f5a56e087fb9f5.tar.gz
src-475cc570f4fe5683f858d5b774f5a56e087fb9f5.zip
Map foreign architecture names to FreeBSD naming convention.
Approved by: kib (mentor)
Notes
Notes: svn path=/head/; revision=230392
-rw-r--r--usr.bin/make/main.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index fe5ae589b499..8079cc9c38b1 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -146,6 +146,14 @@ uint32_t warn_nocmd; /* command line no-warning flags */
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) {