mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-04 23:07:46 -04:00
build, add ASAN, some CFLAGS changes, add revision
This commit is contained in:
parent
83a9e30508
commit
3a77090514
5 changed files with 34 additions and 20 deletions
30
Makefile
30
Makefile
|
@ -1,5 +1,6 @@
|
|||
$(LD) ?= $(CC)
|
||||
TARGET ?= PicoDrive
|
||||
ASAN ?= 0
|
||||
DEBUG ?= 0
|
||||
CFLAGS += -I$(PWD)
|
||||
CYCLONE_CC ?= gcc
|
||||
|
@ -41,22 +42,41 @@ ifneq ($(findstring gcc,$(shell $(CC) -v 2>&1)),)
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq "$(ASAN)" "1"
|
||||
CFLAGS += -fsanitize=address -fsanitize=leak -fsanitize=bounds -fno-omit-frame-pointer -fno-common -O1 -g
|
||||
LDLIBS += -fsanitize=address -fsanitize=leak -fsanitize=bounds -static-libasan
|
||||
else
|
||||
ifeq "$(DEBUG)" "0"
|
||||
CFLAGS += -O3 -DNDEBUG
|
||||
endif
|
||||
endif
|
||||
LD = $(CC)
|
||||
OBJOUT ?= -o
|
||||
LINKOUT ?= -o
|
||||
endif
|
||||
|
||||
|
||||
chkCCflag = $(shell n=/dev/null; echo $(1) | tr " " "\n" | while read f; do \
|
||||
$(CC) $$f -x c -c $$n -o $$n 2>$$n && echo "_$$f" | tr -d _; done)
|
||||
|
||||
ifeq ("$(PLATFORM)",$(filter "$(PLATFORM)","gp2x" "opendingux" "miyoo" "rpi1"))
|
||||
# very small caches, avoid optimization options making the binary much bigger
|
||||
CFLAGS += -finline-limit=42 -fno-unroll-loops -fno-ipa-cp -ffast-math
|
||||
# this gets you about 20% better execution speed on 32bit arm/mips
|
||||
CFLAGS += -fno-common -fno-stack-protector -fno-guess-branch-probability -fno-caller-saves -fno-regmove
|
||||
# Ouf, very old gcc toolchains (pre 4.6) don't have this option:
|
||||
CFLAGS += $(shell echo | $(CC) -ftree-loop-if-convert -x c -c -o /dev/null - 2>/dev/null && echo xfno-tree-loop-if-convert | tr x -)
|
||||
CFLAGS += -fno-common -fno-stack-protector -finline-limit=42 -fno-unroll-loops -ffast-math
|
||||
ifneq ($(call chkCCflag, -fipa-ra),) # gcc >= 5
|
||||
CFLAGS += $(call chkCCflag, -flto -fipa-pta -fipa-ra)
|
||||
else
|
||||
# these improve execution speed on 32bit arm/mips with gcc pre-5 toolchains
|
||||
CFLAGS += -fno-ipa-cp -fno-caller-saves -fno-guess-branch-probability -fno-regmove
|
||||
# very old gcc toolchains may not have these options
|
||||
CFLAGS += $(call chkCCflag, -fno-tree-loop-if-convert -fipa-pta)
|
||||
endif
|
||||
endif
|
||||
|
||||
# revision info from repository if this not a tagged release
|
||||
ifeq "$(shell git describe --tags --exact-match HEAD 2>/dev/null)" ""
|
||||
REVISION ?= -$(shell git rev-parse --short HEAD || echo ???)
|
||||
endif
|
||||
CFLAGS += -DREVISION=\"$(REVISION)\"
|
||||
|
||||
# default settings
|
||||
use_libchdr ?= 1
|
||||
|
|
|
@ -40,10 +40,8 @@ STATIC_LINKING_LINK:= 0
|
|||
LOW_MEMORY := 0
|
||||
TARGET_NAME := picodrive
|
||||
LIBM := -lm
|
||||
GIT_VERSION ?= $(shell git rev-parse --short HEAD || echo unknown)
|
||||
ifneq ($(GIT_VERSION),"unknown")
|
||||
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
|
||||
endif
|
||||
REVISION ?= -$(shell git rev-parse --short HEAD || echo ???)
|
||||
|
||||
|
||||
fpic :=
|
||||
|
||||
|
@ -68,7 +66,6 @@ else ifneq (,$(findstring x86,$(platform)))
|
|||
ARCH := 86
|
||||
fpic := -fPIC
|
||||
SHARED := -shared
|
||||
DONT_COMPILE_IN_ZLIB = 1
|
||||
CFLAGS += -DFAMEC_NO_GOTOS
|
||||
|
||||
# AARCH64 generic
|
||||
|
@ -77,7 +74,6 @@ else ifeq ($(platform), aarch64)
|
|||
ARCH = aarch64
|
||||
fpic := -fPIC
|
||||
SHARED := -shared
|
||||
DONT_COMPILE_IN_ZLIB = 1
|
||||
CFLAGS += -DFAMEC_NO_GOTOS
|
||||
|
||||
# Portable Linux
|
||||
|
@ -492,7 +488,6 @@ else ifeq ($(platform), miyoo)
|
|||
SHARED := -shared -nostdlib
|
||||
fpic := -fPIC
|
||||
LIBM :=
|
||||
DONT_COMPILE_IN_ZLIB = 1
|
||||
CFLAGS += -fomit-frame-pointer -ffast-math -march=armv5te -mtune=arm926ej-s -D__GCW0__
|
||||
HAVE_ARMv6 = 0
|
||||
LOW_MEMORY = 1
|
||||
|
@ -604,7 +599,7 @@ else
|
|||
|
||||
endif
|
||||
|
||||
CFLAGS += -DNO_ZLIB -D__LIBRETRO__
|
||||
CFLAGS += -D__LIBRETRO__
|
||||
|
||||
ifeq ($(USE_LIBRETRO_VFS),1)
|
||||
CFLAGS += -DUSE_LIBRETRO_VFS
|
||||
|
@ -707,6 +702,8 @@ else
|
|||
LD = $(CC)
|
||||
endif
|
||||
|
||||
PLATFORM_ZLIB ?= 1
|
||||
|
||||
include Makefile
|
||||
|
||||
ifeq ($(platform), osx)
|
||||
|
|
|
@ -35,7 +35,9 @@
|
|||
#endif
|
||||
|
||||
// FIXME
|
||||
#ifndef REVISION
|
||||
#define REVISION "0"
|
||||
#endif
|
||||
|
||||
static const char *rom_exts[] = {
|
||||
"zip", "bin",
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define VERSION "1.99"
|
||||
#define VERSION "1.99" REVISION
|
||||
|
|
|
@ -670,12 +670,7 @@ void retro_get_system_info(struct retro_system_info *info)
|
|||
{
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->library_name = "PicoDrive";
|
||||
#ifndef GIT_VERSION
|
||||
#define _GIT_VERSION ""
|
||||
#else
|
||||
#define _GIT_VERSION "-" GIT_VERSION
|
||||
#endif
|
||||
info->library_version = VERSION _GIT_VERSION;
|
||||
info->library_version = VERSION;
|
||||
info->valid_extensions = "bin|gen|smd|md|32x|cue|iso|chd|sms|gg|sg|sc|m3u|68k|sgd|pco";
|
||||
info->need_fullpath = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue