-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild-targets.mk
87 lines (64 loc) · 3.69 KB
/
build-targets.mk
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
# mkwavetable binary
$(BUILD_PATH)/mkwavetable: source/mkwavetable/mkwavetable.cpp
g++ -Isource/ source/mkwavetable/mkwavetable.cpp -o $(BUILD_PATH)/mkwavetable
# main project target
$(BUILD_PATH)/main.o: source/main.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/object.o: source/object.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/audio_buffer.o: source/audio_buffer/audio_buffer.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/midi_manager.o: source/midi/midi_manager.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/midi_message.o: source/midi/midi_message.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/midi_slicer.o: source/midi/midi_slicer.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/midi_ring_buffer.o: source/midi/midi_ring_buffer.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
source/osc/wavetables.h: $(BUILD_PATH)/mkwavetable
scripts/mklookups.rb
$(BUILD_PATH)/oscillator.o: source/osc/oscillator.cpp source/osc/wavetables.h
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/envelope.o: source/envelope/envelope.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/biquad.o: source/filters/biquad.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/lowpass.o: source/filters/lowpass.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
$(BUILD_PATH)/voice_manager.o: source/voice_manager/voice_manager.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
# Unfortunately I need to write out every object file now.
OBJECTS=$(BUILD_PATH)/main.o $(BUILD_PATH)/audio_buffer.o $(BUILD_PATH)/lowpass.o $(BUILD_PATH)/biquad.o $(BUILD_PATH)/envelope.o $(BUILD_PATH)/midi_ring_buffer.o $(BUILD_PATH)/voice_manager.o $(BUILD_PATH)/object.o $(BUILD_PATH)/oscillator.o $(BUILD_PATH)/midi_manager.o $(BUILD_PATH)/midi_message.o $(BUILD_PATH)/midi_slicer.o
$(BUILD_PATH)/libmaple.a: $(BUILDDIRS) $(TGT_BIN)
- rm -f $@
$(AR) crv $(BUILD_PATH)/libmaple.a $(TGT_BIN)
library: $(BUILD_PATH)/libmaple.a
.PHONY: library
$(BUILD_PATH)/$(BOARD).elf: $(BUILDDIRS) $(TGT_BIN) $(OBJECTS)
$(SILENT_LD) $(CXX) $(LDFLAGS) -o $@ $(TGT_BIN) $(OBJECTS) -Wl,-Map,$(BUILD_PATH)/$(BOARD).map
$(BUILD_PATH)/$(BOARD).bin: $(BUILD_PATH)/$(BOARD).elf
$(SILENT_OBJCOPY) $(OBJCOPY) -v -Obinary $(BUILD_PATH)/$(BOARD).elf $@ 1>/dev/null
$(SILENT_DISAS) $(DISAS) -d $(BUILD_PATH)/$(BOARD).elf > $(BUILD_PATH)/$(BOARD).disas
@echo " "
@echo "Object file sizes:"
@find $(BUILD_PATH) -iname *.o | xargs $(SIZE) -t > $(BUILD_PATH)/$(BOARD).sizes
@cat $(BUILD_PATH)/$(BOARD).sizes
@echo " "
@echo "Final Size:"
@$(SIZE) $<
@echo $(MEMORY_TARGET) > $(BUILD_PATH)/build-type
$(BUILDDIRS):
@mkdir -p $@
MSG_INFO:
@echo "================================================================================"
@echo ""
@echo " Build info:"
@echo " BOARD: " $(BOARD)
@echo " MCU: " $(MCU)
@echo " MEMORY_TARGET: " $(MEMORY_TARGET)
@echo ""
@echo " See 'make help' for all possible targets"
@echo ""
@echo "================================================================================"
@echo ""