Makefile cleanup.

This commit is contained in:
Sérgio Benjamim 2017-04-20 00:20:26 -03:00
parent 71065f83bb
commit 307c6f5c05

View File

@ -2,10 +2,12 @@ DEBUG = 0
LOGSOUND = 0
FRONTEND_SUPPORTS_RGB565 = 1
# system platform
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
platform = win
EXE_EXT = .exe
else ifneq ($(findstring MINGW,$(shell uname -a)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
@ -17,38 +19,42 @@ ifeq ($(platform),)
else ifneq ($(findstring win,$(shell uname -a)),)
platform = win
endif
endif
# system platform
system_platform = unix
ifeq ($(shell uname -a),)
EXE_EXT = .exe
system_platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
system_platform = osx
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
else ifneq (,$(findstring armv,$(platform)))
override platform += unix
else ifneq (,$(findstring rpi,$(platform)))
override platform += unix
endif
TARGET_NAME := genesis_plus_gx
LIBM := -lm
GIT_VERSION ?= " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown")
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
# Unix
ifeq ($(platform), unix)
ifneq (,$(findstring unix,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
PLATFORM_DEFINES := -DHAVE_ZLIB
# Raspberry Pi
ifneq (,$(findstring rpi,$(platform)))
ENDIANNESS_DEFINES += -DALIGN_LONG
CFLAGS += -fomit-frame-pointer -ffast-math
ifneq (,$(findstring rpi1,$(platform)))
PLATFORM_DEFINES += -DARM11 -marm -march=armv6j -mfpu=vfp -mfloat-abi=hard
else ifneq (,$(findstring rpi2,$(platform)))
PLATFORM_DEFINES += -DARM -marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
else ifneq (,$(findstring rpi3,$(platform)))
PLATFORM_DEFINES += -DARM -marm -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard
endif
endif
# Portable Linux
else ifeq ($(platform), linux-portable)
TARGET := $(TARGET_NAME)_libretro.so
@ -57,6 +63,7 @@ else ifeq ($(platform), linux-portable)
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
PLATFORM_DEFINES := -DHAVE_ZLIB
LIBM :=
# OS X
else ifeq ($(platform), osx)
TARGET := $(TARGET_NAME)_libretro.dylib
@ -79,7 +86,6 @@ else ifeq ($(platform), osx)
# iOS
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
@ -91,13 +97,13 @@ else ifneq (,$(findstring ios,$(platform)))
endif
CC = cc -arch armv7 -isysroot $(IOSSDK)
ifeq ($(platform),ios9)
ifeq ($(platform),ios9)
CC += -miphoneos-version-min=8.0
PLATFORM_DEFINES += -miphoneos-version-min=8.0
else
else
CC += -miphoneos-version-min=5.0
PLATFORM_DEFINES += -miphoneos-version-min=5.0
endif
endif
# Theos
else ifeq ($(platform), theos_ios)
@ -125,28 +131,29 @@ else ifeq ($(platform), qnx)
PLATFORM_DEFINES := -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
# PS3
else ifeq ($(platform), ps3)
else ifneq (,$(filter $(platform), ps3 sncps3 psl1ght))
TARGET := $(TARGET_NAME)_libretro_ps3.a
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER -DBYTE_ORDER=BIG_ENDIAN
PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER
STATIC_LINKING = 1
# sncps3
else ifeq ($(platform), sncps3)
TARGET := $(TARGET_NAME)_libretro_ps3.a
# sncps3
ifneq (,$(findstring sncps3,$(platform)))
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER -DBYTE_ORDER=BIG_ENDIAN
STATIC_LINKING = 1
PLATFORM_DEFINES += -DBYTE_ORDER=BIG_ENDIAN
# Lightweight PS3 Homebrew SDK
else ifeq ($(platform), psl1ght)
# PS3
else ifneq (,$(findstring ps3,$(platform)))
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
PLATFORM_DEFINES += -DBYTE_ORDER=BIG_ENDIAN
# Lightweight PS3 Homebrew SDK
else ifneq (,$(findstring psl1ght,$(platform)))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
PLATFORM_DEFINES := -D__CELLOS_LV2 -DALT_RENDER
STATIC_LINKING = 1
endif
# PSP
else ifeq ($(platform), psp1)
@ -180,42 +187,6 @@ else ifeq ($(platform), ctr)
CFLAGS += -fomit-frame-pointer -ffast-math
STATIC_LINKING = 1
# Raspberry Pi 1
else ifeq ($(platform), rpi1)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
PLATFORM_DEFINES := -DHAVE_ZLIB
PLATFORM_DEFINES += -DARM11
PLATFORM_DEFINES += -marm -march=armv6j -mfloat-abi=hard -mfpu=vfp
ENDIANNESS_DEFINES := -DLSB_FIRST -DALIGN_LONG -DBYTE_ORDER=LITTLE_ENDIAN
CFLAGS += -fomit-frame-pointer -ffast-math
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
# Raspberry Pi 2
else ifeq ($(platform), rpi2)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
PLATFORM_DEFINES := -DHAVE_ZLIB
PLATFORM_DEFINES += -DARM
PLATFORM_DEFINES += -marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
ENDIANNESS_DEFINES := -DLSB_FIRST -DALIGN_LONG -DBYTE_ORDER=LITTLE_ENDIAN
CFLAGS += -fomit-frame-pointer -ffast-math
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
# Raspberry Pi 3
else ifeq ($(platform), rpi3)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
PLATFORM_DEFINES := -DHAVE_ZLIB
PLATFORM_DEFINES += -DARM
PLATFORM_DEFINES += -marm -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard
ENDIANNESS_DEFINES := -DLSB_FIRST -DALIGN_LONG -DBYTE_ORDER=LITTLE_ENDIAN
CFLAGS += -fomit-frame-pointer -ffast-math
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
# Xbox 360
else ifeq ($(platform), xenon)
TARGET := $(TARGET_NAME)_libretro_xenon360.a
@ -225,60 +196,28 @@ else ifeq ($(platform), xenon)
ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN
STATIC_LINKING = 1
# Nintendo Game Cube
else ifeq ($(platform), ngc)
# Nintendo GameCube / Wii / WiiU
else ifneq (,$(filter $(platform), ngc wii wiiu))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN
PLATFORM_DEFINES := -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DALT_RENDER
PLATFORM_DEFINES := -DGEKKO -mcpu=750 -meabi -mhard-float -DALT_RENDER
PLATFORM_DEFINES += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
STATIC_LINKING = 1
# Nintendo Wii
else ifeq ($(platform), wii)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DALT_RENDER
PLATFORM_DEFINES += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN
STATIC_LINKING = 1
# Nintendo WiiU
ifneq (,$(findstring wiiu,$(platform)))
PLATFORM_DEFINES += -DWIIU -DHW_RVL -mwup -DUSE_DYNAMIC_ALLOC
# Nintendo WiiU
else ifeq ($(platform), wiiu)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DGEKKO -DWIIU -DHW_RVL -mwup -mcpu=750 -meabi -mhard-float -DALT_RENDER -DUSE_DYNAMIC_ALLOC
PLATFORM_DEFINES += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
ENDIANNESS_DEFINES := -DBYTE_ORDER=BIG_ENDIAN
STATIC_LINKING = 1
# Nintendo Wii
else ifneq (,$(findstring wii,$(platform)))
PLATFORM_DEFINES += -DHW_RVL -mrvl
# ARM
else ifneq (,$(findstring armv,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
ENDIANNESS_DEFINES := -DLSB_FIRST -DBYTE_ORDER=LITTLE_ENDIAN
PLATFORM_DEFINES := -DHAVE_ZLIB
ifneq (,$(findstring cortexa5,$(platform)))
PLATFORM_DEFINES += -marm -mcpu=cortex-a5
else ifneq (,$(findstring cortexa8,$(platform)))
PLATFORM_DEFINES += -marm -mcpu=cortex-a8
else ifneq (,$(findstring cortexa9,$(platform)))
PLATFORM_DEFINES += -marm -mcpu=cortex-a9
else ifneq (,$(findstring cortexa15a7,$(platform)))
PLATFORM_DEFINES += -marm -mcpu=cortex-a15.cortex-a7
else
PLATFORM_DEFINES += -marm
# Nintendo GameCube
else ifneq (,$(findstring ngc,$(platform)))
PLATFORM_DEFINES += -DHW_DOL -mrvl
endif
ifneq (,$(findstring softfloat,$(platform)))
PLATFORM_DEFINES += -mfloat-abi=softfp
else ifneq (,$(findstring hardfloat,$(platform)))
PLATFORM_DEFINES += -mfloat-abi=hard
endif
PLATFORM_DEFINES += -DARM
# emscripten
else ifeq ($(platform), emscripten)
@ -290,7 +229,6 @@ else ifeq ($(platform), emscripten)
else ifeq ($(platform), gcw0)
TARGET := $(TARGET_NAME)_libretro.so
CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
CXX = /opt/gcw0-toolchain/usr/bin/mipsel-linux-g++
AR = /opt/gcw0-toolchain/usr/bin/mipsel-linux-ar
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
fpic := -fPIC