]> git.ipfire.org Git - thirdparty/shairport-sync.git/blob - Makefile.am
Update check_classic_systemd_full.yml
[thirdparty/shairport-sync.git] / Makefile.am
1 ARFLAGS = cr
2
3 man_MANS = $(top_srcdir)/man/shairport-sync.7
4
5 lib_pair_ap_a_CFLAGS = -Wall -g -DCONFIG_GCRYPT -pthread
6 lib_tinyhttp_a_CFLAGS = -pthread
7 lib_dbus_interface_a_CFLAGS = -pthread
8 lib_mpris_interface_a_CFLAGS = -pthread
9
10
11 bin_PROGRAMS = shairport-sync
12
13 BUILT_SOURCES =
14 noinst_HEADERS =
15 CLEANFILES =
16 shairport_sync_LDADD =
17 noinst_LIBRARIES =
18
19 # See below for the flags for the test client program
20
21 shairport_sync_SOURCES = shairport.c rtsp.c mdns.c common.c rtp.c player.c alac.c audio.c loudness.c activity_monitor.c
22
23 if BUILD_FOR_DARWIN
24 AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -Wno-deprecated-declarations -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
25 AM_CFLAGS = -Wno-multichar -Wall -Wextra -Wno-deprecated-declarations -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
26 else
27 if BUILD_FOR_FREEBSD
28 AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
29 AM_CFLAGS = -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
30 else
31 if BUILD_FOR_OPENBSD
32 AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
33 AM_CFLAGS = -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
34 else
35 AM_CXXFLAGS = -fno-common -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
36 AM_CFLAGS = -fno-common -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
37 endif
38 endif
39 endif
40
41 # include information generated by 'git describe --tags --dirty --broken' if requested
42 if USE_GIT_VERSION
43 shairport_sync_SOURCES += gitversion.c
44 gitversion.h: .git/index
45 printf "// Do not edit!\n" > gitversion.h
46 printf "// This file is automatically generated by 'git describe --tags --dirty --broken', if available.\n" >> gitversion.h
47 printf " char git_version_string[] = \"" >> gitversion.h
48 git describe --tags --dirty --broken | tr -d '[[:space:]]' >> gitversion.h
49 printf "\";\n" >> gitversion.h
50 gitversion.c: gitversion.h
51 touch gitversion.c
52 BUILT_SOURCES += gitversion.c gitversion.h
53 noinst_HEADERS += $(BUILT_SOURCES)
54 # Correctly clean the generated headers, but keep the xml description
55 CLEANFILES += $(BUILT_SOURCES)
56 endif
57
58 if USE_APPLE_ALAC
59 shairport_sync_SOURCES += apple_alac.cpp
60 endif
61
62 if USE_CUSTOMPIDDIR
63 AM_CFLAGS+= \
64 -DPIDDIR=\"$(CUSTOM_PID_DIR)\"
65 endif
66
67 if USE_AVAHI
68 shairport_sync_SOURCES += mdns_avahi.c
69 endif
70
71 if USE_TINYSVCMDNS
72 shairport_sync_SOURCES += mdns_tinysvcmdns.c tinysvcmdns.c
73 endif
74
75 if USE_EXTERNAL_MDNS
76 shairport_sync_SOURCES += mdns_external.c
77 endif
78
79 if USE_ALSA
80 shairport_sync_SOURCES += audio_alsa.c
81 endif
82
83 if USE_JACK
84 shairport_sync_SOURCES += audio_jack.c
85 endif
86
87 if USE_SNDIO
88 shairport_sync_SOURCES += audio_sndio.c
89 endif
90
91 if USE_STDOUT
92 shairport_sync_SOURCES += audio_stdout.c
93 endif
94
95 if USE_PIPE
96 shairport_sync_SOURCES += audio_pipe.c
97 endif
98
99 if USE_DUMMY
100 shairport_sync_SOURCES += audio_dummy.c
101 endif
102
103 if USE_AO
104 shairport_sync_SOURCES += audio_ao.c
105 endif
106
107 if USE_SOUNDIO
108 shairport_sync_SOURCES += audio_soundio.c
109 endif
110
111 if USE_PA
112 shairport_sync_SOURCES += audio_pa.c
113 endif
114
115 if USE_PW
116 shairport_sync_SOURCES += audio_pw.c
117 endif
118
119 if USE_CONVOLUTION
120 shairport_sync_SOURCES += FFTConvolver/AudioFFT.cpp FFTConvolver/FFTConvolver.cpp FFTConvolver/Utilities.cpp FFTConvolver/convolver.cpp
121 AM_CXXFLAGS += -std=c++11
122 endif
123
124 if USE_DNS_SD
125 shairport_sync_SOURCES += mdns_dns_sd.c
126 endif
127
128 if USE_METADATA_HUB
129 shairport_sync_SOURCES += metadata_hub.c
130 endif
131
132 if USE_MQTT
133 shairport_sync_SOURCES += mqtt.c
134 endif
135
136 if USE_DACP_CLIENT
137 shairport_sync_SOURCES += dacp.c
138 shairport_sync_LDADD += lib_tinyhttp.a
139 noinst_LIBRARIES += lib_tinyhttp.a
140 lib_tinyhttp_a_SOURCES = tinyhttp/chunk.c tinyhttp/header.c tinyhttp/http.c
141 endif
142
143 if USE_AIRPLAY_2
144 shairport_sync_SOURCES += ptp-utilities.c plist_xml_strings.c
145 shairport_sync_LDADD += lib_pair_ap.a
146 lib_pair_ap_a_SOURCES = pair_ap/pair.c pair_ap/pair_fruit.c pair_ap/pair_homekit.c pair_ap/pair-tlv.c
147 noinst_LIBRARIES += lib_pair_ap.a
148 plist_xml_strings.h: plists/get_info_response.xml
149 printf "// Do not edit!\n" > plist_xml_strings.h
150 printf "// This file is automatically generated from files in the plists folder.\n\n" >> plist_xml_strings.h
151 xxd -i $(top_srcdir)/plists/get_info_response.xml - | sed -e 's/[^ ]*plists_get_info_response_xml/plists_get_info_response_xml/g' >> plist_xml_strings.h
152 printf "\n" >> plist_xml_strings.h
153 plist_xml_strings.c: plist_xml_strings.h
154 touch plist_xml_strings.c
155
156 BUILT_SOURCES += plist_xml_strings.c plist_xml_strings.h
157 noinst_HEADERS += $(BUILT_SOURCES)
158 # Correctly clean the generated headers, but keep the xml description
159 CLEANFILES += $(BUILT_SOURCES)
160 endif
161
162 if USE_DBUS
163 shairport_sync_LDADD += lib_dbus_interface.a
164 noinst_LIBRARIES += lib_dbus_interface.a
165 lib_dbus_interface_a_SOURCES = dbus-interface.c
166 shairport_sync_SOURCES += dbus-service.c
167 BUILT_SOURCES += dbus-interface.h dbus-interface.c
168 # We don't want to install this header
169 noinst_HEADERS += $(BUILT_SOURCES)
170 # Correctly clean the generated headers, but keep the xml description
171 CLEANFILES += $(BUILT_SOURCES)
172
173
174
175 dbus-interface.c: org.gnome.ShairportSync.xml
176 gdbus-codegen --interface-prefix org.gnome --generate-c-code dbus-interface $(top_srcdir)/org.gnome.ShairportSync.xml
177 dbus-interface.h: dbus-interface.c
178 touch dbus-interface.h
179 endif
180
181 if USE_MPRIS
182 shairport_sync_LDADD += lib_mpris_interface.a
183 noinst_LIBRARIES += lib_mpris_interface.a
184 lib_mpris_interface_a_SOURCES = mpris-interface.c
185 shairport_sync_SOURCES += mpris-service.c
186 BUILT_SOURCES += mpris-interface.h mpris-interface.c
187 # We don't want to install this header
188 noinst_HEADERS += $(BUILT_SOURCES)
189 # Correctly clean the generated headers, but keep the xml description
190 CLEANFILES += $(BUILT_SOURCES)
191
192 mpris-interface.c: org.mpris.MediaPlayer2.xml
193 gdbus-codegen --interface-prefix org.mpris --generate-c-code mpris-interface $(top_srcdir)/org.mpris.MediaPlayer2.xml
194 mpris-interface.h: mpris-interface.c
195 touch mpris-interface.h
196 endif
197
198 noinst_PROGRAMS =
199
200 if USE_DBUS_CLIENT
201 #Make it, but don't install it anywhere
202 noinst_PROGRAMS += shairport-sync-dbus-test-client
203 shairport_sync_dbus_test_client_SOURCES = shairport-sync-dbus-test-client.c
204 shairport_sync_dbus_test_client_LDADD = lib_dbus_interface.a
205 endif
206
207 if USE_MPRIS_CLIENT
208 #Make it, but don't install it anywhere
209 noinst_PROGRAMS += shairport-sync-mpris-test-client
210 shairport_sync_mpris_test_client_SOURCES = shairport-sync-mpris-test-client.c
211 shairport_sync_mpris_test_client_LDADD = lib_mpris_interface.a
212 endif
213
214 if INSTALL_CONFIG_FILES
215
216 CONFIG_FILE_INSTALL_TARGET = config-file-install-local
217 $(CONFIG_FILE_INSTALL_TARGET): scripts/shairport-sync.conf
218 install -d $(DESTDIR)$(sysconfdir)
219 install -m 0644 $(top_srcdir)/scripts/shairport-sync.conf $(DESTDIR)$(sysconfdir)/shairport-sync.conf.sample
220 [ -f $(DESTDIR)$(sysconfdir)/shairport-sync.conf ] || cp $(top_srcdir)/scripts/shairport-sync.conf $(DESTDIR)$(sysconfdir)/shairport-sync.conf
221
222 if BUILD_FOR_LINUX
223 DBUS_POLICY_DIR = /etc/dbus-1/system.d
224 else
225 DBUS_POLICY_DIR = $(sysconfdir)/dbus-1/system.d
226 endif
227
228 if USE_DBUS
229
230 if INSTALL_CYGWIN_SERVICE
231 DBUS_POLICY_FILE = scripts/shairport-sync-dbus-policy-cygwin.conf
232 else
233 DBUS_POLICY_FILE = scripts/shairport-sync-dbus-policy.conf
234 endif # INSTALL_CYGWIN_SERVICE
235
236 DBUS_POLICY_INSTALL_TARGET = dbus-policy-install-local
237
238 $(DBUS_POLICY_INSTALL_TARGET): $(DBUS_POLICY_FILE)
239 install -d $(DESTDIR)$(DBUS_POLICY_DIR)
240 install -m 0644 $(top_srcdir)/$(DBUS_POLICY_FILE) $(DESTDIR)$(DBUS_POLICY_DIR)/shairport-sync-dbus.conf
241
242 endif # USE_DBUS
243
244 if USE_MPRIS
245
246 if INSTALL_CYGWIN_SERVICE
247 MPRIS_POLICY_FILE = scripts/shairport-sync-mpris-policy-cygwin.conf
248 else
249 MPRIS_POLICY_FILE = scripts/shairport-sync-mpris-policy.conf
250 endif # INSTALL_CYGWIN_SERVICE
251
252 MPRIS_POLICY_INSTALL_TARGET = mpris-policy-install-local
253
254 $(MPRIS_POLICY_INSTALL_TARGET): $(MPRIS_POLICY_FILE)
255 install -d $(DESTDIR)$(DBUS_POLICY_DIR)
256 install -m 0644 $(top_srcdir)/$(MPRIS_POLICY_FILE) $(DESTDIR)$(DBUS_POLICY_DIR)/shairport-sync-mpris.conf
257
258 endif # USE_MPRIS
259
260 endif # INSTALL_CONFIG_FILES
261
262 INSTALL_GROUP_TARGET = install-group-local
263
264 $(INSTALL_GROUP_TARGET):
265 getent group shairport-sync &>/dev/null || groupadd -r shairport-sync &>/dev/null
266
267 INSTALL_USER_TARGET = install-user-local
268
269 $(INSTALL_USER_TARGET): $(INSTALL_GROUP_TARGET)
270 getent passwd shairport-sync &>/dev/null || useradd -r -M -g shairport-sync -s /usr/sbin/nologin -G audio shairport-sync &>/dev/null
271
272 if INSTALL_SYSTEMV
273
274 INSTALL_SYSTEMV_TARGET = install-systemv-local
275
276 # watch out -- shairport-sync is created during the ./configure step and
277 # will be stored in a scripts folder in the _build_ folder
278 # which will be the source folder if you're not using a separate build folder
279
280 $(INSTALL_SYSTEMV_TARGET): scripts/shairport-sync $(INSTALL_USER_TARGET)
281 install -d $(DESTDIR)$(sysconfdir)/init.d
282 [ -e $(DESTDIR)$(sysconfdir)/init.d/shairport-sync ] || install -m 0755 scripts/shairport-sync $(DESTDIR)$(sysconfdir)/init.d
283
284 endif # INSTALL_SYSTEMV
285
286 if INSTALL_SYSTEMD
287
288 if USE_AVAHI
289 SYSTEMD_SERVICE = shairport-sync.service-avahi
290 else
291 SYSTEMD_SERVICE = shairport-sync.service
292 endif # USE_AVAHI
293
294 INSTALL_SYSTEMD_TARGET = install-systemd-local
295
296 # watch out -- shairport-sync.service is created during the ./configure step and
297 # will be stored in a scripts folder in the _build_ folder
298 # which will be the source folder if you're not using a separate build folder
299
300 $(INSTALL_SYSTEMD_TARGET): scripts/$(SYSTEMD_SERVICE) $(INSTALL_USER_TARGET)
301 install -d $(DESTDIR)$(systemdsystemunitdir)
302 [ -e $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service ] || install -m 0644 scripts/$(SYSTEMD_SERVICE) $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service
303
304 endif # INSTALL_SYSTEMD
305
306 if INSTALL_FREEBSD_SERVICE
307
308 # Choose a uid and gid of 801 completely arbitrarity, except that it should be below 1000. FreeBSD doesn't seem to allow you to say "an ID in the range of..."
309 install-freebsd-user-local:
310 pw showgroup shairport-sync > /dev/null 2>&1 || pw addgroup -n shairport-sync -g 801 > /dev/null 2>&1
311 pw showuser shairport-sync > /dev/null 2>&1 || pw adduser -c "shairport-sync unprivileged user" -n shairport-sync -u 801 -s /usr/sbin/nologin -d /nonexistent > /dev/null 2>&1
312
313 INSTALL_FREEBSD_TARGET = install-freebsd-local
314
315 $(INSTALL_FREEBSD_TARGET): scripts/shairport-sync.freebsd install-freebsd-user-local
316 install -d -o shairport-sync -g shairport-sync $(DESTDIR)/var/run/shairport-sync
317 install -d $(DESTDIR)/usr/local/etc/rc.d/
318 install -m 0555 $(top_srcdir)/scripts/shairport-sync.freebsd $(DESTDIR)/usr/local/etc/rc.d/shairport_sync
319
320 endif # INSTALL_FREEBSD_SERVICE
321
322 if INSTALL_CYGWIN_SERVICE
323
324 INSTALL_CYGWIN_TARGET = install-cygwin-local
325
326 $(INSTALL_CYGWIN_TARGET): scripts/shairport-sync-config
327 install -d $(DESTDIR)/usr/local/bin
328 [ -e $(DESTDIR)/usr/local/bin/shairport-sync-config ] || install -m 0755 $(top_srcdir)/scripts/shairport-sync-config $(DESTDIR)/usr/local/bin/
329
330 endif # INSTALL_CYGWIN_SERVICE
331
332 install-exec-hook: $(CONFIG_FILE_INSTALL_TARGET) \
333 $(DBUS_POLICY_INSTALL_TARGET) \
334 $(MPRIS_POLICY_INSTALL_TARGET) \
335 $(INSTALL_SYSTEMV_TARGET) \
336 $(INSTALL_SYSTEMD_TARGET) \
337 $(INSTALL_FREEBSD_TARGET) \
338 $(INSTALL_CYGWIN_TARGET)