-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile.funkey
82 lines (68 loc) · 2.76 KB
/
Makefile.funkey
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
PRGNAME = sms_sdl
CC = /opt/funkey-toolchain/bin/arm-linux-gcc
# Possible choices : rs97, k3s (PAP K3S), sdl, amini, fbdev
PORT = funkey
# 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 = -Wall -Wextra -Ofast -fsingle-precision-constant -fno-PIC -flto -fno-common
CFLAGS += -std=gnu99
CFLAGS += -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=/mnt/smsplusgx_profile
endif
ifeq ($(PROFILE), APPLY)
CFLAGS += -fprofile-use
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
CFLAGS += -march=armv7-a+neon-vfpv4 -mtune=cortex-a7 -mfpu=neon-vfpv4
CFLAGS += -fdata-sections -ffunction-sections -fsingle-precision-constant -freorder-functions -fno-math-errno -fgcse-las -fgcse-sm -fmerge-all-constants
CXXFLAGS = $(CFLAGS) -ftree-vectorize -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-enforce-eh-specs -fstrict-enums -std=gnu++11
LDFLAGS = -nodefaultlibs -lc -lgcc -lm -lSDL -lasound -lz -pthread -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,-O1,--sort-common,--as-needed,--gc-sections -flto -no-pie -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) -c -o $@ $<
clean:
rm -f $(PRGNAME) *.o