Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Feb 1999 16:25:35 -0700
From:      Warner Losh <imp@village.org>
To:        hackers@FreeBSD.ORG
Subject:   Comments on the following patch
Message-ID:  <199902012325.QAA60809@harmony.village.org>

next in thread | raw e-mail | index | archive | help

The following patch makes it possible to override MACHINE_ARCH in the
same way that we override MACHINE.  This is needed for some cross
building environments.  I have lifted this from OpenBSD's make, but I
didn't investigate its origin further.

This should have no impact on most people as MACHINE_ARCH will be
undefined, or defined to the current machine arcitecture.

This allows me to do a make cross-tools TARGET=arc for the OpenBSD
tree of today.  Well I needed to make a minor hack to the OpenBSD
tree, which isn't relevant here...

Comments?

Warner

Index: main.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/usr.bin/make/main.c,v
retrieving revision 1.29
diff -u -r1.29 main.c
--- main.c	1998/11/15 05:55:58	1.29
+++ main.c	1999/02/01 23:11:14
@@ -449,6 +449,7 @@
 	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 @@
 #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 @@
 	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.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



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