3 man_MANS = $(top_srcdir)/man/shairport-sync.7
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
11 bin_PROGRAMS = shairport-sync
16 shairport_sync_LDADD =
19 # See below for the flags for the test client program
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
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)\"
28 AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
29 AM_CFLAGS = -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
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)\"
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)\"
41 # include information generated by 'git describe --tags --dirty --broken' if requested
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
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)
59 shairport_sync_SOURCES += apple_alac.cpp
64 -DPIDDIR=\"$(CUSTOM_PID_DIR)\"
68 shairport_sync_SOURCES += mdns_avahi.c
72 shairport_sync_SOURCES += mdns_tinysvcmdns.c tinysvcmdns.c
76 shairport_sync_SOURCES += mdns_external.c
80 shairport_sync_SOURCES += audio_alsa.c
84 shairport_sync_SOURCES += audio_jack.c
88 shairport_sync_SOURCES += audio_sndio.c
92 shairport_sync_SOURCES += audio_stdout.c
96 shairport_sync_SOURCES += audio_pipe.c
100 shairport_sync_SOURCES += audio_dummy.c
104 shairport_sync_SOURCES += audio_ao.c
108 shairport_sync_SOURCES += audio_soundio.c
112 shairport_sync_SOURCES += audio_pa.c
116 shairport_sync_SOURCES += audio_pw.c
120 shairport_sync_SOURCES += FFTConvolver/AudioFFT.cpp FFTConvolver/FFTConvolver.cpp FFTConvolver/Utilities.cpp FFTConvolver/convolver.cpp
121 AM_CXXFLAGS += -std=c++11
125 shairport_sync_SOURCES += mdns_dns_sd.c
129 shairport_sync_SOURCES += metadata_hub.c
133 shairport_sync_SOURCES += mqtt.c
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
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
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)
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)
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
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)
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
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
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
214 if INSTALL_CONFIG_FILES
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
223 DBUS_POLICY_DIR = /etc/dbus-1/system.d
225 DBUS_POLICY_DIR = $(sysconfdir)/dbus-1/system.d
230 if INSTALL_CYGWIN_SERVICE
231 DBUS_POLICY_FILE = scripts/shairport-sync-dbus-policy-cygwin.conf
233 DBUS_POLICY_FILE = scripts/shairport-sync-dbus-policy.conf
234 endif # INSTALL_CYGWIN_SERVICE
236 DBUS_POLICY_INSTALL_TARGET = dbus-policy-install-local
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
246 if INSTALL_CYGWIN_SERVICE
247 MPRIS_POLICY_FILE = scripts/shairport-sync-mpris-policy-cygwin.conf
249 MPRIS_POLICY_FILE = scripts/shairport-sync-mpris-policy.conf
250 endif # INSTALL_CYGWIN_SERVICE
252 MPRIS_POLICY_INSTALL_TARGET = mpris-policy-install-local
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
260 endif # INSTALL_CONFIG_FILES
262 INSTALL_GROUP_TARGET = install-group-local
264 $(INSTALL_GROUP_TARGET):
265 getent group shairport-sync &>/dev/null || groupadd -r shairport-sync &>/dev/null
267 INSTALL_USER_TARGET = install-user-local
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
274 INSTALL_SYSTEMV_TARGET = install-systemv-local
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
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
284 endif # INSTALL_SYSTEMV
289 SYSTEMD_SERVICE = shairport-sync.service-avahi
291 SYSTEMD_SERVICE = shairport-sync.service
294 INSTALL_SYSTEMD_TARGET = install-systemd-local
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
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
304 endif # INSTALL_SYSTEMD
306 if INSTALL_FREEBSD_SERVICE
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
313 INSTALL_FREEBSD_TARGET = install-freebsd-local
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
320 endif # INSTALL_FREEBSD_SERVICE
322 if INSTALL_CYGWIN_SERVICE
324 INSTALL_CYGWIN_TARGET = install-cygwin-local
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/
330 endif # INSTALL_CYGWIN_SERVICE
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)