forked from dwhinham/mt32-pi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
136 lines (114 loc) · 3.59 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#
# Makefile
#
include Config.mk
.DEFAULT_GOAL=all
.PHONY: circle-stdlib mt32emu fluidsynth all clean veryclean
#
# Configure circle-stdlib
#
.ONESHELL:
$(CIRCLE_STDLIB_CONFIG) $(CIRCLE_CONFIG)&:
@echo "Configuring for Raspberry Pi $(RASPBERRYPI) ($(BITS) bit)"
$(CIRCLESTDLIBHOME)/configure --raspberrypi=$(RASPBERRYPI) --prefix=$(PREFIX)
# Apply patches
@patch -N -p1 --no-backup-if-mismatch -r - -d $(CIRCLEHOME) < patches/circle-44.5-revert-firmware.patch
@patch -N -p1 --no-backup-if-mismatch -r - -d $(CIRCLEHOME) < patches/circle-44.4-minimal-usb-drivers.patch
ifeq ($(strip $(GC_SECTIONS)),1)
# Enable function/data sections for circle-stdlib
echo "CFLAGS_FOR_TARGET += -ffunction-sections -fdata-sections" >> $(CIRCLE_STDLIB_CONFIG)
endif
# Enable multi-core
echo "DEFINE += -DARM_ALLOW_MULTI_CORE" >> $(CIRCLE_CONFIG)
# Disable delay loop calibration (boot speed improvement)
echo "DEFINE += -DNO_CALIBRATE_DELAY" >> $(CIRCLE_CONFIG)
# Improve I/O throughput
echo "DEFINE += -DNO_BUSY_WAIT" >> $(CIRCLE_CONFIG)
# Enable PWM audio output on GPIO 12/13 for the Pi Zero 2 W
echo "DEFINE += -DUSE_PWM_AUDIO_ON_ZERO" >> $(CIRCLE_CONFIG)
#
# Build circle-stdlib
#
circle-stdlib: $(CIRCLESTDLIBHOME)/.done
$(CIRCLESTDLIBHOME)/.done: $(CIRCLE_STDLIB_CONFIG)
@$(MAKE) -C $(CIRCLESTDLIBHOME)
touch $@
#
# Build mt32emu
#
mt32emu: $(MT32EMUBUILDDIR)/.done
$(MT32EMUBUILDDIR)/.done: $(CIRCLESTDLIBHOME)/.done
@export CFLAGS="$(CFLAGS_FOR_TARGET)"
@export CXXFLAGS="$(CFLAGS_FOR_TARGET)"
@cmake -B $(MT32EMUBUILDDIR) \
$(CMAKE_TOOLCHAIN_FLAGS) \
-DCMAKE_CXX_FLAGS_RELEASE="-Ofast" \
-DCMAKE_BUILD_TYPE=Release \
-Dlibmt32emu_C_INTERFACE=FALSE \
-Dlibmt32emu_SHARED=FALSE \
$(MT32EMUHOME) \
>/dev/null
@cmake --build $(MT32EMUBUILDDIR)
@touch $@
#
# Build FluidSynth
#
fluidsynth: $(FLUIDSYNTHBUILDDIR)/.done
$(FLUIDSYNTHBUILDDIR)/.done: $(CIRCLESTDLIBHOME)/.done
@patch -N -p1 --no-backup-if-mismatch -r - -d $(FLUIDSYNTHHOME) < patches/fluidsynth-2.2.7-circle.patch
@export CFLAGS="$(CFLAGS_FOR_TARGET)"
@cmake -B $(FLUIDSYNTHBUILDDIR) \
$(CMAKE_TOOLCHAIN_FLAGS) \
-DCMAKE_C_FLAGS_RELEASE="-Ofast -fopenmp-simd" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-Denable-aufile=OFF \
-Denable-dbus=OFF \
-Denable-dsound=OFF \
-Denable-floats=ON \
-Denable-ipv6=OFF \
-Denable-jack=OFF \
-Denable-ladspa=OFF \
-Denable-libinstpatch=OFF \
-Denable-libsndfile=OFF \
-Denable-midishare=OFF \
-Denable-network=OFF \
-Denable-oboe=OFF \
-Denable-opensles=OFF \
-Denable-oss=OFF \
-Denable-pkgconfig=OFF \
-Denable-pulseaudio=OFF \
-Denable-readline=OFF \
-Denable-sdl2=OFF \
-Denable-threads=OFF \
-Denable-waveout=OFF \
-Denable-winmidi=OFF \
$(FLUIDSYNTHHOME) \
>/dev/null
@cmake --build $(FLUIDSYNTHBUILDDIR) --target libfluidsynth
@touch $@
#
# Build kernel itself
#
all: circle-stdlib mt32emu fluidsynth
@$(MAKE) -f Kernel.mk $(KERNEL).img $(KERNEL).hex
#
# Clean kernel only
#
clean:
@$(MAKE) -f Kernel.mk clean
#
# Clean kernel and all dependencies
#
veryclean: clean
# Reverse patches
@patch -R -N -p1 --no-backup-if-mismatch -r - -d $(CIRCLEHOME) < patches/circle-44.4-minimal-usb-drivers.patch
@patch -R -N -p1 --no-backup-if-mismatch -r - -d $(CIRCLEHOME) < patches/circle-44.5-revert-firmware.patch
@patch -R -N -p1 --no-backup-if-mismatch -r - -d $(FLUIDSYNTHHOME) < patches/fluidsynth-2.2.7-circle.patch
# Clean circle-stdlib
@$(MAKE) -C $(CIRCLESTDLIBHOME) mrproper
@$(RM) $(CIRCLESTDLIBHOME)/.done
# Clean mt32emu
@$(RM) -r $(MT32EMUBUILDDIR)
# Clean FluidSynth
@$(RM) -r $(FLUIDSYNTHBUILDDIR)