From 0198149a7284d9f5369f84b818e86a2bc77ebb8f Mon Sep 17 00:00:00 2001 From: kub Date: Wed, 8 Jul 2020 20:14:12 +0200 Subject: [PATCH] libretro, changes to allow for both standalone and libretro build --- Makefile | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index d88e51f6..f80a9ec7 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,6 @@ TARGET ?= PicoDrive DEBUG ?= 0 -CFLAGS += -Wall -ggdb -ffunction-sections -fdata-sections CFLAGS += -I. -ifeq "$(DEBUG)" "0" -CFLAGS += -O3 -DNDEBUG -endif - -# This is actually needed, believe me. -# If you really have to disable this, set NO_ALIGN_FUNCTIONS elsewhere. -ifndef NO_ALIGN_FUNCTIONS -CFLAGS += -falign-functions=2 -endif -LDFLAGS += -Wl,--gc-sections - -# profiling -pprof ?= 0 -gperf ?= 0 all: config.mak target_ @@ -34,6 +19,28 @@ else # NO_CONFIG_MAK config.mak: endif +# This is actually needed, believe me. +# If you really have to disable this, set NO_ALIGN_FUNCTIONS elsewhere. +ifndef NO_ALIGN_FUNCTIONS +CFLAGS += -falign-functions=2 +endif +LDFLAGS += -Wl,--gc-sections + +# profiling +pprof ?= 0 +gperf ?= 0 + +ifneq ("$(PLATFORM)", "libretro") + CFLAGS += -Wall -g +ifneq ($(findstring gcc,$(CC)),) + CFLAGS += -ffunction-sections -fdata-sections + LDFLAGS += -Wl,--gc-sections +endif +ifeq "$(DEBUG)" "0" + CFLAGS += -O3 -DNDEBUG +endif +endif + ifeq ("$(PLATFORM)",$(filter "$(PLATFORM)","gp2x" "opendingux" "rpi1")) # very small caches, avoid optimization options making the binary much bigger CFLAGS += -finline-limit=42 -fno-unroll-loops -fno-ipa-cp -ffast-math -- 2.39.2