-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
48 lines (36 loc) · 2.85 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
TARGET_NAMES = MPGCombo1 MPGCombo2 MPGCombo3 MPGCombo4 MPGCombo5 MPGCombo6 MPGCombo7 MPGCombo8 MPGCombo9 MPGCombo10 MPGCombo11
MPGCombo1.FLAGS = -DENABLE_REFLEX_PSX -DNEGCON_FORCE_MODE=1 -DNEGCON_SUPPORT -DENABLE_PSX_GENERAL_OLED -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=85 -DENABLE_REFLEX_GAMECUBE
MPGCombo2.FLAGS = -DENABLE_REFLEX_SNES -DSNES_ENABLE_VBOY -DENABLE_REFLEX_SMS -DENABLE_REFLEX_JPC -DENABLE_REFLEX_NEOGEO -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=85 -DENABLE_REFLEX_GAMECUBE
MPGCombo3.FLAGS = -DENABLE_REFLEX_SNES -DSNES_ENABLE_VBOY -DENABLE_REFLEX_PSX -DNEGCON_FORCE_MODE=1 -DNEGCON_SUPPORT -DENABLE_PSX_GENERAL_OLED -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=85
MPGCombo4.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_NEOGEO -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=85
MPGCombo5.FLAGS = -DENABLE_REFLEX_SNES -DSNES_ENABLE_VBOY -DENABLE_REFLEX_PCE -DENABLE_REFLEX_NEOGEO -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=85 -DENABLE_REFLEX_GAMECUBE
MPGCombo6.FLAGS = -DENABLE_REFLEX_SNES -DENABLE_REFLEX_PCE -DENABLE_REFLEX_NEOGEO -DENABLE_REFLEX_JAGUAR -DENABLE_REFLEX_SMS
MPGCombo7.FLAGS = -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED -DENABLE_REFLEX_NEOGEO -DENABLE_REFLEX_SMS
MPGCombo8.FLAGS = -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_SNES -DSNES_ENABLE_VBOY -DENABLE_REFLEX_PCE -DENABLE_REFLEX_NEOGEO
MPGCombo9.FLAGS = -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_SNES -DSNES_ENABLE_VBOY -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=85
MPGCombo10.FLAGS = -DENABLE_REFLEX_SATURN -DENABLE_REFLEX_NEOGEO -DENABLE_REFLEX_N64 -DENABLE_N64_ANALOG_MAX=85 -DENABLE_REFLEX_GAMECUBE
MPGCombo11.FLAGS = -DENABLE_REFLEX_PSX -DENABLE_PSX_GENERAL_OLED -DENABLE_REFLEX_3DO -DENABLE_REFLEX_WII
PRJ_DIR = ReflexMPG
BUILD_DIR = build
TARGET_DIR = firmware
SRC = $(wildcard $(PRJ_DIR)/*.h $(PRJ_DIR)/*.c $(PRJ_DIR)/*.ino)
ARDUINO_CLI = arduino-cli -b Arduino-LUFA:avr:leonardo
TARGETS = $(addsuffix .hex, $(addprefix $(TARGET_DIR)/, $(TARGET_NAMES)))
GCC_PATH := $(shell $(ARDUINO_CLI) compile $(PRJ_DIR) --show-properties | grep runtime.tools.avr-gcc.path= | sed "s/.*=//")
all: $(TARGETS) $(TARGET_DIR)/sizes.txt
$(TARGET_DIR)/%.hex: $(SRC) | $(TARGET_DIR) install-core
@[ "$($*.FLAGS)" ] || ( echo ">> $*.FLAGS is not set"; exit 1 )
$(ARDUINO_CLI) compile $(PRJ_DIR) --build-property "build.extra_flags={build.usb_flags} -DREFLEX_NO_DEFAULTS $($*.FLAGS)" -e --output-dir $(BUILD_DIR)/$*
cp $(BUILD_DIR)/$*/ReflexMPG.ino.elf $(TARGET_DIR)/$*.elf
cp $(BUILD_DIR)/$*/ReflexMPG.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 install-core $(TARGET_NAMES)