libretro-prboom/Makefile

290 lines
7.4 KiB
Makefile
Raw Normal View History

2012-05-12 20:26:23 +00:00
DEBUG=0
2016-02-05 15:06:57 +00:00
STATIC_LINKING=0
2012-05-12 20:26:23 +00:00
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
platform = win
else ifneq ($(findstring MINGW,$(shell uname -a)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
platform = osx
2014-04-14 04:24:38 +00:00
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
2012-05-12 20:26:23 +00:00
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
2014-04-14 04:24:38 +00:00
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif
2013-04-17 16:42:37 +00:00
TARGET_NAME := prboom
2016-02-05 15:54:48 +00:00
LIBM :=
2015-03-02 15:39:03 +00:00
LDFLAGS :=
2016-02-05 15:06:57 +00:00
ifeq ($(STATIC_LINKING),1)
EXT=a
2016-02-05 15:54:48 +00:00
ifeq ($(platform), unix)
PLAT=_unix
endif
2016-02-05 15:06:57 +00:00
endif
2012-05-12 20:26:23 +00:00
ifeq ($(platform), unix)
2016-02-05 15:06:57 +00:00
EXT ?= so
2016-02-05 15:54:48 +00:00
TARGET := $(TARGET_NAME)_libretro$(PLAT).$(EXT)
fpic := -fPIC
2012-07-26 12:34:52 +00:00
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,-no-undefined
2015-03-02 15:39:03 +00:00
else ifeq ($(platform), linux-portable)
2016-02-05 15:06:57 +00:00
EXT ?= so
TARGET := $(TARGET_NAME)_libretro.$(EXT)
2015-03-02 15:39:03 +00:00
fpic := -fPIC -nostdlib
2015-03-05 16:59:26 +00:00
SHARED := -shared -Wl,--version-script=libretro/link.T
2015-03-02 15:39:03 +00:00
LIBM :=
2012-05-12 20:26:23 +00:00
else ifeq ($(platform), osx)
2016-02-05 15:06:57 +00:00
EXT ?= dylib
TARGET := $(TARGET_NAME)_libretro.$(EXT)
2014-04-14 04:24:38 +00:00
fpic := -fPIC
SHARED := -dynamiclib
2014-04-14 04:24:38 +00:00
ifeq ($(arch),ppc)
2015-08-27 06:13:20 +00:00
CFLAGS += -DMSB_FIRST
endif
2014-10-23 07:33:12 +00:00
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
2015-08-01 21:16:34 +00:00
fpic += -mmacosx-version-min=10.1
2015-10-15 14:27:19 +00:00
# iOS
else ifneq (,$(findstring ios,$(platform)))
2016-02-05 15:06:57 +00:00
EXT ?= dylib
TARGET := $(TARGET_NAME)_libretro_ios.$(EXT)
fpic := -fPIC
SHARED := -dynamiclib
2014-10-23 07:33:12 +00:00
ifeq ($(IOSSDK),)
2015-03-10 08:27:04 +00:00
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
2014-10-23 07:33:12 +00:00
endif
CC = clang -arch armv7 -isysroot $(IOSSDK)
2015-10-15 14:27:19 +00:00
ifeq ($(platform),ios9)
CFLAGS += -miphoneos-version-min=8.0
else
CFLAGS += -miphoneos-version-min=5.0
endif
2014-12-23 18:26:42 +00:00
else ifeq ($(platform), theos_ios)
# Theos iOS
DEPLOYMENT_IOSVERSION = 5.0
TARGET = iphone:latest:$(DEPLOYMENT_IOSVERSION)
ARCHS = armv7 armv7s
TARGET_IPHONEOS_DEPLOYMENT_VERSION=$(DEPLOYMENT_IOSVERSION)
THEOS_BUILD_DIR := objs
include $(THEOS)/makefiles/common.mk
LIBRARY_NAME = $(TARGET_NAME)_libretro_ios
2016-02-05 15:06:57 +00:00
else ifeq ($(platform), qnx)
2016-02-05 15:06:57 +00:00
EXT ?= so
TARGET := $(TARGET_NAME)_libretro_qnx.$(EXT)
fpic := -fPIC
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,-no-undefined
CC = qcc -Vgcc_ntoarmv7le
AR = qcc -Vgcc_ntoarmv7le
2015-09-18 19:40:19 +00:00
CFLAGS += -DHAVE_STRLWR
CFLAGS += -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
2012-05-12 20:26:23 +00:00
else ifeq ($(platform), ps3)
2016-02-05 15:06:57 +00:00
EXT=a
TARGET := $(TARGET_NAME)_libretro_ps3.$(EXT)
2012-05-12 20:26:23 +00:00
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
2015-08-27 06:13:20 +00:00
CFLAGS += -DMSB_FIRST
2013-05-18 15:55:38 +00:00
STATIC_LINKING = 1
2012-05-12 20:26:23 +00:00
else ifeq ($(platform), sncps3)
2016-02-05 15:06:57 +00:00
EXT=a
TARGET := $(TARGET_NAME)_libretro_ps3.$(EXT)
2012-05-12 20:26:23 +00:00
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
2015-08-27 06:13:20 +00:00
CFLAGS += -DMSB_FIRST
2013-05-18 15:55:38 +00:00
STATIC_LINKING = 1
2012-07-01 17:00:59 +00:00
else ifeq ($(platform), psl1ght)
2016-02-05 15:06:57 +00:00
EXT=a
TARGET := $(TARGET_NAME)_libretro_psl1ght.$(EXT)
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
2015-09-18 19:40:19 +00:00
CFLAGS += -DMSB_FIRST -DHAVE_STRLWR
2013-05-18 15:55:38 +00:00
STATIC_LINKING = 1
2015-08-31 20:10:56 +00:00
# PSP1
2012-11-23 20:09:10 +00:00
else ifeq ($(platform), psp1)
2016-02-05 15:06:57 +00:00
EXT=a
TARGET := $(TARGET_NAME)_libretro_psp1.$(EXT)
2012-11-23 20:09:10 +00:00
CC = psp-gcc$(EXE_EXT)
AR = psp-ar$(EXE_EXT)
2015-09-18 19:40:19 +00:00
CFLAGS += -DHAVE_STRLWR -DPSP -G0
2013-05-18 15:55:38 +00:00
STATIC_LINKING = 1
2015-08-31 20:10:56 +00:00
# Vita
else ifeq ($(platform), vita)
2016-02-05 15:06:57 +00:00
EXT=a
TARGET := $(TARGET_NAME)_libretro_vita.$(EXT)
2015-08-31 20:10:56 +00:00
CC = arm-vita-eabi-gcc$(EXE_EXT)
AR = arm-vita-eabi-ar$(EXE_EXT)
2015-09-18 19:40:19 +00:00
CFLAGS += -DHAVE_STRLWR -DVITA
2015-08-31 20:10:56 +00:00
STATIC_LINKING = 1
2015-09-09 05:24:45 +00:00
# CTR (3DS)
else ifeq ($(platform), ctr)
2016-02-05 15:06:57 +00:00
EXT=a
TARGET := $(TARGET_NAME)_libretro_ctr.$(EXT)
2015-09-09 05:24:45 +00:00
CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT)
AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DARM11 -D_3DS
CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard
CFLAGS += -Wall -mword-relocations
CFLAGS += -fomit-frame-pointer -ffast-math
STATIC_LINKING = 1
2015-08-31 20:10:56 +00:00
2012-05-12 20:26:23 +00:00
else ifeq ($(platform), xenon)
2016-02-05 15:06:57 +00:00
EXT=a
TARGET := $(TARGET_NAME)_libretro_xenon360.$(EXT)
CC = xenon-gcc$(EXE_EXT)
AR = xenon-ar$(EXE_EXT)
2015-08-27 06:13:20 +00:00
CFLAGS += -D__LIBXENON__ -m32 -D__ppc__ -DMSB_FIRST
2013-05-18 15:55:38 +00:00
STATIC_LINKING = 1
else ifeq ($(platform), ngc)
2016-02-05 15:06:57 +00:00
EXT=a
TARGET := $(TARGET_NAME)_libretro_ngc.$(EXT)
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
2015-09-18 19:40:19 +00:00
CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DMEMORY_LOW -DMSB_FIRST
2013-05-18 15:55:38 +00:00
STATIC_LINKING = 1
2012-05-12 20:26:23 +00:00
else ifeq ($(platform), wii)
2016-02-05 15:06:57 +00:00
EXT=a
TARGET := $(TARGET_NAME)_libretro_wii.$(EXT)
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
2015-09-18 19:40:19 +00:00
CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DMSB_FIRST
2013-05-18 15:55:38 +00:00
STATIC_LINKING = 1
2013-07-13 23:49:25 +00:00
else ifneq (,$(findstring armv,$(platform)))
2016-02-05 15:06:57 +00:00
EXT?=so
TARGET := $(TARGET_NAME)_libretro.$(EXT)
2013-07-13 23:49:25 +00:00
SHARED := -shared -Wl,--no-undefined
fpic := -fPIC
CC = gcc
ifneq (,$(findstring cortexa8,$(platform)))
CFLAGS += -marm -mcpu=cortex-a8
ASFLAGS += -mcpu=cortex-a8
else ifneq (,$(findstring cortexa9,$(platform)))
CFLAGS += -marm -mcpu=cortex-a9
ASFLAGS += -mcpu=cortex-a9
endif
CFLAGS += -marm
ifneq (,$(findstring neon,$(platform)))
CFLAGS += -mfpu=neon
ASFLAGS += -mfpu=neon
HAVE_NEON = 1
endif
ifneq (,$(findstring softfloat,$(platform)))
CFLAGS += -mfloat-abi=softfp
ASFLAGS += -mfloat-abi=softfp
else ifneq (,$(findstring hardfloat,$(platform)))
CFLAGS += -mfloat-abi=hard
ASFLAGS += -mfloat-abi=hard
endif
CFLAGS += -DARM
2016-03-01 21:32:11 +00:00
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
fpic := -fPIC
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,-no-undefined
CFLAGS += -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float
2012-05-12 20:26:23 +00:00
else
2016-02-05 15:06:57 +00:00
EXT?=dll
TARGET := $(TARGET_NAME)_libretro.$(EXT)
2012-05-12 20:26:23 +00:00
CC = gcc
2012-07-26 12:34:52 +00:00
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=libretro/link.T
2015-09-18 19:40:19 +00:00
CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__ -Wno-missing-field-initializers -DHAVE_STRLWR
2012-05-12 20:26:23 +00:00
endif
2016-02-05 15:06:57 +00:00
ifeq ($(STATIC_LINKING),1)
SHARED=
fpic=
endif
2015-03-02 15:39:03 +00:00
LDFLAGS += $(LIBM)
CFLAGS += -DHAVE_LIBMAD -DMUSIC_SUPPORT
2012-05-12 20:26:23 +00:00
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
else
2014-12-23 18:26:42 +00:00
CFLAGS += -O2 -DNDEBUG
2012-05-12 20:26:23 +00:00
endif
2014-11-02 16:18:56 +00:00
ROOT_DIR := .
CORE_DIR := src
2012-05-12 20:26:23 +00:00
2014-11-02 16:18:56 +00:00
include Makefile.common
2012-05-12 20:26:23 +00:00
2014-11-02 16:18:56 +00:00
OBJECTS = $(SOURCES_C:.c=.o)
2012-05-12 20:26:23 +00:00
2015-11-03 21:05:59 +00:00
DEFINES = -D__LIBRETRO__ -DINLINE=inline -DFPM_DEFAULT -DFRONTEND_SUPPORTS_RGB565
2012-05-12 20:26:23 +00:00
ifeq ($(platform), sncps3)
WARNINGS_DEFINES =
CODE_DEFINES =
else
WARNINGS_DEFINES = -Wall -W -Wno-unused-parameter
CODE_DEFINES = -fomit-frame-pointer
2012-05-12 20:26:23 +00:00
endif
2014-12-23 18:26:42 +00:00
COMMON_DEFINES += $(CODE_DEFINES) $(WARNINGS_DEFINES) $(fpic)
2012-05-12 20:26:23 +00:00
CFLAGS += $(DEFINES) $(COMMON_DEFINES)
2012-05-12 20:26:23 +00:00
2014-12-23 18:26:42 +00:00
%.o: %.c
$(CC) $(INCFLAGS) $(CFLAGS) -c -o $@ $<
ifeq ($(platform), theos_ios)
COMMON_FLAGS := -DIOS $(COMMON_DEFINES) $(INCFLAGS) -I$(THEOS_INCLUDE_PATH) -Wno-error
$(LIBRARY_NAME)_CFLAGS += $(COMMON_FLAGS) $(CFLAGS)
${LIBRARY_NAME}_FILES = $(SOURCES_C)
include $(THEOS_MAKE_PATH)/library.mk
else
2012-05-12 20:26:23 +00:00
all: $(TARGET)
$(TARGET): $(OBJECTS)
2013-05-18 15:55:38 +00:00
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
else
2015-03-02 15:39:03 +00:00
$(CC) $(fpic) $(SHARED) $(INCFLAGS) -o $@ $(OBJECTS) $(LDFLAGS)
endif
2012-05-12 20:26:23 +00:00
2012-08-22 23:33:19 +00:00
clean-objs:
rm -f $(OBJECTS)
2012-05-12 20:26:23 +00:00
clean:
rm -f $(OBJECTS) $(TARGET)
2012-08-22 23:33:19 +00:00
.PHONY: clean clean-objs
2014-12-23 18:26:42 +00:00
endif