forked from misteraddons/Reflex-Adapt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
120 lines (104 loc) · 8.48 KB
/
Makefile
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
TARGET_NAMES = Nintendo Non-Nintendo Non-Nintendo-Sony Multitap PSX-JogCon Combo1 Combo2 Combo3 Combo4 Combo5 Combo6 Combo7 Combo8 Combo9 Combo10 Combo11 Combo12 Combo13 Combo14 Combo15 Combo16 Combo17 Combo18 Combo19 Combo20
# Saturn = 20%
# Saturn Multitap =
# PSX =
# NeGcon = 2%
# JogCon = 5%
# GunCon = 14%
# Wii = 17%
# Jaguar = ~10%
# PCE = ~10%
# NeoGeo =
# N64 =
# SNES =
# SNES Multitap =
# 3DO =
# SMS
# J-PC
#define ENABLE_REFLEX_SMS
#define ENABLE_REFLEX_JPC
#SNES.FLAGS = -DENABLE_REFLEX_SNES -DSNES_ENABLE_VBOY -DSNES_ENABLE_MULTITAP
#Saturn.FLAGS = -DENABLE_REFLEX_SATURN -DSATLIB_ENABLE_MEGATAP -DSATLIB_ENABLE_SATTAP
#PSX-MiSTer.FLAGS = -DENABLE_REFLEX_PSX -DGUNCON_FORCE_MODE=3 -DNEGCON_FORCE_MODE=1 -DGUNCON_SUPPORT -DJOGCON_SUPPORT -DNEGCON_SUPPORT -DENABLE_PSX_GENERAL_OLED -DENABLE_PSX_GUNCON_OLED -DENABLE_PSX_JOGCON_OLED
PSX-PC.FLAGS = -DENABLE_REFLEX_PSX -DGUNCON_FORCE_MODE=0 -DNEGCON_FORCE_MODE=0 -DENABLE_PSX_GUNCON_MOUSE -DENABLE_PSX_JOGCON_MOUSE -DGUNCON_SUPPORT -DJOGCON_SUPPORT -DNEGCON_SUPPORT -DENABLE_PSX_GENERAL_OLED -DENABLE_PSX_GUNCON_OLED -DENABLE_PSX_JOGCON_OLED
PSX-JogCon.FLAGS = -DENABLE_REFLEX_PSX -DENABLE_REFLEX_PSX_JOG -DJOGCON_SUPPORT -DENABLE_PSX_JOGCON_OLED
#PCEngine.FLAGS = -DENABLE_REFLEX_PCE -DPCE_ENABLE_MULTITAP
#Jaguar.FLAGS = -DENABLE_REFLEX_JAGUAR -DJAG_DEBOUNCE=8
#3DO.FLAGS = -DENABLE_REFLEX_3DO
#NeoGeo.FLAGS = -DENABLE_REFLEX_NEOGEO
#N64.FLAGS = -DENABLE_REFLEX_N64
#GameCube.FLAGS = -DENABLE_REFLEX_GAMECUBE
#Wii.FLAGS = -DENABLE_REFLEX_WII
Nintendo.FLAGS = -DENABLE_REFLEX_SNES -DSNES_ENABLE_MULTITAP -DSNES_ENABLE_VBOY -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80 -DENABLE_REFLEX_GAMECUBE -DENABLE_REFLEX_WII
#PCE, Neo-Geo, Genesis, Saturn, PSX+GunCon+neGcon
Non-Nintendo.FLAGS = -DENABLE_REFLEX_PCE -DENABLE_REFLEX_NEOGEO -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_PSX -DGUNCON_FORCE_MODE=3 -DNEGCON_FORCE_MODE=1 -DGUNCON_SUPPORT -DNEGCON_SUPPORT -DENABLE_PSX_GENERAL_OLED -DENABLE_PSX_GUNCON_OLED -DENABLE_REFLEX_JAGUAR
#JP-PC, SMS, Atari2600, C64, Genesis, Saturn, 3DO, PCE, Neo Geo, Jaguar
Non-Nintendo-Sony.FLAGS = -DENABLE_REFLEX_JPC -DENABLE_REFLEX_SMS -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_3DO -DENABLE_REFLEX_PCE -DENABLE_REFLEX_NEOGEO -DENABLE_REFLEX_JAGUAR
#SNES+Tap, Saturn+Tap, PCE+Tap
Multitap.FLAGS = -DENABLE_REFLEX_SNES -DSNES_ENABLE_MULTITAP -DENABLE_REFLEX_SATURN -DSATLIB_ENABLE_MEGATAP -DSATLIB_ENABLE_SATTAP -DENABLE_REFLEX_PCE -DPCE_ENABLE_MULTITAP
#SNES, Saturn, PSX+Guncon+Jogcon
Combo1.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_PSX -DGUNCON_FORCE_MODE=3 -DGUNCON_SUPPORT -DJOGCON_SUPPORT -DENABLE_PSX_GENERAL_OLED -DENABLE_PSX_GUNCON_OLED -DENABLE_PSX_JOGCON_OLED
#SNES, Saturn+Tap, PSX+Guncon+neGcon
Combo2.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_SATURN -DSATLIB_ENABLE_SATTAP -DENABLE_REFLEX_PSX -DNEGCON_FORCE_MODE=1 -DNEGCON_SUPPORT -DGUNCON_FORCE_MODE=3 -DGUNCON_SUPPORT -DENABLE_PSX_GENERAL_OLED -DENABLE_PSX_GUNCON_OLED
#SNES, Saturn+Tap, PSX+neGcon+Jogcon
Combo3.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_SATURN -DSATLIB_ENABLE_SATTAP -DENABLE_REFLEX_PSX -DNEGCON_FORCE_MODE=1 -DNEGCON_SUPPORT -DJOGCON_SUPPORT -DENABLE_PSX_GENERAL_OLED -DENABLE_PSX_JOGCON_OLED
#SNES, PCE, N64, PSX+neGcon+Guncon+Jogcon
Combo4.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_PCE -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80 -DENABLE_REFLEX_PSX -DGUNCON_FORCE_MODE=3 -DNEGCON_FORCE_MODE=1 -DGUNCON_SUPPORT -DJOGCON_SUPPORT -DNEGCON_SUPPORT -DENABLE_PSX_GENERAL_OLED -DENABLE_PSX_GUNCON_OLED -DENABLE_PSX_JOGCON_OLED
#SNES, NeoGeo, Jaguar, N64, PSX+neGcon+Guncon+Jogcon
Combo5.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_NEOGEO -DENABLE_REFLEX_JAGUAR -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80 -DENABLE_REFLEX_PSX -DGUNCON_FORCE_MODE=3 -DNEGCON_FORCE_MODE=1 -DGUNCON_SUPPORT -DJOGCON_SUPPORT -DNEGCON_SUPPORT -DENABLE_PSX_GENERAL_OLED -DENABLE_PSX_GUNCON_OLED -DENABLE_PSX_JOGCON_OLED
#SNES, NeoGeo, Wii, PSX+neGcon+Guncon+Jogcon
Combo6.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_NEOGEO -DENABLE_REFLEX_WII -DENABLE_REFLEX_PSX -DGUNCON_FORCE_MODE=3 -DNEGCON_FORCE_MODE=1 -DGUNCON_SUPPORT -DJOGCON_SUPPORT -DNEGCON_SUPPORT -DENABLE_PSX_GENERAL_OLED -DENABLE_PSX_GUNCON_OLED -DENABLE_PSX_JOGCON_OLED
#Saturn, NeoGeo, Wii, PSX+neGcon+Guncon+Jogcon
Combo7.FLAGS = -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_NEOGEO -DENABLE_REFLEX_PSX -DGUNCON_FORCE_MODE=3 -DNEGCON_FORCE_MODE=1 -DGUNCON_SUPPORT -DJOGCON_SUPPORT -DNEGCON_SUPPORT -DENABLE_PSX_GENERAL_OLED -DENABLE_PSX_GUNCON_OLED -DENABLE_PSX_JOGCON_OLED
#PCE, 3DO, NeoGeo, Jaguar, N64, GameCube, Wii
Combo8.FLAGS = -DENABLE_REFLEX_PCE -DENABLE_REFLEX_3DO -DENABLE_REFLEX_NEOGEO -DENABLE_REFLEX_JAGUAR -DENABLE_REFLEX_N64 -DENABLE_REFLEX_GAMECUBE -DENABLE_REFLEX_WII
#NES, SNES, N64 (Scaled), GameCube, Wii, PSX+neGcon
Combo9.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80 -DENABLE_REFLEX_GAMECUBE -DENABLE_REFLEX_WII -DENABLE_REFLEX_PSX -DNEGCON_FORCE_MODE=1 -DNEGCON_SUPPORT -DENABLE_PSX_GENERAL_OLED
#NES, SNES, N64 (Scaled), Wii, PSX+JogCon
Combo10.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80 -DENABLE_REFLEX_WII -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED -DJOGCON_SUPPORT -DENABLE_PSX_JOGCON_OLED
#NES, SNES, N64 (Scaled), Wii, PSX+GunCon+neGcon
Combo11.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80 -DENABLE_REFLEX_WII -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED -DGUNCON_SUPPORT -DGUNCON_FORCE_MODE=3 -DENABLE_PSX_GUNCON_OLED -DNEGCON_SUPPORT -DNEGCON_FORCE_MODE=1
#NES, SNES, N64 (Scaled), Saturn, PSX
Combo12.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80 -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED
#Genesis/Saturn, PSX, N64, Wii
Combo13.FLAGS = -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80 -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED -DENABLE_REFLEX_WII
#SNES, Genesis/Saturn, PSX, N64, GameCube
#Combo14.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80 -DENABLE_REFLEX_GAMECUBE
#SNES, Genesis/Saturn, PSX, N64
Combo14.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80
#SNES, Genesis/Saturn, PSX, GameCube
Combo15.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED -DENABLE_REFLEX_GAMECUBE
#SNES, N64 (Scaled), Wii, PSX+JogCon+neGcon
Combo16.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80 -DENABLE_REFLEX_WII -DENABLE_REFLEX_PSX -DJOGCON_SUPPORT -DENABLE_PSX_JOGCON_OLED
#SNES, N64 (Scaled), Wii, PSX+JogCon+neGcon
Combo17.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_PCE -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED
#NES, SNES, N64 (Scaled), Wii, PSX+neGcon
Combo18.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80 -DENABLE_REFLEX_WII -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED -DNEGCON_SUPPORT -DNEGCON_FORCE_MODE=1
#NES, SNES, SMS, Atari2600 + C64, Amiga, JP-PC, Genesis, Saturn, PSX+neGcon
Combo19.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_SMS -DENABLE_REFLEX_JPC -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED -DNEGCON_SUPPORT -DNEGCON_FORCE_MODE=1
#NES, SNES, Genesis, Saturn, N64, NeoGeo
Combo20.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=80 -DENABLE_REFLEX_NEOGEO
PRJ_DIR = Reflex
BUILD_DIR = build
TARGET_DIR = firmware
SRC = $(wildcard $(PRJ_DIR)/*.h $(PRJ_DIR)/*.c $(PRJ_DIR)/*.ino)
CLI_OPT = -b misteraddons:avr:reflex --config-file arduino/cli-config.yaml $(PRJ_DIR)
TARGETS = $(addsuffix .hex, $(addprefix $(TARGET_DIR)/, $(TARGET_NAMES)))
GCC_PATH := $(shell arduino-cli compile $(CLI_OPT) --show-properties | grep runtime.tools.avr-gcc.path= | sed "s/.*=//")
all: $(TARGETS) $(TARGET_DIR)/sizes.txt
$(TARGET_DIR)/%.hex: $(SRC) | $(TARGET_DIR)
@[ "$($*.FLAGS)" ] || ( echo ">> $*.FLAGS is not set"; exit 1 )
arduino-cli compile $(CLI_OPT) --build-property "build.extra_flags={build.usb_flags} -DREFLEX_NO_DEFAULTS $($*.FLAGS)" -e --output-dir $(BUILD_DIR)/$*
cp $(BUILD_DIR)/$*/Reflex.ino.elf $(TARGET_DIR)/$*.elf
cp $(BUILD_DIR)/$*/Reflex.ino.hex $(TARGET_DIR)/$*.hex
$(TARGET_DIR)/sizes.txt: $(TARGETS)
@cd $(TARGET_DIR) && $(GCC_PATH)/bin/avr-size $(notdir $(subst .hex,.elf,$^)) 2>&1 > sizes.txt
@echo Size Summary
@cat $@
$(TARGET_DIR):
mkdir -p $@
$(TARGET_NAMES): %: $(TARGET_DIR)/%.hex
clean:
rm -rf $(TARGET_DIR)
rm -rf $(BUILD_DIR)
.PHONY: all clean $(TARGET_NAMES)