diff --git a/Makefile.in b/Makefile.in
index 6640a73..bc2ab92 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -34,6 +34,9 @@ BITS=@BITS@
 ARCH_FLAGS=@ARCH_FLAGS@
 MARK64=@MARK64@
 RPATH=@RPATH@
+# Architecture the wrappers are generated for, as a uname -m name.
+# Empty means the build machine; set it when cross compiling.
+MAKEWRAPPERS_ARCH ?=
 VERSION=1.99.0
 
 LIB=@LIB@
@@ -146,7 +149,7 @@ tables: enums/*.in maketables templatefile.py $(TABLES)
 	./maketables enums/*.in
 
 wrappers: makewrappers templatefile.py $(TEMPLATES) ports/*/wrapfuncs.in
-	CC="$(CC) $(CFLAGS) $(CFLAGS_PSEUDO)" ./makewrappers "xattr=$(XATTR)"
+	CC="$(CC) $(CFLAGS) $(CFLAGS_PSEUDO)" MAKEWRAPPERS_ARCH="$(MAKEWRAPPERS_ARCH)" ./makewrappers "xattr=$(XATTR)"
 
 .SECONDARY: tables wrappers
 
diff --git a/makewrappers b/makewrappers
index 19508fa..c90f5c7 100755
--- a/makewrappers
+++ b/makewrappers
@@ -15,6 +15,10 @@ import platform
 import subprocess
 from templatefile import TemplateFile
 
+def wrapper_arch():
+    """Architecture the wrappers are built for: MAKEWRAPPERS_ARCH or the build machine."""
+    return os.environ.get("MAKEWRAPPERS_ARCH", "").strip() or platform.machine()
+
 class ArgumentList:
     """A (possibly empty) list of arguments"""
 
@@ -319,11 +323,11 @@ class Function:
             # Strip all leading/trailing whitespace
             modifiers = {k.strip():v.strip() for k, v in modifiers.items()}
 
-            arch = "-" + platform.machine()
+            arch = "-" + wrapper_arch()
             # Sorted so that versions-foo appear after versions, so overrides are easy
             for key in sorted(modifiers):
                 value = modifiers[key].replace('<equals>', '==')
-                # If the key is version-arm64 and we're on arm64 then rename this to version
+                # If the key is version-arm64 and we're building for arm64 then rename this to version
                 if key.endswith(arch):
                     key = key.replace(arch, "")
                 setattr(self, key, value)
@@ -702,6 +706,7 @@ def main(argv):
     port = Port('common', sources)
 
     # the per-function stuff
+    print("Architecture for wrapper modifiers: %s" % wrapper_arch())
     print("Writing functions...")
     all_funcs = port.functions()
     for name in sorted(all_funcs.keys()):
