smsplus-gx/Makefile.rs97
gameblabla 818c4ed965
Update Makefiles, they should look similar now except for
specific changes according to the arch & platform of course.
2019-03-13 02:45:25 +01:00

74 lines
2.3 KiB
Makefile

PRGNAME = sms_sdl
CC = /opt/rs97-toolchain/bin/mipsel-linux-gcc
# Possible choices : rs97, k3s (PAP K3S), sdl, amini
PORT = rs97
# Possible choices : alsa, pulse (pulseaudio), oss, sdl12 (SDL 1.2 sound output), portaudio, libao
SOUND_OUTPUT = oss
# 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
SCALE2X_UPSCALER = 1
PROFILE = 0
# add SDL dependencies
# Files to be r
SRCDIR = ./source ./source/unzip ./source/cpu_cores/$(Z80_CORE) ./source/sound
SRCDIR += ./source/generic ./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 -mno-fp-exceptions -mno-check-zero-division -mframe-header-opt -fsingle-precision-constant -fno-common -mips32 -fno-PIC -mno-abicalls
CFLAGS += -DALIGN_DWORD
CFLAGS += -DLSB_FIRST -std=gnu99
CFLAGS += -I/usr/include/SDL
CFLAGS += -Isource -Isource/cpu_cores/$(Z80_CORE) -Isource/generic -Isource/ports/$(PORT) -I./source/sound -Isource/unzip -Isource/sdl -Isource/sound/$(SOUND_ENGINE) -Isource/sound_output
ifeq ($(PROFILE), 1)
CFLAGS += -fprofile-generate=/home/retrofw/profile
else
CFLAGS += -fprofile-use
endif
ifeq ($(SOUND_ENGINE), maxim_sn76489)
CFLAGS += -DMAXIM_PSG
endif
ifeq ($(SCALE2X_UPSCALER), 1)
CFLAGS += -DSCALE2X_UPSCALER
CFLAGS += -Isource/scale2x
SRCDIR += ./source/scale2x
endif
LDFLAGS = -lSDL -lm -lz -lc -no-pie -Wl,--as-needed -Wl,--gc-sections -s -flto
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) -c -o $@ $<
clean:
rm -f $(PRGNAME) *.o