]> git.ipfire.org Git - thirdparty/shairport-sync.git/blame - Makefile.am
Update check_classic_systemd_full.yml
[thirdparty/shairport-sync.git] / Makefile.am
CommitLineData
b91df8ec 1ARFLAGS = cr
8110851d 2
86a52964
MB
3man_MANS = $(top_srcdir)/man/shairport-sync.7
4
0cc97d50 5lib_pair_ap_a_CFLAGS = -Wall -g -DCONFIG_GCRYPT -pthread
8110851d 6lib_tinyhttp_a_CFLAGS = -pthread
580d75a6
MB
7lib_dbus_interface_a_CFLAGS = -pthread
8lib_mpris_interface_a_CFLAGS = -pthread
9
5bdc16e3 10
e223a543 11bin_PROGRAMS = shairport-sync
1e07e1e0 12
8110851d
MB
13BUILT_SOURCES =
14noinst_HEADERS =
15CLEANFILES =
16shairport_sync_LDADD =
17noinst_LIBRARIES =
18
79e610fa 19# See below for the flags for the test client program
1e07e1e0 20
3162977c 21shairport_sync_SOURCES = shairport.c rtsp.c mdns.c common.c rtp.c player.c alac.c audio.c loudness.c activity_monitor.c
9d450966 22
c458114c
MB
23if 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)\"
26else
0df8bf31 27if BUILD_FOR_FREEBSD
580d75a6
MB
28 AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
29 AM_CFLAGS = -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
283e4930
MB
30else
31if BUILD_FOR_OPENBSD
25d02d18 32 AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
07c45454 33 AM_CFLAGS = -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
0df8bf31 34else
36ed65fc
MB
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)\"
0df8bf31 37endif
283e4930 38endif
c458114c 39endif
945483d9 40
a0e9c0ac 41# include information generated by 'git describe --tags --dirty --broken' if requested
2203d6a3 42if USE_GIT_VERSION
1fb0276b 43shairport_sync_SOURCES += gitversion.c
2203d6a3 44gitversion.h: .git/index
1f821095 45 printf "// Do not edit!\n" > gitversion.h
a0e9c0ac 46 printf "// This file is automatically generated by 'git describe --tags --dirty --broken', if available.\n" >> gitversion.h
1f821095 47 printf " char git_version_string[] = \"" >> gitversion.h
a0e9c0ac 48 git describe --tags --dirty --broken | tr -d '[[:space:]]' >> gitversion.h
1f821095 49 printf "\";\n" >> gitversion.h
1fb0276b
MB
50gitversion.c: gitversion.h
51 touch gitversion.c
52BUILT_SOURCES += gitversion.c gitversion.h
53noinst_HEADERS += $(BUILT_SOURCES)
54# Correctly clean the generated headers, but keep the xml description
55CLEANFILES += $(BUILT_SOURCES)
2203d6a3
MB
56endif
57
c9b3d2a2 58if USE_APPLE_ALAC
945483d9
MB
59 shairport_sync_SOURCES += apple_alac.cpp
60endif
391b48f6 61
043363fb 62if USE_CUSTOMPIDDIR
391b48f6
MB
63AM_CFLAGS+= \
64 -DPIDDIR=\"$(CUSTOM_PID_DIR)\"
12f26893 65endif
e223a543
MB
66
67if USE_AVAHI
68shairport_sync_SOURCES += mdns_avahi.c
69endif
70
71if USE_TINYSVCMDNS
72shairport_sync_SOURCES += mdns_tinysvcmdns.c tinysvcmdns.c
73endif
8d0b2702 74
3162977c
MB
75if USE_EXTERNAL_MDNS
76shairport_sync_SOURCES += mdns_external.c
77endif
78
9d450966 79if USE_ALSA
e223a543 80shairport_sync_SOURCES += audio_alsa.c
9d450966
MB
81endif
82
8cabb16f
MB
83if USE_JACK
84shairport_sync_SOURCES += audio_jack.c
85endif
86
9d450966 87if USE_SNDIO
e223a543 88shairport_sync_SOURCES += audio_sndio.c
9d450966
MB
89endif
90
a090a14c
MB
91if USE_STDOUT
92shairport_sync_SOURCES += audio_stdout.c
93endif
94
95if USE_PIPE
96shairport_sync_SOURCES += audio_pipe.c
97endif
98
99if USE_DUMMY
100shairport_sync_SOURCES += audio_dummy.c
101endif
102
9d450966 103if USE_AO
e223a543 104shairport_sync_SOURCES += audio_ao.c
9d450966
MB
105endif
106
71fc1a2c 107if USE_SOUNDIO
108shairport_sync_SOURCES += audio_soundio.c
109endif
110
b3ae05ea
MB
111if USE_PA
112shairport_sync_SOURCES += audio_pa.c
113endif
114
ec232363
LR
115if USE_PW
116shairport_sync_SOURCES += audio_pw.c
117endif
118
7b9cd28e
YP
119if USE_CONVOLUTION
120shairport_sync_SOURCES += FFTConvolver/AudioFFT.cpp FFTConvolver/FFTConvolver.cpp FFTConvolver/Utilities.cpp FFTConvolver/convolver.cpp
25d02d18 121AM_CXXFLAGS += -std=c++11
7b9cd28e
YP
122endif
123
9d450966 124if USE_DNS_SD
e223a543 125shairport_sync_SOURCES += mdns_dns_sd.c
9d450966 126endif
12f26893 127
9d9b0a18 128if USE_METADATA_HUB
8110851d 129shairport_sync_SOURCES += metadata_hub.c
9d9b0a18
MB
130endif
131
02694948 132if USE_MQTT
8110851d 133shairport_sync_SOURCES += mqtt.c
02694948
TZ
134endif
135
9d9b0a18 136if USE_DACP_CLIENT
8110851d
MB
137shairport_sync_SOURCES += dacp.c
138shairport_sync_LDADD += lib_tinyhttp.a
139noinst_LIBRARIES += lib_tinyhttp.a
140lib_tinyhttp_a_SOURCES = tinyhttp/chunk.c tinyhttp/header.c tinyhttp/http.c
141endif
142
143if USE_AIRPLAY_2
144shairport_sync_SOURCES += ptp-utilities.c plist_xml_strings.c
493e9604 145shairport_sync_LDADD += lib_pair_ap.a
8110851d 146lib_pair_ap_a_SOURCES = pair_ap/pair.c pair_ap/pair_fruit.c pair_ap/pair_homekit.c pair_ap/pair-tlv.c
493e9604 147noinst_LIBRARIES += lib_pair_ap.a
8110851d 148plist_xml_strings.h: plists/get_info_response.xml
1092a8c1
MB
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
8110851d
MB
153plist_xml_strings.c: plist_xml_strings.h
154 touch plist_xml_strings.c
155
156BUILT_SOURCES += plist_xml_strings.c plist_xml_strings.h
157noinst_HEADERS += $(BUILT_SOURCES)
158# Correctly clean the generated headers, but keep the xml description
159CLEANFILES += $(BUILT_SOURCES)
9d9b0a18
MB
160endif
161
1e07e1e0 162if USE_DBUS
b91df8ec
MB
163shairport_sync_LDADD += lib_dbus_interface.a
164noinst_LIBRARIES += lib_dbus_interface.a
165lib_dbus_interface_a_SOURCES = dbus-interface.c
166shairport_sync_SOURCES += dbus-service.c
8110851d 167BUILT_SOURCES += dbus-interface.h dbus-interface.c
d4eae76f 168# We don't want to install this header
0e260bcc 169noinst_HEADERS += $(BUILT_SOURCES)
d4eae76f 170# Correctly clean the generated headers, but keep the xml description
0e260bcc 171CLEANFILES += $(BUILT_SOURCES)
d4eae76f 172
1092a8c1
MB
173
174
203f0260 175dbus-interface.c: org.gnome.ShairportSync.xml
1092a8c1 176 gdbus-codegen --interface-prefix org.gnome --generate-c-code dbus-interface $(top_srcdir)/org.gnome.ShairportSync.xml
35860f7b 177dbus-interface.h: dbus-interface.c
203f0260 178 touch dbus-interface.h
79e610fa 179endif
d4eae76f 180
74f41a17 181if USE_MPRIS
b91df8ec
MB
182shairport_sync_LDADD += lib_mpris_interface.a
183noinst_LIBRARIES += lib_mpris_interface.a
184lib_mpris_interface_a_SOURCES = mpris-interface.c
185shairport_sync_SOURCES += mpris-service.c
26d7b079 186BUILT_SOURCES += mpris-interface.h mpris-interface.c
74f41a17 187# We don't want to install this header
0e260bcc 188noinst_HEADERS += $(BUILT_SOURCES)
74f41a17 189# Correctly clean the generated headers, but keep the xml description
0e260bcc 190CLEANFILES += $(BUILT_SOURCES)
74f41a17 191
203f0260 192mpris-interface.c: org.mpris.MediaPlayer2.xml
1092a8c1 193 gdbus-codegen --interface-prefix org.mpris --generate-c-code mpris-interface $(top_srcdir)/org.mpris.MediaPlayer2.xml
35860f7b 194mpris-interface.h: mpris-interface.c
203f0260 195 touch mpris-interface.h
74f41a17
MB
196endif
197
9776b378
MB
198noinst_PROGRAMS =
199
79e610fa
MB
200if USE_DBUS_CLIENT
201 #Make it, but don't install it anywhere
9776b378 202noinst_PROGRAMS += shairport-sync-dbus-test-client
b91df8ec
MB
203shairport_sync_dbus_test_client_SOURCES = shairport-sync-dbus-test-client.c
204shairport_sync_dbus_test_client_LDADD = lib_dbus_interface.a
df7c48f0
MB
205endif
206
207if USE_MPRIS_CLIENT
208 #Make it, but don't install it anywhere
9776b378 209noinst_PROGRAMS += shairport-sync-mpris-test-client
b91df8ec
MB
210shairport_sync_mpris_test_client_SOURCES = shairport-sync-mpris-test-client.c
211shairport_sync_mpris_test_client_LDADD = lib_mpris_interface.a
1e07e1e0
MB
212endif
213
931c7ed2
LR
214if INSTALL_CONFIG_FILES
215
216CONFIG_FILE_INSTALL_TARGET = config-file-install-local
217$(CONFIG_FILE_INSTALL_TARGET): scripts/shairport-sync.conf
218 install -d $(DESTDIR)$(sysconfdir)
1092a8c1 219 install -m 0644 $(top_srcdir)/scripts/shairport-sync.conf $(DESTDIR)$(sysconfdir)/shairport-sync.conf.sample
14bda21b 220 [ -f $(DESTDIR)$(sysconfdir)/shairport-sync.conf ] || cp $(top_srcdir)/scripts/shairport-sync.conf $(DESTDIR)$(sysconfdir)/shairport-sync.conf
931c7ed2 221
4aea4cc5 222if BUILD_FOR_LINUX
931c7ed2 223DBUS_POLICY_DIR = /etc/dbus-1/system.d
4aea4cc5 224else
931c7ed2 225DBUS_POLICY_DIR = $(sysconfdir)/dbus-1/system.d
4aea4cc5 226endif
931c7ed2 227
1e07e1e0 228if USE_DBUS
931c7ed2 229
623b9b4b 230if INSTALL_CYGWIN_SERVICE
931c7ed2 231DBUS_POLICY_FILE = scripts/shairport-sync-dbus-policy-cygwin.conf
623b9b4b 232else
931c7ed2
LR
233DBUS_POLICY_FILE = scripts/shairport-sync-dbus-policy.conf
234endif # INSTALL_CYGWIN_SERVICE
235
236DBUS_POLICY_INSTALL_TARGET = dbus-policy-install-local
237
238$(DBUS_POLICY_INSTALL_TARGET): $(DBUS_POLICY_FILE)
239 install -d $(DESTDIR)$(DBUS_POLICY_DIR)
1092a8c1 240 install -m 0644 $(top_srcdir)/$(DBUS_POLICY_FILE) $(DESTDIR)$(DBUS_POLICY_DIR)/shairport-sync-dbus.conf
931c7ed2
LR
241
242endif # USE_DBUS
243
da3366a2 244if USE_MPRIS
931c7ed2 245
623b9b4b 246if INSTALL_CYGWIN_SERVICE
931c7ed2 247MPRIS_POLICY_FILE = scripts/shairport-sync-mpris-policy-cygwin.conf
623b9b4b 248else
931c7ed2
LR
249MPRIS_POLICY_FILE = scripts/shairport-sync-mpris-policy.conf
250endif # INSTALL_CYGWIN_SERVICE
251
252MPRIS_POLICY_INSTALL_TARGET = mpris-policy-install-local
253
254$(MPRIS_POLICY_INSTALL_TARGET): $(MPRIS_POLICY_FILE)
255 install -d $(DESTDIR)$(DBUS_POLICY_DIR)
1092a8c1 256 install -m 0644 $(top_srcdir)/$(MPRIS_POLICY_FILE) $(DESTDIR)$(DBUS_POLICY_DIR)/shairport-sync-mpris.conf
931c7ed2
LR
257
258endif # USE_MPRIS
259
260endif # INSTALL_CONFIG_FILES
261
262INSTALL_GROUP_TARGET = install-group-local
263
264$(INSTALL_GROUP_TARGET):
b3db7e88 265 getent group shairport-sync &>/dev/null || groupadd -r shairport-sync &>/dev/null
931c7ed2
LR
266
267INSTALL_USER_TARGET = install-user-local
268
269$(INSTALL_USER_TARGET): $(INSTALL_GROUP_TARGET)
b3db7e88 270 getent passwd shairport-sync &>/dev/null || useradd -r -M -g shairport-sync -s /usr/sbin/nologin -G audio shairport-sync &>/dev/null
931c7ed2
LR
271
272if INSTALL_SYSTEMV
273
274INSTALL_SYSTEMV_TARGET = install-systemv-local
275
7f9e8116
MB
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
931c7ed2
LR
280$(INSTALL_SYSTEMV_TARGET): scripts/shairport-sync $(INSTALL_USER_TARGET)
281 install -d $(DESTDIR)$(sysconfdir)/init.d
1296b8f2 282 [ -e $(DESTDIR)$(sysconfdir)/init.d/shairport-sync ] || install -m 0755 scripts/shairport-sync $(DESTDIR)$(sysconfdir)/init.d
931c7ed2
LR
283
284endif # INSTALL_SYSTEMV
285
f6eca4ca 286if INSTALL_SYSTEMD
931c7ed2 287
38bbad6f 288if USE_AVAHI
931c7ed2 289SYSTEMD_SERVICE = shairport-sync.service-avahi
38bbad6f 290else
931c7ed2
LR
291SYSTEMD_SERVICE = shairport-sync.service
292endif # USE_AVAHI
293
294INSTALL_SYSTEMD_TARGET = install-systemd-local
295
7f9e8116
MB
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
931c7ed2
LR
300$(INSTALL_SYSTEMD_TARGET): scripts/$(SYSTEMD_SERVICE) $(INSTALL_USER_TARGET)
301 install -d $(DESTDIR)$(systemdsystemunitdir)
7f9e8116 302 [ -e $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service ] || install -m 0644 scripts/$(SYSTEMD_SERVICE) $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service
931c7ed2
LR
303
304endif # INSTALL_SYSTEMD
305
f6eca4ca 306if INSTALL_FREEBSD_SERVICE
931c7ed2
LR
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..."
309install-freebsd-user-local:
feaa9319
MB
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
931c7ed2
LR
312
313INSTALL_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/
1092a8c1 318 install -m 0555 $(top_srcdir)/scripts/shairport-sync.freebsd $(DESTDIR)/usr/local/etc/rc.d/shairport_sync
931c7ed2
LR
319
320endif # INSTALL_FREEBSD_SERVICE
321
623b9b4b 322if INSTALL_CYGWIN_SERVICE
931c7ed2
LR
323
324INSTALL_CYGWIN_TARGET = install-cygwin-local
325
326$(INSTALL_CYGWIN_TARGET): scripts/shairport-sync-config
327 install -d $(DESTDIR)/usr/local/bin
1092a8c1 328 [ -e $(DESTDIR)/usr/local/bin/shairport-sync-config ] || install -m 0755 $(top_srcdir)/scripts/shairport-sync-config $(DESTDIR)/usr/local/bin/
931c7ed2
LR
329
330endif # INSTALL_CYGWIN_SERVICE
331
332install-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)