-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
102 lines (83 loc) · 3.77 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
COMP_OPT=-ffunction-sections -Wl,-gc-sections -Izlib -Ixz/src/liblzma/api/ -Lxz/src/liblzma/.libs/ -Lzlib -Ilz4/lib/ -Ilzlib4 -Iflaczlib -Iflac/include
COMP_OPT_LINUX=
ifeq ($(ECM_DEBUG), true)
COMP_OPT+= -g
COMP_OPT_LINUX+= -fsanitize=address
else
COMP_OPT+= -Os -s
endif
all: ecmtool ecmtool.exe
ecmtool:
########## ZLIB MAKE ##########
# Copy the makefile
cp makefile_zlib/Makefile.linux zlib/Makefile.linux
# First cleanup to be sure
make -C zlib -f Makefile.linux clean
# Compile the zlib static library for linux
make -C zlib -f Makefile.linux -j$(nproc)
########## END ZLIB MAKE ##########
########## LZMA (XZ) MAKE ##########
cd xz && bash autogen.sh --no-po4a && ./configure --enable-static --disable-xz --disable-xzdec --disable-lzmainfo --disable-lzma-links --disable-scripts --disable-doc --disable-lzmadec --disable-shared
make -C xz -j$(nproc)
########## END LZMA (XZ) MAKE ##########
########## FLAC MAKE ##########
cd flac && bash autogen.sh && ./configure --enable-static --disable-xmms-plugin --disable-ogg --disable-oggtest --disable-examples --enable-shared=no --disable-cpplibs --disable-doxygen-docs
make -C flac clean
cd flac/src/libFLAC && make -j$(nproc)
########## END FLAC MAKE ##########
# Compile the Linux release
mkdir -p release/linux
g++ ${COMP_OPT} ${COMP_OPT_LINUX} -o release/linux/$@ ecmtool.cpp compressor.cpp sector_tools.cpp -lzlinux -llzma lz4/lib/lz4hc.c lz4/lib/lz4.c lzlib4/lzlib4.cpp flaczlib/flaczlib.cpp flac/src/libFLAC/.libs/libFLAC-static.a
########## ZLIB CLEAN ##########
# Clean the zlib directory at end
make -C zlib -f Makefile.linux clean
rm zlib/Makefile.linux
########## END ZLIB CLEAN ##########
########## LZMA CLEAN ##########
make -C xz clean
########## END LZMA CLEAN ##########
########## FLAC CLEAN ##########
make -C flac clean
########## END FLAC CLEAN ##########
ecmtool.exe:
########## ZLIB MAKE ##########
# Copy the makefile
cp makefile_zlib/Makefile.win zlib/Makefile.win
# First cleanup to be sure
make -C zlib -f Makefile.win clean
# Compile the zlib static library for Windows
make -C zlib -f Makefile.win -j$(nproc)
########## END ZLIB MAKE ##########
########## LZMA (XZ) MAKE ##########
cd xz && bash autogen.sh --no-po4a && CC=x86_64-w64-mingw32-gcc ./configure --host=x64-windows --target=x64-windows --enable-static --disable-xz --disable-xzdec --disable-lzmainfo --disable-lzma-links --disable-doc --disable-scripts --disable-lzmadec --disable-shared --enable-threads=vista
make -C xz -j$(nproc)
########## LZMA (XZ) MAKE ##########
########## FLAC MAKE ##########
cd flac && bash autogen.sh && ./configure --host=x86_64-w64-mingw32 --enable-static --disable-xmms-plugin --disable-ogg --disable-oggtest --disable-examples --enable-shared=no --disable-cpplibs --disable-doxygen-docs
make -C flac clean
cd flac/src/libFLAC && make -j$(nproc)
########## END FLAC MAKE ##########
# Compile the Win64 release
mkdir -p release/win64
x86_64-w64-mingw32-g++ ${COMP_OPT} -static -o release/win64/$@ ecmtool.cpp compressor.cpp sector_tools.cpp -lzwindows -llzma lz4/lib/lz4hc.c lz4/lib/lz4.c lzlib4/lzlib4.cpp flaczlib/flaczlib.cpp flac/src/libFLAC/.libs/libFLAC-static.a
########## ZLIB CLEAN ##########
# Clean the zlib directory at end
make -C zlib -f Makefile.win clean
rm zlib/Makefile.win
########## END ZLIB CLEAN ##########
########## LZMA CLEAN ##########
make -C xz clean
########## END LZMA CLEAN ##########
########## FLAC CLEAN ##########
make -C flac clean
########## END FLAC CLEAN ##########
clean:
rm -f ecmtool.o
rm -Rf release
# Clean the zlib directory
cp makefile_zlib/Makefile.linux zlib/Makefile.linux
make -C zlib -f Makefile.linux clean
rm -f zlib/Makefile.linux
cp makefile_zlib/Makefile.win zlib/Makefile.win
make -C zlib -f Makefile.win clean
rm -f zlib/Makefile.win