From ac3efb6afc3eec0ac2e14da1934a3d5ab849ac96 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Mon, 1 Mar 1999 06:01:05 +0000 Subject: [PATCH] Make MACHINE_ARCH sensitive to the environment, as well as using the compiled in default in case it isn't defined. This is needed to make cross compilation work in some edge cases. It also makes cross compiling on FreeBSD other BSD's easier as well. Obtained from: NetBSD, OpenBSD (predates the split) --- usr.bin/make/main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 02447e5c42c6..6f9f8f6ef650 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -47,7 +47,7 @@ static const char copyright[] = static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #endif static const char rcsid[] = - "$Id: main.c,v 1.28 1998/11/14 16:15:04 dg Exp $"; + "$Id: main.c,v 1.29 1998/11/15 05:55:58 bde Exp $"; #endif /* not lint */ /*- @@ -449,6 +449,7 @@ main(argc, argv) char obpath[MAXPATHLEN + 1]; char cdpath[MAXPATHLEN + 1]; char *machine = getenv("MACHINE"); + char *machine_arch = getenv("MACHINE_ARCH"); Lst sysMkPath; /* Path of sys.mk */ char *cp = NULL, *start; /* avoid faults on read-only strings */ @@ -528,6 +529,14 @@ main(argc, argv) #endif } + if (!machine_arch) { +#ifndef MACHINE_ARCH + machine_arch = "unknown"; +#else + machine_arch = MACHINE_ARCH; +#endif + } + /* * The object directory location is determined using the * following order of preference: @@ -626,9 +635,7 @@ main(argc, argv) Var_Set(MAKEFLAGS, "", VAR_GLOBAL); Var_Set("MFLAGS", "", VAR_GLOBAL); Var_Set("MACHINE", machine, VAR_GLOBAL); -#ifdef MACHINE_ARCH - Var_Set("MACHINE_ARCH", MACHINE_ARCH, VAR_GLOBAL); -#endif + Var_Set("MACHINE_ARCH", machine_arch, VAR_GLOBAL); /* * First snag any flags out of the MAKE environment variable.