-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
85 lines (70 loc) · 2.1 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
# Cross compile support - create a Makefile which defines these three variables and then includes this Makefile...
CFLAGS ?= -Wall -fPIC -O2 $(OPTS)
LDFLAGS ?= -lasound -lpthread -lm -lrt
EXECUTABLE ?= squeezelite
# passing one or more of these in $(OPTS) enables optional feature inclusion
OPT_DSD = -DDSD
OPT_FF = -DFFMPEG
OPT_LINKALL = -DLINKALL
OPT_RESAMPLE= -DRESAMPLE
OPT_VIS = -DVISEXPORT
OPT_IR = -DIR
SOURCES = \
main.c slimproto.c buffer.c stream.c utils.c \
output.c output_alsa.c output_pa.c output_stdout.c output_pack.c decode.c \
flac.c pcm.c mad.c vorbis.c faad.c mpg.c
SOURCES_DSD = dsd.c dop.c dsd2pcm/dsd2pcm.c
SOURCES_FF = ffmpeg.c
SOURCES_RESAMPLE = process.c resample.c
SOURCES_VIS = output_vis.c
SOURCES_IR = ir.c
LINK_LINUX = -ldl
LINKALL = -lFLAC -lmad -lvorbisfile -lfaad -lmpg123
LINKALL_FF = -lavcodec -lavformat -lavutil
LINKALL_RESAMPLE = -lsoxr
LINKALL_IR = -llirc_client
DEPS = squeezelite.h slimproto.h
UNAME = $(shell uname -s)
# add optional sources
ifneq (,$(findstring $(OPT_DSD), $(CFLAGS)))
SOURCES += $(SOURCES_DSD)
endif
ifneq (,$(findstring $(OPT_FF), $(CFLAGS)))
SOURCES += $(SOURCES_FF)
endif
ifneq (,$(findstring $(OPT_RESAMPLE), $(CFLAGS)))
SOURCES += $(SOURCES_RESAMPLE)
endif
ifneq (,$(findstring $(OPT_VIS), $(CFLAGS)))
SOURCES += $(SOURCES_VIS)
endif
ifneq (,$(findstring $(OPT_IR), $(CFLAGS)))
SOURCES += $(SOURCES_IR)
endif
# add optional link options
ifneq (,$(findstring $(OPT_LINKALL), $(CFLAGS)))
LDFLAGS += $(LINKALL)
ifneq (,$(findstring $(OPT_FF), $(CFLAGS)))
LDFLAGS += $(LINKALL_FF)
endif
ifneq (,$(findstring $(OPT_RESAMPLE), $(CFLAGS)))
LDFLAGS += $(LINKALL_RESAMPLE)
endif
ifneq (,$(findstring $(OPT_IR), $(CFLAGS)))
LDFLAGS += $(LINKALL_IR)
endif
else
# if not LINKALL and linux add LINK_LINUX
ifeq ($(UNAME), Linux)
LDFLAGS += $(LINK_LINUX)
endif
endif
OBJECTS = $(SOURCES:.c=.o)
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
$(OBJECTS): $(DEPS)
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) $< -c -o $@
clean:
rm -f $(OBJECTS) $(EXECUTABLE)