diff options
| author | Mike Pall <mike> | 2011-12-15 19:16:06 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2011-12-15 19:16:06 +0100 |
| commit | b61be299c9fc00e8d2252fa3f12c6005686783d6 (patch) | |
| tree | 0b400660908d726b60456241e0d6a0b67aa5ae5d | |
| parent | 6ace80c897a8359bedd3f195d126725cb0bf0f8d (diff) | |
| download | luajit-b61be299c9fc00e8d2252fa3f12c6005686783d6.tar.gz luajit-b61be299c9fc00e8d2252fa3f12c6005686783d6.tar.bz2 luajit-b61be299c9fc00e8d2252fa3f12c6005686783d6.zip | |
Auto-detect target arch via cross-compiler. Drop TARGET=arch.
| -rw-r--r-- | doc/install.html | 10 | ||||
| -rw-r--r-- | src/Makefile | 9 |
2 files changed, 10 insertions, 9 deletions
diff --git a/doc/install.html b/doc/install.html index 4e226d17..07c55fa6 100644 --- a/doc/install.html +++ b/doc/install.html | |||
| @@ -355,7 +355,7 @@ EGLIBC). The <tt>CROSS</tt> prefix may vary depending on the | |||
| 355 | <tt>--target</tt> of the toolchain: | 355 | <tt>--target</tt> of the toolchain: |
| 356 | </p> | 356 | </p> |
| 357 | <pre class="code"> | 357 | <pre class="code"> |
| 358 | make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- TARGET=arm | 358 | make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- |
| 359 | </pre> | 359 | </pre> |
| 360 | <p> | 360 | <p> |
| 361 | You can cross-compile for <b id="android">Android (ARM)</b> using the <a href="http://developer.android.com/sdk/ndk/index.html"><span class="ext">»</span> Android NDK</a>. | 361 | You can cross-compile for <b id="android">Android (ARM)</b> using the <a href="http://developer.android.com/sdk/ndk/index.html"><span class="ext">»</span> Android NDK</a>. |
| @@ -368,7 +368,7 @@ NDKABI=8 | |||
| 368 | NDKVER=$NDK/toolchains/arm-linux-androideabi-4.4.3 | 368 | NDKVER=$NDK/toolchains/arm-linux-androideabi-4.4.3 |
| 369 | NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi- | 369 | NDKP=$NDKVER/prebuilt/linux-x86/bin/arm-linux-androideabi- |
| 370 | NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm" | 370 | NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm" |
| 371 | make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF" TARGET=arm | 371 | make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF" |
| 372 | </pre> | 372 | </pre> |
| 373 | <p> | 373 | <p> |
| 374 | You can cross-compile for <b id="ios">iOS 3.0+</b> (iPhone/iPad) using the <a href="http://developer.apple.com/devcenter/ios/index.action"><span class="ext">»</span> iOS SDK</a>. | 374 | You can cross-compile for <b id="ios">iOS 3.0+</b> (iPhone/iPad) using the <a href="http://developer.apple.com/devcenter/ios/index.action"><span class="ext">»</span> iOS SDK</a>. |
| @@ -387,7 +387,7 @@ ISDKVER=iPhoneOS4.3.sdk | |||
| 387 | ISDKP=$ISDK/usr/bin/ | 387 | ISDKP=$ISDK/usr/bin/ |
| 388 | ISDKF="-arch armv6 -isysroot $ISDK/SDKs/$ISDKVER" | 388 | ISDKF="-arch armv6 -isysroot $ISDK/SDKs/$ISDKVER" |
| 389 | make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \ | 389 | make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \ |
| 390 | TARGET=arm TARGET_SYS=iOS | 390 | TARGET_SYS=iOS |
| 391 | </pre> | 391 | </pre> |
| 392 | <p> | 392 | <p> |
| 393 | You can cross-compile for a <b id="ppc">PPC target</b> or a | 393 | You can cross-compile for a <b id="ppc">PPC target</b> or a |
| @@ -398,11 +398,11 @@ of the toolchain: | |||
| 398 | </p> | 398 | </p> |
| 399 | <pre class="code"> | 399 | <pre class="code"> |
| 400 | # PPC | 400 | # PPC |
| 401 | make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- TARGET=ppc | 401 | make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- |
| 402 | </pre> | 402 | </pre> |
| 403 | <pre class="code"> | 403 | <pre class="code"> |
| 404 | # PPC/e500v2 | 404 | # PPC/e500v2 |
| 405 | make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe- TARGET=ppcspe | 405 | make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe- |
| 406 | </pre> | 406 | </pre> |
| 407 | <p> | 407 | <p> |
| 408 | Whenever the <b>host OS and the target OS differ</b>, you need to specify | 408 | Whenever the <b>host OS and the target OS differ</b>, you need to specify |
diff --git a/src/Makefile b/src/Makefile index d4f80332..3e5b6dc8 100644 --- a/src/Makefile +++ b/src/Makefile | |||
| @@ -173,13 +173,11 @@ XCFLAGS= | |||
| 173 | # | 173 | # |
| 174 | # Cross-compilation examples: | 174 | # Cross-compilation examples: |
| 175 | # make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows | 175 | # make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows |
| 176 | # make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe- TARGET=ppcspe | 176 | # make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- |
| 177 | 177 | ||
| 178 | CCOPTIONS= $(CCDEBUG) $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS) | 178 | CCOPTIONS= $(CCDEBUG) $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS) |
| 179 | LDOPTIONS= $(CCDEBUG) $(LDFLAGS) | 179 | LDOPTIONS= $(CCDEBUG) $(LDFLAGS) |
| 180 | 180 | ||
| 181 | TARGET_ARCH= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET)) | ||
| 182 | |||
| 183 | HOST_CC= $(CC) | 181 | HOST_CC= $(CC) |
| 184 | HOST_RM= rm -f | 182 | HOST_RM= rm -f |
| 185 | # NOTE: The LuaJIT distribution comes with pre-generated buildvm_*.h files. | 183 | # NOTE: The LuaJIT distribution comes with pre-generated buildvm_*.h files. |
| @@ -214,6 +212,7 @@ TARGET_DYNXLDOPTS= | |||
| 214 | TARGET_XCFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_FORTIFY_SOURCE | 212 | TARGET_XCFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_FORTIFY_SOURCE |
| 215 | TARGET_XLDFLAGS= | 213 | TARGET_XLDFLAGS= |
| 216 | TARGET_XLIBS= -lm | 214 | TARGET_XLIBS= -lm |
| 215 | TARGET_TCFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) | ||
| 217 | TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_ARCH) $(TARGET_FLAGS) $(TARGET_CFLAGS) | 216 | TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_ARCH) $(TARGET_FLAGS) $(TARGET_CFLAGS) |
| 218 | TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS) | 217 | TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS) |
| 219 | TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS) | 218 | TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS) |
| @@ -223,7 +222,7 @@ ifneq (,$(findstring stack-protector,$(shell $(TARGET_CC) -dumpspecs))) | |||
| 223 | TARGET_XCFLAGS+= -fno-stack-protector | 222 | TARGET_XCFLAGS+= -fno-stack-protector |
| 224 | endif | 223 | endif |
| 225 | 224 | ||
| 226 | TARGET_TESTARCH=$(shell $(TARGET_CC) $(TARGET_ACFLAGS) -E lj_arch.h -dM) | 225 | TARGET_TESTARCH=$(shell $(TARGET_CC) $(TARGET_TCFLAGS) -E lj_arch.h -dM) |
| 227 | ifneq (,$(findstring LJ_TARGET_X64 ,$(TARGET_TESTARCH))) | 226 | ifneq (,$(findstring LJ_TARGET_X64 ,$(TARGET_TESTARCH))) |
| 228 | TARGET_CCARCH= x64 | 227 | TARGET_CCARCH= x64 |
| 229 | TARGET_XCFLAGS+= $(CCOPT_X64) | 228 | TARGET_XCFLAGS+= $(CCOPT_X64) |
| @@ -251,6 +250,8 @@ endif | |||
| 251 | endif | 250 | endif |
| 252 | endif | 251 | endif |
| 253 | 252 | ||
| 253 | TARGET_ARCH= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_CCARCH)) | ||
| 254 | |||
| 254 | ifneq (,$(PREFIX)) | 255 | ifneq (,$(PREFIX)) |
| 255 | ifneq (/usr/local,$(PREFIX)) | 256 | ifneq (/usr/local,$(PREFIX)) |
| 256 | TARGET_XCFLAGS+= -DLUA_XROOT=\"$(PREFIX)/\" | 257 | TARGET_XCFLAGS+= -DLUA_XROOT=\"$(PREFIX)/\" |
