lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi. I've got a simple patch that lets you cross-compile lua
without editing the Makefiles, by only adding a single
variable to the make command line.

diff -ru lua-5.1.3.orig/src/Makefile lua-5.1.3/src/Makefile
--- lua-5.1.3.orig/src/Makefile 2008-01-19 22:37:58.000000000 +0300
+++ lua-5.1.3/src/Makefile      2008-07-08 22:19:16.000000000 +0400
@@ -7,10 +7,10 @@
 # Your platform. See PLATS for possible values.
 PLAT= none

-CC= gcc
+CC= $(CROSS_COMPILE)gcc
 CFLAGS= -O2 -Wall $(MYCFLAGS)
-AR= ar rcu
-RANLIB= ranlib
+AR= $(CROSS_COMPILE)ar rcu
+RANLIB= $(CROSS_COMPILE)ranlib
 RM= rm -f
 LIBS= -lm $(MYLIBS)


Now to compile lua for, say,  the ARM architecture, you perform
make linux CROSS_COMPILE=arm-linux-
Assuming your arm cross-toolchain has the arm-linux- prefix.

The default behavior should not change, and you should compile
natively if the CROSS_COMPILE variable is not set.

Please consider for mainline inclusion.