mirror of
https://github.com/kbeckmann/game-and-watch-retro-go.git
synced 2025-12-16 13:15:55 +01:00
133 lines
3.2 KiB
Makefile
133 lines
3.2 KiB
Makefile
TARGET = retro-go-snes
|
|
|
|
DEBUG = 1
|
|
#OPT = -O2 -ggdb -fsanitize=address
|
|
#OPT = -O0 -ggdb3 -fsanitize=address
|
|
OPT = -O0 -ggdb3
|
|
|
|
|
|
BUILD_DIR = build
|
|
|
|
|
|
C_SOURCES = \
|
|
odroid_input.c \
|
|
odroid_netplay.c \
|
|
odroid_overlay.c \
|
|
odroid_sdcard.c \
|
|
odroid_system.c \
|
|
odroid_display.c \
|
|
odroid_audio.c \
|
|
gw_lcd.c \
|
|
crc32.c \
|
|
porting.c
|
|
|
|
CXX_SOURCES = \
|
|
snes/main_snes.cpp \
|
|
../3rdparty/snes9x/c4.cpp \
|
|
../3rdparty/snes9x/c4emu.cpp \
|
|
../3rdparty/snes9x/clip.cpp \
|
|
../3rdparty/snes9x/controls.cpp \
|
|
../3rdparty/snes9x/cpu.cpp \
|
|
../3rdparty/snes9x/cpuexec.cpp \
|
|
../3rdparty/snes9x/cpuops.cpp \
|
|
../3rdparty/snes9x/debug.cpp \
|
|
../3rdparty/snes9x/dma.cpp \
|
|
../3rdparty/snes9x/dsp1.cpp \
|
|
../3rdparty/snes9x/dsp2.cpp \
|
|
../3rdparty/snes9x/dsp.cpp \
|
|
../3rdparty/snes9x/gfx.cpp \
|
|
../3rdparty/snes9x/globals.cpp \
|
|
../3rdparty/snes9x/memmap.cpp \
|
|
../3rdparty/snes9x/ppu.cpp \
|
|
../3rdparty/snes9x/snapshot.cpp \
|
|
../3rdparty/snes9x/snes9x.cpp \
|
|
../3rdparty/snes9x/statemanager.cpp \
|
|
../3rdparty/snes9x/stream.cpp \
|
|
../3rdparty/snes9x/tile.cpp \
|
|
\
|
|
../3rdparty/snes9x/apu/apu.cpp \
|
|
../3rdparty/snes9x/apu/bapu/dsp/SPC_DSP.cpp \
|
|
../3rdparty/snes9x/apu/bapu/dsp/sdsp.cpp \
|
|
../3rdparty/snes9x/apu/bapu/smp/smp.cpp \
|
|
../3rdparty/snes9x/apu/bapu/smp/smp_state.cpp \
|
|
|
|
|
|
PREFIX =
|
|
|
|
CC = $(PREFIX)gcc
|
|
CXX = $(PREFIX)g++
|
|
AS = $(PREFIX)gcc -x assembler-with-cpp
|
|
CP = $(PREFIX)objcopy
|
|
SZ = $(PREFIX)size
|
|
|
|
HEX = $(CP) -O ihex
|
|
BIN = $(CP) -O binary -S
|
|
|
|
C_DEFS = \
|
|
-DIS_LITTLE_ENDIAN
|
|
|
|
C_INCLUDES = \
|
|
-I. \
|
|
-I./snes \
|
|
-I../retro-go-stm32/nofrendo-go/components/nofrendo/cpu \
|
|
-I../retro-go-stm32/nofrendo-go/components/nofrendo/mappers \
|
|
-I../retro-go-stm32/nofrendo-go/components/nofrendo/nes \
|
|
-I../retro-go-stm32/nofrendo-go/components/nofrendo \
|
|
-I../retro-go-stm32/components/odroid
|
|
|
|
CXX_INCLUDES = \
|
|
-I../3rdparty/snes9x \
|
|
-I../3rdparty/snes9x/apu \
|
|
-I../3rdparty/snes9x/apu/bapu/dsp \
|
|
-I../3rdparty/snes9x/apu/bapu/smp \
|
|
|
|
|
|
ASFLAGS = $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
|
CFLAGS = $(C_DEFS) $(C_INCLUDES) `sdl2-config --cflags` $(OPT) -Wall -fdata-sections -ffunction-sections
|
|
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
|
|
|
|
|
|
CXXFLAGS = $(CFLAGS) $(CXX_INCLUDES) \
|
|
-fno-rtti \
|
|
-fno-exceptions \
|
|
-fno-math-errno \
|
|
-fomit-frame-pointer \
|
|
-fno-stack-protector \
|
|
-DRIGHTSHIFT_IS_SAR \
|
|
-DHAVE_STDINT_H \
|
|
-DIS_LITTLE_ENDIAN \
|
|
-Wno-error=format-truncation
|
|
|
|
|
|
#LIBS = -lm `sdl2-config --libs`
|
|
LIBS = -lasan -lm `sdl2-config --libs` -lstdc++
|
|
LDFLAGS = $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
|
|
|
|
all: $(BUILD_DIR)/$(TARGET).elf
|
|
|
|
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
|
|
vpath %.c $(sort $(dir $(C_SOURCES)))
|
|
|
|
CXX_OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(CXX_SOURCES:.cpp=.o)))
|
|
vpath %.cpp $(sort $(dir $(CXX_SOURCES)))
|
|
|
|
|
|
$(BUILD_DIR)/%.o: %.c Makefile.nes | $(BUILD_DIR)
|
|
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
|
|
|
$(BUILD_DIR)/%.o: %.cpp Makefile.nes | $(BUILD_DIR)
|
|
$(CXX) -c $(CXXFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.cpp=.lst)) $< -o $@
|
|
|
|
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) $(CXX_OBJECTS) Makefile.nes
|
|
# $(CC) $(OBJECTS) $(CXX_OBJECTS) $(LDFLAGS) -Wl,-verbose -o $@
|
|
$(CC) $(OBJECTS) $(CXX_OBJECTS) $(LDFLAGS) -o $@
|
|
$(SZ) $@
|
|
|
|
$(BUILD_DIR):
|
|
mkdir $@
|
|
|
|
clean:
|
|
-rm -fR $(BUILD_DIR)
|
|
|
|
-include $(wildcard $(BUILD_DIR)/*.d)
|