forked from IAGOnGithub/gba-mus-ripper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile-windows-x86-on-ubuntu
63 lines (48 loc) · 3.14 KB
/
Makefile-windows-x86-on-ubuntu
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
# Windows
JUST_CPPC=x86_64-w64-mingw32-g++
JUST_CC=x86_64-w64-mingw32-gcc
CPPC=$(JUST_CPPC) -std=gnu++11
CPPC2=x86_64-w64-mingw32-g++ -std=c++17
CC=$(JUST_CC) -std=c99
CMAKE=/usr/bin/cmake
MAKE=/usr/bin/make
# GNU/Linux
#CPPC=/usr/bin/g++ -std=gnu++11 # sf2cute requires C++14, but leaving this as gnu++11 doesn't seem to cause any errors for now
#CC=/usr/bin/gcc -std=c99
#CMAKE=/usr/bin/cmake
#MAKE=/usr/bin/make
# Parameters used for compilation
FLAGS=-Wall -fdata-sections -ffunction-sections -fmax-errors=5 -Os
# Additional parameters used for linking whole programs
WHOLE=-s -fwhole-program -static
SF2CUTE_SRC_FILES = src/sf2cute/src/sf2cute/$(wildcard *.cpp) # TODO include *.hpp files too?
YAMLCPP_SRC_FILES = src/yaml-cpp/src/$(wildcard *.cpp)
all: $(shell mkdir build-w) $(shell mkdir bin-w) bin-w/mp2ktool.exe bin-w/song_ripper.exe bin-w/sound_font_ripper.exe bin-w/gba_mus_ripper.exe
bin-w/mp2ktool.exe: src/mp2ktool/mp2ktool.cpp src/mp2ktool/mp2kcomm.cpp src/mp2ktool/agbm4a.cpp src/mp2ktool/mp2kcomm.h src/mp2ktool/agbm4a.h
$(CPPC2) -static src/mp2ktool/mp2ktool.cpp src/mp2ktool/mp2kcomm.cpp src/mp2ktool/agbm4a.cpp -o bin-w/mp2ktool # why does this break with "undefined reference to memsearch" when I use WHOLE?
bin-w/song_ripper.exe: src/song_ripper.cpp src/midi.hpp build-w/midi.o
$(CPPC) $(FLAGS) $(WHOLE) src/song_ripper.cpp build-w/midi.o -o bin-w/song_ripper
bin-w/sound_font_ripper.exe: build-w/sound_font_ripper.o build-w/gba_samples.o build-w/gba_instr.o src/sf2cute/build-w/libsf2cute.a
$(CPPC) $(FLAGS) $(WHOLE) build-w/gba_samples.o build-w/gba_instr.o build-w/sound_font_ripper.o src/sf2cute/build-w/libsf2cute.a -o bin-w/sound_font_ripper
bin-w/gba_mus_ripper.exe: src/gba_mus_ripper.cpp src/hex_string.hpp src/yaml-cpp/build-w/libyaml-cpp.a
$(CPPC) $(FLAGS) $(WHOLE) -I./src/yaml-cpp/include/ src/gba_mus_ripper.cpp -DYAML_CPP_STATIC_DEFINE=ON src/yaml-cpp/build-w/libyaml-cpp.a -o bin-w/gba_mus_ripper
build-w/midi.o: src/midi.cpp src/midi.hpp
$(CPPC) $(FLAGS) -c src/midi.cpp -o build-w/midi.o
build-w/gba_samples.o : src/gba_samples.cpp src/gba_samples.hpp src/hex_string.hpp
$(CPPC) $(FLAGS) -c src/gba_samples.cpp -o build-w/gba_samples.o
build-w/gba_instr.o : src/gba_instr.cpp src/gba_instr.hpp src/hex_string.hpp src/gba_samples.hpp
$(CPPC) $(FLAGS) -c src/gba_instr.cpp -o build-w/gba_instr.o
build-w/sound_font_ripper.o: src/sound_font_ripper.cpp src/gba_instr.hpp src/hex_string.hpp
$(CPPC) $(FLAGS) -c src/sound_font_ripper.cpp -o build-w/sound_font_ripper.o
src/sf2cute/build-w/libsf2cute.a: $(SF2CUTE_SRC_FILES)
$(CMAKE) -DCMAKE_C_COMPILER=$(JUST_CC) -DCMAKE_CXX_COMPILER=$(JUST_CPPC) -S src/sf2cute -B src/sf2cute/build-w
$(MAKE) --directory=src/sf2cute/build-w
src/yaml-cpp/build-w/libyaml-cpp.a: $(YAMLCPP_SRC_FILES)
$(CMAKE) -DCMAKE_TOOLCHAIN_FILE=../mingw-x86.cmake -DBUILD_SHARED_LIBS=OFF -DYAML_CPP_BUILD_TOOLS=OFF -DYAML_CPP_INSTALL=OFF -DYAML_CPP_BUILD_CONTRIB=OFF -S src/yaml-cpp -B src/yaml-cpp/build-w
$(MAKE) --directory=src/yaml-cpp/build-w
clean:
rm -f *.o *.s *.i *.ii
rm -rf build-w/
rm -rf bin-w/
rm -rf src/sf2cute/build-w/
rm -rf src/yaml-cpp/build-w/