mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-13 03:20:44 +00:00
Makefile: Clean up handling of architectures.
git-svn-id: https://svn.eduke32.com/eduke32@5762 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
3ccf33bc21
commit
5a6aa914a4
2 changed files with 56 additions and 81 deletions
|
@ -92,12 +92,6 @@ ifeq ($(GCC_MINOR),)
|
||||||
GCC_MINOR := 8
|
GCC_MINOR := 8
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Detect machine architecture
|
|
||||||
ifndef SYSARCH
|
|
||||||
SYSARCH:=$(strip $(shell uname -m))
|
|
||||||
endif
|
|
||||||
SYSBITS=32
|
|
||||||
|
|
||||||
# Detect the platform if it wasn't explicitly given to us from
|
# Detect the platform if it wasn't explicitly given to us from
|
||||||
# the outside world. This allows cross-compilation by overriding
|
# the outside world. This allows cross-compilation by overriding
|
||||||
# CC and giving us PLATFORM specifically.
|
# CC and giving us PLATFORM specifically.
|
||||||
|
@ -278,7 +272,7 @@ endif
|
||||||
|
|
||||||
CONLYFLAGS=-std=gnu99 -Wimplicit -Werror-implicit-function-declaration
|
CONLYFLAGS=-std=gnu99 -Wimplicit -Werror-implicit-function-declaration
|
||||||
CXXONLYFLAGS= -fno-exceptions -fno-rtti
|
CXXONLYFLAGS= -fno-exceptions -fno-rtti
|
||||||
ASFORMAT=elf$(SYSBITS)
|
ASFORMAT=elf$(BITS)
|
||||||
ASFLAGS=-s -f $(ASFORMAT) #-g
|
ASFLAGS=-s -f $(ASFORMAT) #-g
|
||||||
LINKERFLAGS=
|
LINKERFLAGS=
|
||||||
L_CXXONLYFLAGS=
|
L_CXXONLYFLAGS=
|
||||||
|
@ -306,28 +300,43 @@ ifeq ($(HOSTPLATFORM),WINDOWS)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Detect machine architecture
|
||||||
|
BITS=32
|
||||||
|
|
||||||
ifeq ($(PLATFORM),WINDOWS)
|
ifeq ($(PLATFORM),WINDOWS)
|
||||||
ifndef COMPILERTARGET
|
ifndef COMPILERTARGET
|
||||||
COMPILERTARGET:=$(strip $(shell $(CC) -dumpmachine))
|
COMPILERTARGET:=$(strip $(shell $(CC) -dumpmachine))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
IMPLICIT_ARCH=i386
|
||||||
ifeq ($(findstring x86_64,$(COMPILERTARGET)),x86_64)
|
ifeq ($(findstring x86_64,$(COMPILERTARGET)),x86_64)
|
||||||
SYSARCH:=x86_64
|
IMPLICIT_ARCH=x86_64
|
||||||
SYSBITS=64
|
BITS=64
|
||||||
endif
|
endif
|
||||||
|
|
||||||
WINLIB?=/$(SYSBITS)
|
WINLIB?=/$(BITS)
|
||||||
|
else ifeq ($(PLATFORM),WII)
|
||||||
|
IMPLICIT_ARCH=ppc
|
||||||
else
|
else
|
||||||
ifneq (1,$(BUILD32_ON_64))
|
ifeq (1,$(BUILD32_ON_64))
|
||||||
ifeq ($(findstring x86_64,$(ARCH)),x86_64)
|
|
||||||
SYSBITS=64
|
|
||||||
endif
|
|
||||||
ifeq ($(ARCH),)
|
ifeq ($(ARCH),)
|
||||||
ifeq ($(findstring x86_64,$(SYSARCH)),x86_64)
|
override ARCH:=-arch i386
|
||||||
SYSBITS=64
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
ifneq ($(ARCH),)
|
||||||
|
override ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(strip $(ARCH)))))
|
||||||
|
ifneq ($(findstring -arch,$(ARCH)),-arch)
|
||||||
|
override ARCH := -arch $(ARCH)
|
||||||
|
endif
|
||||||
|
IMPLICIT_ARCH=$(ARCH)
|
||||||
|
else
|
||||||
|
IMPLICIT_ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(strip $(shell uname -m)))))
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(findstring x86_64,$(IMPLICIT_ARCH)),x86_64)
|
||||||
|
BITS=64
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PLATFORM),DARWIN)
|
ifeq ($(PLATFORM),DARWIN)
|
||||||
|
@ -354,7 +363,7 @@ ifeq ($(PLATFORM),DARWIN)
|
||||||
ifeq (1,$(BUILD32_ON_64))
|
ifeq (1,$(BUILD32_ON_64))
|
||||||
COMMONFLAGS += $(F_NO_STACK_PROTECTOR)
|
COMMONFLAGS += $(F_NO_STACK_PROTECTOR)
|
||||||
else
|
else
|
||||||
ifeq ($(findstring ppc,$(ARCH)),ppc)
|
ifeq ($(findstring ppc,$(IMPLICIT_ARCH)),ppc)
|
||||||
COMMONFLAGS += $(F_NO_STACK_PROTECTOR)
|
COMMONFLAGS += $(F_NO_STACK_PROTECTOR)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -378,20 +387,9 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef OPTOPT
|
ifndef OPTOPT
|
||||||
ifeq ($(PLATFORM), WII)
|
ifeq ($(findstring i386, $(IMPLICIT_ARCH)),i386)
|
||||||
OPTOPT=
|
|
||||||
else
|
|
||||||
OPTOPTARCH=$(ARCH)
|
|
||||||
ifeq (,$(OPTOPTARCH))
|
|
||||||
OPTOPTARCH=$(SYSARCH)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq (i686,$(findstring i686, $(OPTOPTARCH)))
|
|
||||||
OPTOPT=-march=pentium3 $(M_TUNE_GENERIC) -mmmx
|
OPTOPT=-march=pentium3 $(M_TUNE_GENERIC) -mmmx
|
||||||
# -msse2 -mfpmath=sse,387 -malign-double $(M_STACKREALIGN)
|
# -msse2 -mfpmath=sse,387 -malign-double $(M_STACKREALIGN)
|
||||||
else
|
|
||||||
OPTOPT=
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -572,10 +570,10 @@ LUAJIT:=luajit
|
||||||
# the native LuaJIT to emit PE object files.
|
# the native LuaJIT to emit PE object files.
|
||||||
ifeq ($(PLATFORM),WINDOWS)
|
ifeq ($(PLATFORM),WINDOWS)
|
||||||
LUAJIT_BCOPTS := -o windows
|
LUAJIT_BCOPTS := -o windows
|
||||||
ifeq (32,$(SYSBITS))
|
ifeq (32,$(BITS))
|
||||||
LUAJIT_BCOPTS += -a x86
|
LUAJIT_BCOPTS += -a x86
|
||||||
endif
|
endif
|
||||||
ifeq (64,$(SYSBITS))
|
ifeq (64,$(BITS))
|
||||||
LUAJIT_BCOPTS += -a x64
|
LUAJIT_BCOPTS += -a x64
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -692,20 +690,13 @@ ifeq ($(SUBPLATFORM),LINUX)
|
||||||
override NOASM=1
|
override NOASM=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(findstring arm,$(SYSARCH)),arm)
|
ifneq ($(findstring i386,$(IMPLICIT_ARCH)),i386)
|
||||||
override NOASM=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(findstring x86_64,$(SYSARCH)),x86_64)
|
|
||||||
ifeq (1,$(BUILD32_ON_64))
|
ifeq (1,$(BUILD32_ON_64))
|
||||||
# On my 64bit Gentoo these are the 32bit emulation libs
|
# On my 64bit Gentoo these are the 32bit emulation libs
|
||||||
LIBS+= -m32
|
|
||||||
LIBDIRS+= -L/emul/linux/x86/usr/lib
|
LIBDIRS+= -L/emul/linux/x86/usr/lib
|
||||||
COMMONFLAGS+= -m32
|
COMMONFLAGS+= -m32
|
||||||
# Override WITHOUT_GTK=0
|
# Override WITHOUT_GTK=0
|
||||||
GTKCOMPAT32=1
|
GTKCOMPAT32=1
|
||||||
else
|
|
||||||
override NOASM=1
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -719,12 +710,10 @@ ifeq ($(PLATFORM),DARWIN)
|
||||||
ASFORMAT=macho
|
ASFORMAT=macho
|
||||||
ASFLAGS+= -DUNDERSCORES
|
ASFLAGS+= -DUNDERSCORES
|
||||||
|
|
||||||
ifeq ($(findstring x86_64,$(SYSARCH)),x86_64)
|
ifeq ($(findstring x86_64,$(IMPLICIT_ARCH)),x86_64)
|
||||||
ifeq (0,$(BUILD32_ON_64))
|
|
||||||
ASFORMAT+=64
|
ASFORMAT+=64
|
||||||
override NOASM=1
|
override NOASM=1
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
# LIBDIRS+= -Lplatform/Apple/lib
|
# LIBDIRS+= -Lplatform/Apple/lib
|
||||||
# COMPILERFLAGS+= -Iplatform/Apple/include
|
# COMPILERFLAGS+= -Iplatform/Apple/include
|
||||||
|
@ -760,19 +749,9 @@ ifeq ($(PLATFORM),DARWIN)
|
||||||
COMPILERFLAGS += -DDARWIN9
|
COMPILERFLAGS += -DDARWIN9
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (1,$(BUILD32_ON_64))
|
ifneq ($(findstring x86_64,$(IMPLICIT_ARCH)),x86_64)
|
||||||
ARCH=-arch i386
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(findstring x86_64,$(ARCH)),x86_64)
|
|
||||||
ifeq (,$(ARCH))
|
|
||||||
ifneq ($(findstring x86_64,$(SYSARCH)),x86_64)
|
|
||||||
LINKERFLAGS += -read_only_relocs suppress
|
LINKERFLAGS += -read_only_relocs suppress
|
||||||
endif
|
endif
|
||||||
else
|
|
||||||
LINKERFLAGS += -read_only_relocs suppress
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq (0,$(CLANG))
|
ifeq (0,$(CLANG))
|
||||||
COMMONFLAGS += -fno-pic
|
COMMONFLAGS += -fno-pic
|
||||||
|
@ -784,7 +763,7 @@ ifeq ($(PLATFORM),WINDOWS)
|
||||||
ifeq (0,$(CLANG))
|
ifeq (0,$(CLANG))
|
||||||
L_CXXONLYFLAGS += -static-libstdc++
|
L_CXXONLYFLAGS += -static-libstdc++
|
||||||
endif
|
endif
|
||||||
ASFORMAT=win$(SYSBITS)
|
ASFORMAT=win$(BITS)
|
||||||
ASFLAGS+= -DUNDERSCORES
|
ASFLAGS+= -DUNDERSCORES
|
||||||
|
|
||||||
# Windows types can be SDL or WIN
|
# Windows types can be SDL or WIN
|
||||||
|
@ -813,11 +792,6 @@ ifeq ($(PLATFORM),WINDOWS)
|
||||||
endif
|
endif
|
||||||
#-lshfolder
|
#-lshfolder
|
||||||
STDCPPLIB:=-lstdc++
|
STDCPPLIB:=-lstdc++
|
||||||
ifeq ($(findstring x86_64,$(SYSARCH)),x86_64)
|
|
||||||
ifneq (1,$(BUILD32_ON_64))
|
|
||||||
override NOASM=1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
COMMONFLAGS += -fno-pic
|
COMMONFLAGS += -fno-pic
|
||||||
endif
|
endif
|
||||||
|
@ -827,9 +801,6 @@ ifeq ($(PLATFORM),BSD)
|
||||||
RENDERTYPE=SDL
|
RENDERTYPE=SDL
|
||||||
MIXERTYPE=SDL
|
MIXERTYPE=SDL
|
||||||
COMPILERFLAGS+= -DHAVE_INTTYPES
|
COMPILERFLAGS+= -DHAVE_INTTYPES
|
||||||
ifneq ($(findstring i386,$(SYSARCH)),i386)
|
|
||||||
override NOASM=1
|
|
||||||
endif
|
|
||||||
STDCPPLIB:=-lstdc++
|
STDCPPLIB:=-lstdc++
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),BEOS)
|
ifeq ($(PLATFORM),BEOS)
|
||||||
|
@ -894,6 +865,10 @@ ifeq ($(PLATFORM),DINGOO)
|
||||||
COMPILERFLAGS += -D__OPENDINGUX__
|
COMPILERFLAGS += -D__OPENDINGUX__
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(findstring i386,$(IMPLICIT_ARCH)),i386)
|
||||||
|
override NOASM=1
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(EXESUFFIX_OVERRIDE),)
|
ifneq ($(EXESUFFIX_OVERRIDE),)
|
||||||
EXESUFFIX=$(EXESUFFIX_OVERRIDE)
|
EXESUFFIX=$(EXESUFFIX_OVERRIDE)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -260,31 +260,31 @@ if [ $buildtools$installtools != 00 ] && [ -d "build" ]; then
|
||||||
if [ $build64 == 1 ]; then
|
if [ $build64 == 1 ]; then
|
||||||
if [ $builddebug == 1 ]; then
|
if [ $builddebug == 1 ]; then
|
||||||
dobuildtools "x86_64 debug" \
|
dobuildtools "x86_64 debug" \
|
||||||
"ARCH='-arch x86_64' EXESUFFIX_OVERRIDE=.debug.x64 $commonargs RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=1 $makecmd utils"
|
"ARCH=x86_64 EXESUFFIX_OVERRIDE=.debug.x64 $commonargs RELEASE=0 USE_LIBVPX=1 $makecmd utils"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dobuildtools "x86_64 release" \
|
dobuildtools "x86_64 release" \
|
||||||
"ARCH='-arch x86_64' EXESUFFIX_OVERRIDE=.x64 $commonargs RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=1 $makecmd utils"
|
"ARCH=x86_64 EXESUFFIX_OVERRIDE=.x64 $commonargs RELEASE=1 USE_LIBVPX=1 $makecmd utils"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $build86 == 1 ]; then
|
if [ $build86 == 1 ]; then
|
||||||
if [ $builddebug == 1 ]; then
|
if [ $builddebug == 1 ]; then
|
||||||
dobuildtools "x86 debug" \
|
dobuildtools "x86 debug" \
|
||||||
"EXESUFFIX_OVERRIDE=.debug.x86 $commonargs RELEASE=0 BUILD32_ON_64=1 USE_LIBVPX=0 $makecmd utils"
|
"ARCH=i386 EXESUFFIX_OVERRIDE=.debug.x86 $commonargs RELEASE=0 USE_LIBVPX=0 $makecmd utils"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dobuildtools "x86 release" \
|
dobuildtools "x86 release" \
|
||||||
"EXESUFFIX_OVERRIDE=.x86 $commonargs RELEASE=1 BUILD32_ON_64=1 USE_LIBVPX=0 $makecmd utils"
|
"ARCH=i386 EXESUFFIX_OVERRIDE=.x86 $commonargs RELEASE=1 USE_LIBVPX=0 $makecmd utils"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $buildppc == 1 ]; then
|
if [ $buildppc == 1 ]; then
|
||||||
if [ $builddebug == 1 ]; then
|
if [ $builddebug == 1 ]; then
|
||||||
dobuildtools "PowerPC debug" \
|
dobuildtools "PowerPC debug" \
|
||||||
"ARCH='-arch ppc' EXESUFFIX_OVERRIDE=.debug.ppc $commonargs RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=0 $makecmd utils"
|
"ARCH=ppc EXESUFFIX_OVERRIDE=.debug.ppc $commonargs RELEASE=0 USE_LIBVPX=0 $makecmd utils"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dobuildtools "PowerPC release" \
|
dobuildtools "PowerPC release" \
|
||||||
"ARCH='-arch ppc' EXESUFFIX_OVERRIDE=.ppc $commonargs RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=0 $makecmd utils"
|
"ARCH=ppc EXESUFFIX_OVERRIDE=.ppc $commonargs RELEASE=1 USE_LIBVPX=0 $makecmd utils"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p tools
|
mkdir -p tools
|
||||||
|
@ -344,28 +344,28 @@ if [ $buildmain == 1 ]; then
|
||||||
|
|
||||||
if [ $build64 == 1 ]; then
|
if [ $build64 == 1 ]; then
|
||||||
if [ $builddebug == 1 ]; then
|
if [ $builddebug == 1 ]; then
|
||||||
dobuildem debug.x64 "ARCH='-arch x86_64' $commonargs RELEASE=0 BUILD32_ON_64=0 $makecmd"
|
dobuildem debug.x64 "ARCH=x86_64 $commonargs RELEASE=0 $makecmd"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $buildrelease == 1 ]; then
|
if [ $buildrelease == 1 ]; then
|
||||||
dobuildem x64 "ARCH='-arch x86_64' $commonargs RELEASE=1 BUILD32_ON_64=0 $makecmd"
|
dobuildem x64 "ARCH=x86_64 $commonargs RELEASE=1 $makecmd"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $build86 == 1 ]; then
|
if [ $build86 == 1 ]; then
|
||||||
if [ $builddebug == 1 ]; then
|
if [ $builddebug == 1 ]; then
|
||||||
dobuildem debug.x86 "$commonargs RELEASE=0 BUILD32_ON_64=1 USE_LIBPNG=0 USE_LIBVPX=0 $makecmd"
|
dobuildem debug.x86 "ARCH=i386 $commonargs RELEASE=0 USE_LIBPNG=0 USE_LIBVPX=0 $makecmd"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dobuildem x86 "$commonargs RELEASE=1 BUILD32_ON_64=1 USE_LIBPNG=0 USE_LIBVPX=0 $makecmd"
|
dobuildem x86 "ARCH=i386 $commonargs RELEASE=1 USE_LIBPNG=0 USE_LIBVPX=0 $makecmd"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $buildppc == 1 ]; then
|
if [ $buildppc == 1 ]; then
|
||||||
if [ $builddebug == 1 ]; then
|
if [ $builddebug == 1 ]; then
|
||||||
dobuildem debug.ppc "ARCH='-arch ppc' $commonargs RELEASE=0 BUILD32_ON_64=0 USE_LIBPNG=0 USE_LIBVPX=0 $makecmd"
|
dobuildem debug.ppc "ARCH=ppc $commonargs RELEASE=0 USE_LIBPNG=0 USE_LIBVPX=0 $makecmd"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dobuildem ppc "ARCH='-arch ppc' $commonargs RELEASE=1 BUILD32_ON_64=0 USE_LIBPNG=0 USE_LIBVPX=0 $makecmd"
|
dobuildem ppc "ARCH=ppc $commonargs RELEASE=1 USE_LIBPNG=0 USE_LIBVPX=0 $makecmd"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue