-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
134 lines (99 loc) · 3.75 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
PREFIX ?= /usr/local
LIB_DIR ?= $(PREFIX)/lib
BIN_DIR ?= $(PREFIX)/bin
CFG_DIR ?= /etc
SPOTIFY_DEVICE_NAME ?= "raspotify@salon"
SPOTIFY_ONEVENT_SCRIPT = "$(BIN_DIR)/powerup-onkyo.sh"
ONKYO_ENTRYPOINT=cd $(LIB_DIR)/onkyo; ./venv/bin/python3 -m eiscp.script
ONKYO_HOST=192.168.1.16
ONKYO_PORT=60128
DSP_EFFECTS_FILE=wiosna77
DSP_PCM_OUT=dmix:CARD=USB,DEV=0
DEFAULT_PCM_TYPE=plug
# DEFAULT_PCM_TYPE=copy
# DSP_PCM_OUT=hw:0
build: \
prerequisites \
build/asound.conf \
build/powerup-onkyo.sh \
build/raspotify.conf \
build/dsp/ladspa_dsp.so \
build/ladspa_dsp.conf \
build/effects \
build/alsaloop.service
prerequisites:
@mkdir -p build
install: \
$(LIB_DIR)/ladspa/ladspa_dsp.so \
$(CFG_DIR)/raspotify/conf \
$(BIN_DIR)/powerup-onkyo.sh \
$(LIB_DIR)/onkyo \
$(CFG_DIR)/asound.conf \
$(CFG_DIR)/ladspa_dsp \
$(CFG_DIR)/systemd/system/alsaloop.service
sudo systemctl daemon-reload
sudo systemctl restart alsaloop.service
sudo systemctl enable alsaloop.service
sudo systemctl restart raspotify.service
sudo systemctl enable raspotify.service
uninstall:
@cd build/dsp && sudo make uninstall
rm -rf $(CFG_DIR)/raspotify
rm -rf $(LIB_DIR)/onkyo
rm -rf $(LIB_DIR)/ladspa
rm -rf $(CFG_DIR)/ladspa_dsp
rm -f $(BIN_DIR)/powerup-onkyo.sh
sudo systemctl stop raspotify.service
sudo systemctl disable raspotify.service
sudo systemctl stop alsaloop.service
sudo systemctl disable alsaloop.service
clean: uninstall
rm -rf build
build/asound.conf: templates/asound.conf
cat templates/asound.conf \
| sed 's|{{DSP_PCM_OUT}}|$(DSP_PCM_OUT)|g' \
| sed 's|{{DEFAULT_PCM_TYPE}}|$(DEFAULT_PCM_TYPE)|g' \
> build/asound.conf
build/ladspa_dsp.conf: templates/ladspa_dsp.conf
cat templates/ladspa_dsp.conf > build/ladspa_dsp.conf
build/effects: effects/$(DSP_EFFECTS_FILE)
cp effects/$(DSP_EFFECTS_FILE) build/effects
build/raspotify.conf: templates/raspotify.conf
cat templates/raspotify.conf \
| sed 's|{{LIBRESPOT_NAME}}|$(SPOTIFY_DEVICE_NAME)|g' \
| sed 's|{{LIBRESPOT_ONEVENT}}|$(SPOTIFY_ONEVENT_SCRIPT)|g' \
> build/raspotify.conf
build/powerup-onkyo.sh: templates/powerup-onkyo.sh build/onkyo/venv
cat templates/powerup-onkyo.sh \
| sed 's|{{ONKYO_ENTRYPOINT}}|$(ONKYO_ENTRYPOINT)|g' \
| sed 's|{{ONKYO_HOST}}|$(ONKYO_HOST)|g' \
| sed 's|{{ONKYO_PORT}}|$(ONKYO_PORT)|g' \
> build/powerup-onkyo.sh
build/dsp/README.md: # check if repo exists
@git clone https://github.com/bmc0/dsp build/dsp
build/dsp/ladspa_dsp.so: build/dsp/README.md
cd build/dsp && ./configure && make
build/onkyo/README.rst:
@git clone https://github.com/miracle2k/onkyo-eiscp build/onkyo
build/onkyo/venv: build/onkyo/README.rst
cd build/onkyo && python3 -m venv venv && ./venv/bin/pip install xmltodict netifaces docopt
build/alsaloop.service: templates/alsaloop.service
cat templates/alsaloop.service > build/alsaloop.service
build/snapcast/README.md:
@git clone https://github.com/badaix/snapcast build/snapcast
$(CFG_DIR)/ladspa_dsp: build/ladspa_dsp.conf build/effects
install -Dm 755 build/ladspa_dsp.conf $(CFG_DIR)/ladspa_dsp/config
install -Dm 755 build/effects $(CFG_DIR)/ladspa_dsp/effects
$(CFG_DIR)/asound.conf: build/asound.conf
install -Dm 755 build/asound.conf $(CFG_DIR)/asound.conf
$(BIN_DIR)/powerup-onkyo.sh: build/powerup-onkyo.sh
install -m 755 build/powerup-onkyo.sh $(BIN_DIR)/powerup-onkyo.sh
$(LIB_DIR)/ladspa/ladspa_dsp.so: build/dsp/ladspa_dsp.so
cd build/dsp && sudo make install
$(LIB_DIR)/onkyo: build/onkyo/venv
cp -r build/onkyo $(LIB_DIR)/onkyo
$(CFG_DIR)/raspotify/conf: build/raspotify.conf
install -Dm 600 build/raspotify.conf $(CFG_DIR)/raspotify/conf
$(CFG_DIR)/systemd/system/alsaloop.service: build/alsaloop.service
install -m 755 build/alsaloop.service $(CFG_DIR)/systemd/system/alsaloop.service
.PHONY: all build prerequisites install uninstall clean