mirror of
https://github.com/libretro/mgba.git
synced 2024-11-23 07:59:46 +00:00
100 lines
1.8 KiB
Makefile
100 lines
1.8 KiB
Makefile
|
##############
|
||
|
# Works on hosts Linux
|
||
|
#
|
||
|
|
||
|
#############
|
||
|
# User config
|
||
|
|
||
|
DEBUG = 0
|
||
|
LOG_PERFORMANCE = 1
|
||
|
|
||
|
##########################
|
||
|
# Checks the host platform
|
||
|
|
||
|
HOST_PLATFORM = linux
|
||
|
ifeq ($(shell uname -a),)
|
||
|
HOST_PLATFORM = windows
|
||
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||
|
HOST_PLATFORM = windows
|
||
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||
|
HOST_PLATFORM = darwin
|
||
|
else ifneq ($(findstring win,$(shell uname -a)),)
|
||
|
HOST_PLATFORM = windows
|
||
|
endif
|
||
|
|
||
|
|
||
|
####################################
|
||
|
# Variable setup for Makefile.common
|
||
|
|
||
|
CORE_DIR ?= ..
|
||
|
BUILD_DIR ?= .
|
||
|
INCLUDES =
|
||
|
|
||
|
include $(BUILD_DIR)/Makefile.common
|
||
|
|
||
|
#################
|
||
|
# Toolchain setup
|
||
|
|
||
|
CC = gcc
|
||
|
CXX = g++
|
||
|
AS = as
|
||
|
AR = ar
|
||
|
|
||
|
############
|
||
|
# Extensions
|
||
|
|
||
|
OBJEXT = .linux_x86_64.o
|
||
|
SOEXT = .linux_x86_64.so
|
||
|
|
||
|
################
|
||
|
# Platform setup
|
||
|
|
||
|
STATIC_LINKING = 0
|
||
|
platform = unix
|
||
|
PLATDEFS =
|
||
|
PLATCFLAGS = -m64 -fpic -fstrict-aliasing
|
||
|
PLATCXXFLAGS = -m64 -fpic -fstrict-aliasing
|
||
|
PLATLDFLAGS = -m64 -shared -lm -Wl,-version-script=$(BUILD_DIR)/link.T
|
||
|
PLATLDXFLAGS = -m64 -shared -lm -Wl,-version-script=$(BUILD_DIR)/link.T
|
||
|
|
||
|
################
|
||
|
# libretro setup
|
||
|
|
||
|
RETRODEFS = -D__LIBRETRO__
|
||
|
RETROCFLAGS =
|
||
|
RETROCXXFLAGS =
|
||
|
RETROLDFLAGS =
|
||
|
RETROLDXFLAGS =
|
||
|
|
||
|
#################
|
||
|
# Final variables
|
||
|
|
||
|
DEFINES = $(PLATDEFS) $(RETRODEFS)
|
||
|
CFLAGS = $(PLATCFLAGS) $(RETROCFLAGS) $(DEFINES) $(INCLUDES)
|
||
|
CXXFLAGS = $(PLATCXXFLAGS) $(RETROCXXFLAGS) $(DEFINES) $(INCLUDES)
|
||
|
LDFLAGS = $(PLATLDFLAGS) $(RETROLDFLAGS)
|
||
|
LDXFLAGS = $(PLATLDXFLAGS) $(RETROLDXFLAGS)
|
||
|
|
||
|
########
|
||
|
# Tuning
|
||
|
|
||
|
ifeq ($(DEBUG), 1)
|
||
|
CFLAGS += -O0 -g
|
||
|
CXXFLAGS += -O0 -g
|
||
|
LDFLAGS += -g
|
||
|
LDXFLAGS += -g
|
||
|
else
|
||
|
CFLAGS += -O3 -DNDEBUG
|
||
|
CXXFLAGS += -O3 -DNDEBUG
|
||
|
endif
|
||
|
|
||
|
ifeq ($(LOG_PERFORMANCE), 1)
|
||
|
CFLAGS += -DLOG_PERFORMANCE
|
||
|
CXXFLAGS += -DLOG_PERFORMANCE
|
||
|
endif
|
||
|
|
||
|
###############
|
||
|
# Include rules
|
||
|
|
||
|
include $(BUILD_DIR)/Makefile.rules
|