2019-03-07 18:08:20 +00:00
|
|
|
PRGNAME = sms_sdl
|
2019-03-15 19:58:09 +00:00
|
|
|
CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
|
2019-03-07 18:08:20 +00:00
|
|
|
|
2019-03-15 19:58:09 +00:00
|
|
|
# Possible choices : rs97, k3s (PAP K3S), sdl, amini, fbdev
|
2019-10-26 18:18:10 +00:00
|
|
|
PORT = gcw0
|
2019-03-13 01:45:25 +00:00
|
|
|
# Possible choices : alsa, pulse (pulseaudio), oss, sdl12 (SDL 1.2 sound output), portaudio, libao
|
2019-03-07 18:08:20 +00:00
|
|
|
SOUND_OUTPUT = alsa
|
2019-03-13 01:45:25 +00:00
|
|
|
# Possible choices : crabemu_sn76489 (less accurate, GPLv2), maxim_sn76489 (somewhat problematic license but good accuracy)
|
2019-03-07 18:08:20 +00:00
|
|
|
SOUND_ENGINE = maxim_sn76489
|
2019-09-18 18:25:56 +00:00
|
|
|
# Possible choices : z80 (accurate), eighty (EightyZ80's core, GPLv2)
|
2019-03-07 18:08:20 +00:00
|
|
|
Z80_CORE = z80
|
2019-03-13 01:45:25 +00:00
|
|
|
SCALE2X_UPSCALER = 1
|
2020-10-04 21:17:10 +00:00
|
|
|
PROFILE = APPLY
|
2019-03-15 19:58:09 +00:00
|
|
|
ZIP_SUPPORT = 1
|
2020-10-04 21:17:10 +00:00
|
|
|
HUGE_PAGES = 1
|
2019-03-13 01:45:25 +00:00
|
|
|
|
2019-03-15 19:58:09 +00:00
|
|
|
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)
|
2019-03-13 01:45:25 +00:00
|
|
|
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)
|
2019-03-07 18:08:20 +00:00
|
|
|
|
2020-10-04 21:17:10 +00:00
|
|
|
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 -flto
|
2019-03-15 19:58:09 +00:00
|
|
|
# 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
|
2020-10-04 21:17:10 +00:00
|
|
|
CFLAGS += -DALIGN_DWORD -DNOBLANKING_LEFTCOLUM -DOPENDINGUX_GCD_16PIXELS_ISSUE
|
2019-03-13 01:45:25 +00:00
|
|
|
CFLAGS += -DLSB_FIRST -std=gnu99
|
2019-03-15 19:58:09 +00:00
|
|
|
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
|
2019-03-13 01:45:25 +00:00
|
|
|
|
2019-03-15 19:58:09 +00:00
|
|
|
ifeq ($(PROFILE), YES)
|
2019-03-13 01:45:25 +00:00
|
|
|
CFLAGS += -fprofile-generate=/usr/local/home/.smsplus
|
2019-03-15 19:58:09 +00:00
|
|
|
else ifeq ($(PROFILE), APPLY)
|
|
|
|
CFLAGS += -fprofile-use -fbranch-probabilities
|
2019-03-07 18:08:20 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(SOUND_ENGINE), maxim_sn76489)
|
|
|
|
CFLAGS += -DMAXIM_PSG
|
|
|
|
endif
|
|
|
|
|
2019-03-15 19:58:09 +00:00
|
|
|
ifeq ($(ZIP_SUPPORT), 0)
|
|
|
|
CFLAGS += -DNOZIP_SUPPORT
|
|
|
|
endif
|
|
|
|
|
2019-03-13 01:45:25 +00:00
|
|
|
ifeq ($(SCALE2X_UPSCALER), 1)
|
|
|
|
CFLAGS += -DSCALE2X_UPSCALER
|
|
|
|
CFLAGS += -Isource/scale2x
|
|
|
|
SRCDIR += ./source/scale2x
|
|
|
|
endif
|
|
|
|
|
2020-10-04 21:17:10 +00:00
|
|
|
ifeq ($(HUGE_PAGES), 0)
|
|
|
|
LDFLAGS = -nodefaultlibs
|
|
|
|
endif
|
|
|
|
LDFLAGS += -lc -lgcc -lSDL -lasound -lm -flto -s
|
|
|
|
ifeq ($(HUGE_PAGES), 1)
|
|
|
|
LDFLAGS += -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152 -lhugetlbfs
|
|
|
|
endif
|
2019-03-13 01:45:25 +00:00
|
|
|
|
|
|
|
ifeq ($(SOUND_OUTPUT), portaudio)
|
|
|
|
LDFLAGS += -lportaudio
|
|
|
|
endif
|
|
|
|
ifeq ($(SOUND_OUTPUT), libao)
|
|
|
|
LDFLAGS += -lao
|
|
|
|
endif
|
2019-03-07 18:08:20 +00:00
|
|
|
ifeq ($(SOUND_OUTPUT), alsa)
|
|
|
|
LDFLAGS += -lasound
|
|
|
|
endif
|
2019-03-13 01:45:25 +00:00
|
|
|
ifeq ($(SOUND_OUTPUT), pulse)
|
|
|
|
LDFLAGS += -lpulse -lpulse-simple
|
|
|
|
endif
|
2019-03-07 18:08:20 +00:00
|
|
|
|
|
|
|
# Rules to make executable
|
|
|
|
$(PRGNAME): $(OBJS)
|
|
|
|
$(CC) $(CFLAGS) -o $(PRGNAME) $^ $(LDFLAGS)
|
2020-10-04 21:17:10 +00:00
|
|
|
ifeq ($(HUGE_PAGES), 1)
|
|
|
|
hugeedit --text --data $(PRGNAME)
|
|
|
|
endif
|
2019-03-07 18:08:20 +00:00
|
|
|
|
|
|
|
$(OBJ_C) : %.o : %.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
2020-10-04 21:17:10 +00:00
|
|
|
|
2019-03-07 18:08:20 +00:00
|
|
|
clean:
|
|
|
|
rm -f $(PRGNAME) *.o
|