Make user overwriteable OSTYPE and ARCH somewhat more saner

In the Makefile we can use whatever variables we want. It's only
necessary that we don't leak them into the compiler context.
This commit is contained in:
Yamagi Burmeister 2016-10-31 10:22:17 +01:00
parent aa897e3965
commit e0b1f98f40

View file

@ -100,28 +100,28 @@ endif
# Detect the OS
ifdef SystemRoot
YQ2OSTYPE ?= Windows
OSTYPE ?= Windows
else
YQ2OSTYPE ?= $(shell uname -s)
OSTYPE ?= $(shell uname -s)
endif
# Special case for MinGW
ifneq (,$(findstring MINGW,$(OSTYPE)))
YQ2OSTYPE ?= Windows
OSTYPE ?= Windows
endif
# Detect the architecture
ifeq ($(OSTYPE), Windows)
ifdef PROCESSOR_ARCHITEW6432
# 64 bit Windows
YQ2ARCH ?= $(PROCESSOR_ARCHITEW6432)
ARCH ?= $(PROCESSOR_ARCHITEW6432)
else
# 32 bit Windows
YQ2ARCH ?= $(PROCESSOR_ARCHITECTURE)
ARCH ?= $(PROCESSOR_ARCHITECTURE)
endif
else
# Normalize some abiguous ARCH strings
YQ2ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/')
ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/')
endif
# Disable CDA for SDL2
@ -136,6 +136,7 @@ CDA_DISABLED:=yes
endif
endif
# ----------
# Base CFLAGS.
@ -167,7 +168,7 @@ endif
# ----------
# Defines the operating system and architecture
CFLAGS += -DYQ2OSTYPE=\"$(YQ2OSTYPE)\" -DYQ2ARCH=\"$(YQ2ARCH)\"
CFLAGS += -DYQ2OSTYPE=\"$(OSTYPE)\" -DYQ2ARCH=\"$(ARCH)\"
# ----------