-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
257 lines (204 loc) · 7.28 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
PREFIX=/usr/local
LIBDIR=$(PREFIX)/lib
BINDIR=$(PREFIX)/bin
SHAREDIR=$(PREFIX)/share/ovclient
DESTDIR=
all: build lib binaries
cli: build lib clibinaries
gui: build lib guibinaries
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CMD_INSTALL=install
LIB_EXT=so
CMD_LD=ldconfig -n $(DESTDIR)$(LIBDIR)
endif
ifeq ($(UNAME_S),Darwin)
CMD_INSTALL=ginstall
LIB_EXT=dylib
CMD_LD=
endif
BIN_OLD_CLI = ov-client
BIN_CLI = ovbox_cli ov-client_hostname ov-client_listsounddevs \
ovrealpath ovbox_version
BIN_GUI = ovbox
BINARIES = $(BIN_OLD_CLI) $(BIN_CLI) $(BIN_GUI)
EXTERNALS = jack liblo sndfile libcurl gsl samplerate fftw3f xerces-c
BUILD_BINARIES = $(patsubst %,build/%,$(BINARIES))
BUILD_CLI = $(patsubst %,build/%,$(BIN_CLI))
BUILD_GUI = $(patsubst %,build/%,$(BIN_GUI))
CXXFLAGS = -Wall -Wno-deprecated-declarations -std=c++17 -pthread \
-ggdb -fno-finite-math-only -Wno-psabi
CFLAGS = -Wall -Wno-deprecated-declarations
ifneq ($(HOMEBREW_OVBOX_TAG),)
CXXFLAGS+=-DHOMEBREW_OVBOX_TAG=\"$(HOMEBREW_OVBOX_TAG)\"
endif
ifeq "$(ARCH)" "x86_64"
CXXFLAGS += -msse -msse2 -mfpmath=sse -ffast-math
endif
CPPFLAGS = -std=c++11
PREFIX = /usr/local
BUILD_DIR = build
SOURCE_DIR = src
# libcpprest dependencies:
#LDLIBS += -lcrypto -lboost_filesystem -lboost_system -lcpprest
#LDLIBS += -lcrypto -lcpprest
#libov submodule:
CXXFLAGS += -Ilibov/src
LDLIBS += -lov -lovclienttascar
LDFLAGS += -Llibov/build -Llibov/tascar/libtascar/build
LDLIBS += `pkg-config --libs $(EXTERNALS)`
CXXFLAGS += `pkg-config --cflags $(EXTERNALS)`
LDLIBS += -ldl
HEADER := $(wildcard src/*.h) $(wildcard libov/src/*.h) tscver
CXXFLAGS += -Ilibov/tascar/libtascar/build
OSFLAG :=
UNAME_S :=
ifeq ($(OS),Windows_NT)
OSFLAG += -D WIN32
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
OSFLAG += -D AMD64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
OSFLAG += -D IA32
endif
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OSFLAG += -D LINUX
CXXFLAGS += -fext-numeric-literals
LDLIBS += -lasound
ZITATARGET = zita
endif
ifeq ($(UNAME_S),Darwin)
OSFLAG += -D OSX
LDFLAGS += -framework IOKit -framework CoreFoundation -headerpad_max_install_names
LDLIBS += -lfftw3f -lsamplerate -lc++ -lcpprest -lcrypto -lssl -lboost_filesystem -lsoundio
SOUNDIO_ROOT:=$(shell brew --prefix libsoundio)
OPENSSL_ROOT:=$(shell brew --prefix openssl)
CPPREST_ROOT:=$(shell brew --prefix cpprestsdk)
BOOST_ROOT=$(shell brew --prefix boost)
NLOHMANN_JSON_ROOT=$(shell brew --prefix nlohmann-json)
CXXFLAGS += -I$(SOUNDIO_ROOT)/include -I$(OPENSSL_ROOT)/include/openssl -I$(OPENSSL_ROOT)/include -I$(BOOST_ROOT)/include -I$(NLOHMANN_JSON_ROOT)/include
LDFLAGS += -L$(SOUNDIO_ROOT)/lib -L$(OPENSSL_ROOT)/lib -L$(CPPREST_ROOT)/lib -L$(BOOST_ROOT)/lib
# EXTERNALS += nlohmann-json
ZITATARGET = zita
endif
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
OSFLAG += -D AMD64
endif
ifneq ($(filter %86,$(UNAME_P)),)
OSFLAG += -D IA32
endif
ifneq ($(filter arm%,$(UNAME_P)),)
OSFLAG += -D ARM
endif
endif
CXXFLAGS += $(OSFLAG)
build/ov-client build/ovbox build/ovbox_cli: $(ZITATARGET)
lib: build
$(MAKE) -C libov all
libtest:
$(MAKE) -C libov unit-tests
libov/build/libov.a: lib
libov/Makefile:
git submodule update --init --recursive
build: build/.directory
%/.directory:
mkdir -p $* && touch $@
binaries: $(BUILD_BINARIES)
guibinaries: $(BUILD_GUI) $(BUILD_CLI)
clibinaries: $(BUILD_CLI)
$(BUILD_BINARIES): libov/build/libov.a
build/%: src/%.cc
$(CXX) $(CXXFLAGS) $< $(LDFLAGS) $(LDLIBS) -o $@
build/ovrealpath: src/ovrealpath.c
$(CC) $(CFLAGS) $< -o $@
build/%.o: src/%.cc $(HEADER)
$(CXX) $(CXXFLAGS) -c $< -o $@
## ZITA stuff:
zita-resampler-build:
$(MAKE) -C zita/zita-resampler-1.6.2/source
zita-njbridge-build:
$(MAKE) -C zita/zita-njbridge-0.4.4/source
##TODO: @alessandro: Let zita-njbridge build binaries into build dir
clangformat:
clang-format-9 -i $(wildcard src/*.cc) $(wildcard src/*.h)
clean:
rm -Rf build src/*~ ovclient*.deb
$(MAKE) -C libov clean
-cd zita-njbridge && git clean -ffdx
-cd zita-njbridge/zita-resampler && git clean -ffdx
.PHONY: packaging
ifeq ($(UNAME_S),Linux)
packaging:
$(MAKE) -C packaging/deb pack
clipackaging:
$(MAKE) -C packaging/deb clipack
endif
ifeq ($(UNAME_S),Darwin)
packaging:
$(MAKE) -C packaging/Darwin pack
endif
.PHONY : doc
doc:
(cd doc && doxygen doxygen.cfg)
ver:
(cd libov && ./get_version.sh)
ifeq ($(OS),Windows_NT)
ICON_PATH_REPLACEMENT = -e 's|usr/share/icons/hicolor/48x48/apps/|./|'
LDFLAGS += -mwindows
else
ifeq ($(UNAME_S),Darwin)
ICON_PATH_REPLACEMENT = -e 's|usr/share/icons/hicolor/.*/apps/||'
else
ICON_PATH_REPLACEMENT = -e 's/>usr/>\/usr/1'
endif
endif
build/%_glade.h: src/%.glade build/.directory
cat $< | sed -e 's/tascarversion/$(TASCARVERSION)/g' -e '/name="authors"/ r ../contributors' $(ICON_PATH_REPLACEMENT) >$*_glade
echo "#include <string>" > $@
xxd -i $*_glade >> $@
echo "std::string ui_"$*"((const char*)"$*"_glade,(size_t)"$*"_glade_len);" >> $@
rm -f $*_glade
build/%.res.c: src/%.res
(cd src && glib-compile-resources --generate-source --target=../$@ ../$<)
build/ovbox: EXTERNALS += gtkmm-3.0
build/ovbox: CXXFLAGS += -I./build
build/ovbox: build/ovbox_glade.h
build/ovbox: build/ovbox.res.c
ifeq ($(UNAME_S),Darwin)
zita: build/.directory
$(MAKE) -C zita-njbridge/zita-resampler/source libzita-resampler.a && \
$(MAKE) -C zita-njbridge/source CXXFLAGS+="$(shell pkg-config --cflags jack) -I../zita-resampler/source" LDFLAGS+="$(shell pkg-config --libs jack) -L../zita-resampler/source" -f Makefile-osx && \
cp zita-njbridge/source/zita-n2j build/ovzita-n2j && \
cp zita-njbridge/source/zita-j2n build/ovzita-j2n
else
zita: build/.directory
$(MAKE) -C zita-njbridge/zita-resampler/source libzita-resampler.a && \
$(MAKE) -C zita-njbridge/source CXXFLAGS+="$(shell pkg-config --cflags jack) -I../zita-resampler/source" LDFLAGS+="$(shell pkg-config --libs jack) -L../zita-resampler/source" -f Makefile-linux && \
cp zita-njbridge/source/zita-n2j build/ovzita-n2j && \
cp zita-njbridge/source/zita-j2n build/ovzita-j2n
endif
# (cd build && cmake ../zita-njbridge && make)
gitupdate:
git fetch --recurse-submodules ; git submodule update --init --recursive
install: all
$(CMD_INSTALL) -D libov/tascar/libtascar/build/lib*.$(LIB_EXT) -t $(DESTDIR)$(LIBDIR)
$(CMD_INSTALL) -D libov/tascar/plugins/build/*.$(LIB_EXT) -t $(DESTDIR)$(LIBDIR)
$(CMD_INSTALL) -D build/ovbox -t $(DESTDIR)$(BINDIR)
$(CMD_INSTALL) -D build/ovbox_version -t $(DESTDIR)$(BINDIR)
$(CMD_INSTALL) -D build/ovbox_cli -t $(DESTDIR)$(BINDIR)
$(CMD_INSTALL) -D build/ovzita* -t $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(SHAREDIR) && cp -r node_modules $(DESTDIR)$(SHAREDIR)
$(CMD_INSTALL) -D ovclient.css -t $(DESTDIR)$(SHAREDIR)
$(CMD_INSTALL) -D ovclient.js -t $(DESTDIR)$(SHAREDIR)
$(CMD_INSTALL) -D webmixer.js -t $(DESTDIR)$(SHAREDIR)
$(CMD_INSTALL) -D jackrec.html -t $(DESTDIR)$(SHAREDIR)
$(CMD_INSTALL) -D sounds/2138735723541465742.flac -t $(DESTDIR)$(SHAREDIR)/sounds
$(CMD_INSTALL) -D sounds/4180150583.flac -t $(DESTDIR)$(SHAREDIR)/sounds
$(CMD_LD)
#install:
# cat packaging/deb/*.csv |sed -e 's/,usr/,$${PREFIX}/1' | PREFIX=$(PREFIX) envsubst |sed -e 's/.*,//1' | sort -u | xargs -L 1 -- mkdir -p && cat packaging/deb/*.csv |sed -e 's/,usr/ $${PREFIX}/1' | PREFIX=$(PREFIX) envsubst | xargs -L 1 -I % sh -c "cp --preserve=links -r %"
homebrew:
$(MAKE) -C packaging/homebrew install