xevi/simulation/Makefile
Mikael Degerfält 699546df8c Handle sub menus in a generic way and moved adjust menu logic to separate file
This is a big one where I can finally reap what I sown. Sub menu entries now provide two functions, one to get the text for the current value and one to apply changes aka save to EEPROM. With this I can replace so much code in the menu() function that handles input, but was _almost_ identical. The process of converting the old menus are not completed, and I can probably remove about 200 lines more code.

The question is still what to do with less general menus like the rotator and fast patch menu.

One problem with the current implementation is that it is RAM heavy. It seems the const MenuEntry structs are placed in ram, because there is a pointer to RAM that I assume is allocated during execution and therefore the address cannot be stored in ROM.

My plan has been to put all the configuration fields (that are stored in EEPROM) into a struct or an array. When that is implemented, I can instead store the offset into the array in the const struct, which should be available at compile time and therefore can reside completely in ROM.
2019-06-23 17:14:17 +02:00

82 lines
1.6 KiB
Makefile

CC=clang
CXX=clang++
CFLAGS=-Wall -Wextra -Wpedantic -Wno-gnu -mmacosx-version-min=10.9 -F/Library/Frameworks
CFLAGS += -DARDUINO=10808 -D__MK20DX256__
RELEASE ?= 0
ifeq ($(RELEASE), 1)
CFLAGS +=-O3
else
CFLAGS += -O0 -g
endif
CXXFLAGS= $(CFLAGS) -std=c++14
LIBS=-framework SDL2 -lc++ -lc -framework OpenGL
LDFLAGS=-macosx_version_min 10.9 -rpath @executable_path/../Frameworks
SYSINC = ~/Documents/Arduino/libraries/Filters ./include
INCS = ../NuEVI ./include ./imgui ./gl3w
INCDIRS = $(addprefix -isystem ,$(SYSINC))
INCDIRS += $(addprefix -I,$(INCS))
TARGET=nuevisim
CXXFILES= ../NuEVI/menu.cpp \
../NuEVI/adjustmenu.cpp \
src/nuevisim.cpp \
src/simeeprom.cpp \
src/Print.cpp \
src/simserial.cpp \
src/simwire.cpp \
src/simusbmidi.cpp \
src/filters.cpp \
../NuEVI/midi.cpp \
src/Adafruit_GFX_sim.cpp \
src/Adafruit_SSD1306_sim.cpp \
src/Adafruit_MPR121_sim.cpp \
imgui/imgui.cpp \
imgui/imgui_draw.cpp \
imgui/imgui_widgets.cpp \
imgui/examples/imgui_impl_sdl.cpp \
imgui/examples/imgui_impl_opengl3.cpp
CFILES= gl3w/gl3w.c
OBJS=$(CXXFILES:.cpp=.o) $(CFILES:.c=.o)
all: $(TARGET)
nuevisim: $(OBJS)
$(LD) $(LDFLAGS) -o $(TARGET) $(LIBS) $^
%.o: %.c
$(CC) $(CFLAGS) $(INCDIRS) -c -o $@ $<
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCDIRS) -c -o $@ $<
clean:
rm -f $(TARGET) $(OBJS) *.o
.PHONY: all
# Dependecies
DEPS=make.deps
.PHONY: deps mrproper
mrproper: clean
rm $(DEPS)
deps: $(DEPS)
H_DEPS=$(wildcard src/*.h) $(wildcard ../NuEVI/*.h)
make.deps: $(CXXFILES) $(H_DEPS)
$(CXX) $(CXXFLAGS) -Wno-deprecated $(INCDIRS) -MM $(DEPS_HS) $^ > $@
-include .deps/*