smsplus-gx/Makefile.350h
gameblabla be19161bfb
Delete RS-97 port (no longer needed), fix GCW0 port and make minor
changes to audio code.
We are now linking against the newer toolchain with support for Huge pages.
2020-10-04 23:17:10 +02:00

77 lines
2.6 KiB
Makefile

PRGNAME = sms_sdl
CC = /opt/gcw0-toolchain-static/usr/bin/mipsel-linux-gcc
# Possible choices : rs97, k3s (PAP K3S), sdl, amini, fbdev
PORT = 350h
# Possible choices : alsa, pulse (pulseaudio), oss, sdl12 (SDL 1.2 sound output), portaudio, libao
SOUND_OUTPUT = alsa
# Possible choices : crabemu_sn76489 (less accurate, GPLv2), maxim_sn76489 (somewhat problematic license but good accuracy)
SOUND_ENGINE = maxim_sn76489
# Possible choices : z80 (accurate), eighty (EightyZ80's core, GPLv2)
Z80_CORE = z80
SCALE2X_UPSCALER = 1
PROFILE = 0
ZIP_SUPPORT = 1
SRCDIR = ./source ./source/cpu_cores/$(Z80_CORE) ./source/sound ./source/unzip
SRCDIR += ./source/scalers ./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 -mframe-header-opt -mno-fp-exceptions -mno-check-zero-division -fsingle-precision-constant -fno-common -march=mips32r2 -mtune=mips32r2 -mno-abicalls -fno-PIC -flto
# SMS Plus GX suffers from alignment issues so setting these to 1 helps.
CFLAGS += -falign-functions=1 -falign-jumps=1 -falign-loops=1 -falign-labels=1
CFLAGS += -fipa-pta -fsection-anchors -fdelete-dead-exceptions
CFLAGS += -DALIGN_DWORD -DNOBLANKING_LEFTCOLUM
CFLAGS += -DLSB_FIRST -std=gnu99
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/.smsplus
else ifeq ($(PROFILE), APPLY)
CFLAGS += -fprofile-use -fbranch-probabilities
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 = -nodefaultlibs -lc -lgcc -lSDL -lasound -lm -Wl,--as-needed -Wl,--gc-sections -flto -s
ifeq ($(SOUND_OUTPUT), portaudio)
LDFLAGS += -lportaudio
endif
ifeq ($(SOUND_OUTPUT), libao)
LDFLAGS += -lao
endif
ifeq ($(SOUND_OUTPUT), alsa)
LDFLAGS += -lasound
endif
# Rules to make executable
$(PRGNAME): $(OBJS)
$(CC) $(CFLAGS) -o $(PRGNAME) $^ $(LDFLAGS)
$(OBJ_C) : %.o : %.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f $(PRGNAME) *.o