summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1999-03-01 06:01:05 +0000
committerimp <imp@FreeBSD.org>1999-03-01 06:01:05 +0000
commit64427c6a72e1ed5d5c18f2ef6a5a3ffbdda789d6 (patch)
tree7567f54568608f60f81fab4a89eea1acbab688aa /usr.bin/make
parent8f5a0364731136135e9a56bce6c5c4b6f637c10d (diff)
downloadFreeBSD-src-64427c6a72e1ed5d5c18f2ef6a5a3ffbdda789d6.zip
FreeBSD-src-64427c6a72e1ed5d5c18f2ef6a5a3ffbdda789d6.tar.gz
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)
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/main.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 02447e5..6f9f8f6 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.
OpenPOWER on IntegriCloud