smsplus-gx/Makefile.rs90
gameblabla 600d1ed6a5
Fix sound issues for good with triple/double buffering.
The source code needed some changes before this happened
2020-10-13 15:17:29 +02:00

82 lines
2.7 KiB
Makefile

PRGNAME = sms_sdl
CC = /opt/rs90-toolchain/bin/mipsel-linux-gcc
# Possible choices : rs97, k3s (PAP K3S), sdl, amini, fbdev
PORT = rs90
# Possible choices : alsa, pulse (pulseaudio), oss, sdl12 (SDL 1.2 sound output), portaudio, libao
SOUND_OUTPUT = sdl12
# Possible choices : crabemu_sn76489 (less accurate, GPLv2), maxim_sn76489 (somewhat problematic license but good accuracy)
SOUND_ENGINE = maxim_sn76489
# Possible choices : z80 (accurate but proprietary), eighty (EightyZ80's core, GPLv2)
Z80_CORE = z80
PROFILE = 0
ZIP_SUPPORT = 1
SRCDIR = ./source ./source/cpu_cores/$(Z80_CORE) ./source/sound ./source/unzip
SRCDIR += ./source/ports/$(PORT) ./source/sound/$(SOUND_ENGINE) ./source/sound_output/$(SOUND_OUTPUT)
VPATH = $(SRCDIR)
SRC_C = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.c))
SRC_CP = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.cpp))
OBJ_C = $(notdir $(patsubst %.c, %.o, $(SRC_C)))
OBJ_CP = $(notdir $(patsubst %.cpp, %.o, $(SRC_CP)))
OBJS = $(OBJ_C) $(OBJ_CP)
CFLAGS = -Ofast -fdata-sections -ffunction-sections -mplt -mno-shared -mframe-header-opt -fno-common -march=mips32 -mtune=mips32 -flto=auto
CFLAGS += -falign-functions=4 -falign-jumps=4 -falign-loops=4 -falign-labels=4 -fsingle-precision-constant
CFLAGS += -mno-fp-exceptions -mno-check-zero-division -fno-common -fno-short-enums -ffinite-math-only -funsafe-math-optimizations -fsection-anchors -fgcse-las -fgcse-sm
CFLAGS += -DALIGN_DWORD -D_8BPP_COLOR -DNOBLANKING_LEFTCOLUM -DNONBLOCKING_AUDIO
CFLAGS += -DLSB_FIRST
CFLAGS += -Isource -Isource/cpu_cores/$(Z80_CORE) -Isource/scalers -Isource/ports/$(PORT) -I./source/sound -Isource/unzip -Isource/sdl -Isource/sound/$(SOUND_ENGINE) -Isource/sound_output
SRCDIR += ./source/text/fb
CFLAGS += -Isource/text/fb
ifeq ($(PROFILE), YES)
CFLAGS += -fprofile-generate="/usr/local/home"
LDFLAGS = -lgcov
else ifeq ($(PROFILE), APPLY)
CFLAGS += -fprofile-use
LDFLAGS = -nodefaultlibs
else
LDFLAGS = -nodefaultlibs
endif
ifeq ($(SOUND_ENGINE), maxim_sn76489)
CFLAGS += -DMAXIM_PSG
endif
ifeq ($(ZIP_SUPPORT), 0)
CFLAGS += -DNOZIP_SUPPORT
endif
ifeq ($(SCALE2X_UPSCALER), 1)
CFLAGS += -DSCALE2X_UPSCALER
CFLAGS += -Isource/scale2x
SRCDIR += ./source/scale2x
endif
LDFLAGS += -lc -lgcc -lSDL -Wl,--as-needed -Wl,--gc-sections -flto=auto -s
ifeq ($(SOUND_OUTPUT), portaudio)
LDFLAGS += -lportaudio
endif
ifeq ($(SOUND_OUTPUT), libao)
LDFLAGS += -lao
endif
ifeq ($(SOUND_OUTPUT), alsa)
LDFLAGS += -lasound
endif
ifeq ($(SOUND_OUTPUT), pulse)
LDFLAGS += -lpulse -lpulse-simple
endif
# Rules to make executable
$(PRGNAME): $(OBJS)
$(CC) $(CFLAGS) -o $(PRGNAME) $^ $(LDFLAGS)
$(OBJ_C) : %.o : %.c
$(CC) $(CFLAGS) -std=gnu99 -c -o $@ $<
clean:
rm -f $(PRGNAME) *.o