2 exec_prefix := @
exec_prefix@
5 VARDIR
:= /var
/paraslash
6 MANDIR
:= @datarootdir@
/man
/man1
7 PACKAGE_TARNAME
:= @PACKAGE_TARNAME@
8 PACKAGE_VERSION
:= @PACKAGE_VERSION@
10 STRIP
:= $(CROSS_COMPILE
)strip
12 executables
:= @executables@
13 ggo_descriptions_declared
:= @ggo_descriptions_declared@
14 object_executable_matrix
:= @object_executable_matrix@
17 GENGETOPT
:= @gengetopt@
18 HELP2MAN
:= @help2man@
21 recv_objs
:= @recv_objs@
22 filter_objs
:= @filter_objs@
23 client_objs
:= @client_objs@
24 gui_objs
:= @gui_objs@
25 audiod_objs
:= @audiod_objs@
26 audioc_objs
:= @audioc_objs@
27 fade_objs
:= @fade_objs@
28 server_objs
:= @server_objs@
29 write_objs
:= @write_objs@
30 afh_objs
:= @afh_objs@
31 play_objs
:= @play_objs@
33 speex_cppflags
:= @speex_cppflags@
34 opus_cppflags
:= @opus_cppflags@
35 arch_cppflags
:= @arch_cppflags@
36 osl_cppflags
:= @osl_cppflags@
37 id3tag_cppflags
:= @id3tag_cppflags@
38 openssl_cppflags
:= @openssl_cppflags@
39 ogg_cppflags
:= @ogg_cppflags@
40 mad_cppflags
:= @mad_cppflags@
41 faad_cppflags
:= @faad_cppflags@
42 curses_cppflags
:= @curses_cppflags@
43 ao_cppflags
:= @ao_cppflags@
45 clock_gettime_ldflags
:= @clock_gettime_ldflags@
46 id3tag_ldflags
:= @id3tag_ldflags@
47 ogg_ldflags
:= @ogg_ldflags@
48 vorbis_ldflags
:= @vorbis_ldflags@
49 speex_ldflags
:= @speex_ldflags@
50 opus_ldflags
:= @opus_ldflags@
51 faad_ldflags
:= @faad_ldflags@
52 mad_ldflags
:= @mad_ldflags@
53 flac_ldflags
:= @flac_ldflags@
54 oss_ldflags
:= @oss_ldflags@
55 alsa_ldflags
:= @alsa_ldflags@
56 ao_ldflags
:= @ao_ldflags@
57 readline_ldflags
:= @readline_ldflags@
58 samplerate_ldflags
:= @samplerate_ldflags@
59 osl_ldflags
:= @osl_ldflags@
60 openssl_ldflags
:= @openssl_ldflags@
61 gcrypt_ldflags
:= @gcrypt_ldflags@
62 socket_ldflags
:= @socket_ldflags@
63 nsl_ldflags
:= @nsl_ldflags@
64 curses_ldflags
:= @curses_ldflags@
65 core_audio_ldflags
:= @core_audio_ldflags@
67 prefixed_executables
:= $(addprefix para_
, $(executables
))
69 build_date
:= $(shell date
)
70 uname_s
:= $(shell uname
-s
2>/dev
/null || echo
"UNKNOWN_OS")
71 uname_rs
:= $(shell uname
-rs
)
72 cc_version
:= $(shell $(CC
) --version | head
-n
1)
74 GIT_VERSION
:= $(shell .
/GIT-VERSION-GEN git-version.h
)
76 m4_ggo_dir
:= m4
/gengetopt
78 ifeq ("$(origin O)", "command line")
83 ggo_dir
:= $(build_dir
)/ggo
84 object_dir
:= $(build_dir
)/objects
85 dep_dir
:= $(build_dir
)/deps
86 man_dir
:= $(build_dir
)/man
/man1
87 cmdline_dir
:= $(build_dir
)/cmdline
88 m4depdir
:= $(build_dir
)/m4deps
89 help2man_dir
:= $(build_dir
)/help2man
90 hostbin_dir
:= $(build_dir
)/host
/bin
92 # sort removes duplicate words, which is all we need here
93 all_objs
:= $(sort $(recv_objs
) $(filter_objs
) $(client_objs
) $(gui_objs
) \
94 $(audiod_objs
) $(audioc_objs
) $(fade_objs
) $(server_objs
) \
95 $(write_objs
) $(afh_objs
) $(play_objs
))
96 deps
:= $(addprefix $(dep_dir
)/, $(all_objs
:.o
=.d
))
97 m4_deps
:= $(addprefix $(m4depdir
)/, $(addsuffix .m4d
, $(executables
)))
99 # now prefix all objects with object dir
100 recv_objs
:= $(addprefix $(object_dir
)/, $(recv_objs
))
101 filter_objs
:= $(addprefix $(object_dir
)/, $(filter_objs
))
102 client_objs
:= $(addprefix $(object_dir
)/, $(client_objs
))
103 gui_objs
:= $(addprefix $(object_dir
)/, $(gui_objs
))
104 audiod_objs
:= $(addprefix $(object_dir
)/, $(audiod_objs
))
105 audioc_objs
:= $(addprefix $(object_dir
)/, $(audioc_objs
))
106 fade_objs
:= $(addprefix $(object_dir
)/, $(fade_objs
))
107 server_objs
:= $(addprefix $(object_dir
)/, $(server_objs
))
108 write_objs
:= $(addprefix $(object_dir
)/, $(write_objs
))
109 afh_objs
:= $(addprefix $(object_dir
)/, $(afh_objs
))
110 play_objs
:= $(addprefix $(object_dir
)/, $(play_objs
))
113 DEBUG_CPPFLAGS
+= -g
-Wunused
-Wundef
-W
114 DEBUG_CPPFLAGS
+= -Wredundant-decls
115 DEBUG_CPPFLAGS
+= -Wall
-Wno-sign-compare
-Wno-unknown-pragmas
116 DEBUG_CPPFLAGS
+= -Wformat-security
117 DEBUG_CPPFLAGS
+= -Wmissing-format-attribute
119 ifeq ($(uname_s
),Linux
)
120 CPPFLAGS
+= -fdata-sections
-ffunction-sections
121 LDFLAGS
+= -Wl
,--gc-sections
122 CPPFLAGS
+= -Wstrict-prototypes
124 # causes warnings on *BSD for the feature test macros
125 CPPFLAGS
+= -Wunused-macros
128 CPPFLAGS
+= -Wuninitialized
129 CPPFLAGS
+= -Wchar-subscripts
130 CPPFLAGS
+= -DBINDIR
='"$(BINDIR)"'
131 CPPFLAGS
+= -DBUILD_DATE
='"$(build_date)"'
132 CPPFLAGS
+= -DUNAME_RS
='"$(uname_rs)"'
133 CPPFLAGS
+= -DCC_VERSION
='"$(cc_version)"'
134 CPPFLAGS
+= -Werror-implicit-function-declaration
135 CPPFLAGS
+= -Wmissing-noreturn
136 CPPFLAGS
+= -Wbad-function-cast
137 CPPFLAGS
+= -fno-strict-aliasing
138 CPPFLAGS
+= -DMAIN_INPUT_FILE_IS_
$(*F
)
139 CPPFLAGS
+= $(arch_cppflags
)
140 CPPFLAGS
+= -I
/usr
/local
/include
141 CPPFLAGS
+= -I
$(cmdline_dir
)
142 CPPFLAGS
+= $(osl_cppflags
)
144 LDFLAGS
+= $(clock_gettime_ldflags
)
146 man_pages
:= $(patsubst %, $(man_dir
)/%.1, $(prefixed_executables
))
148 autocrap
:= config.h.in configure
149 tarball_pfx
:= $(PACKAGE_TARNAME
)-$(PACKAGE_VERSION
)
150 tarball_delete
:= $(addprefix $(tarball_pfx
)/,\
151 web .changelog_before_cvs .changelog_cvs .gitignore
)
152 tarball
:= $(tarball_pfx
).
tar.bz2
154 # To put more focus on warnings, be less verbose as default
155 # Use 'make V=1' to see the full commands
156 ifeq ("$(origin V)", "command line")
162 .PHONY
: dep
all clean distclean maintainer-clean
install man tarball
163 all: dep
$(prefixed_executables
) $(man_pages
)
168 $(object_dir
) $(man_dir
) $(ggo_dir
) $(cmdline_dir
) $(dep_dir
) $(m4depdir
) \
169 $(help2man_dir
) $(hostbin_dir
):
172 -include $(m4_ggo_dir
)/makefile
174 # When in doubt, use brute force (Ken Thompson)
176 $(subst a
,A
,$(subst b
,B
,$(subst c
,C
,$(subst d
,D
,$(subst e
,E
,\
177 $(subst f
,F
,$(subst g
,G
,$(subst h
,H
,$(subst i
,I
,$(subst j
,J
,\
178 $(subst k
,K
,$(subst l
,L
,$(subst m
,M
,$(subst n
,N
,$(subst o
,O
,\
179 $(subst p
,P
,$(subst q
,Q
,$(subst r
,R
,$(subst s
,S
,$(subst t
,T
,\
180 $(subst u
,U
,$(subst v
,V
,$(subst w
,W
,$(subst x
,X
,$(subst y
,Y
,\
181 $(subst z
,Z
,$1))))))))))))))))))))))))))
183 %_command_list.h
: %.cmd
%.c
184 @
[ -z
"$(Q)" ] || echo
'GEN $@'
185 $(Q
) .
/command_util.sh h
< $< >$@
186 %_command_list.man
: %.cmd
%.c
187 @
[ -z
"$(Q)" ] || echo
'GEN $@'
188 $(Q
) .
/command_util.sh man
< $< > $@
189 %_completion.h
: %.cmd
%.c
190 @
[ -z
"$(Q)" ] || echo
'GEN $@'
191 $(Q
) .
/command_util.sh compl
$(strip $(call TOUPPER
,$(*F
)))_COMPLETERS \
192 $(strip $(call TOUPPER
,$(*F
)))_COMMANDS
< $< > $@
194 server_command_list.h server_command_list.man server_completion.h
: command.c
195 afs_command_list.h afs_command_list.man afs_completion.h
: afs.c aft.c attribute.c
196 audiod_command_list.h audiod_command_list.man audiod_completion.h
: audiod_command.c
198 server_command_lists_man
= server_command_list.man afs_command_list.man
199 $(man_dir
)/para_server
.1: $(help2man_dir
)/para_server
$(server_command_lists_man
) |
$(man_dir
)
200 @
[ -z
"$(Q)" ] || echo
'MAN $<'
201 $(Q
) opts
="`for i in $(server_command_lists_man); do printf "%s
\n" "-i
$$i"; done`"; \
202 $(HELP2MAN
) $$opts .
/$< > $@
204 $(man_dir
)/para_audiod
.1: $(help2man_dir
)/para_audiod audiod_command_list.man |
$(man_dir
)
205 @
[ -z
"$(Q)" ] || echo
'MAN $<'
206 $(Q
) $(HELP2MAN
) -N
-i audiod_command_list.man .
/$< > $@
208 $(man_dir
)/para_play
.1: $(help2man_dir
)/para_play play_command_list.man |
$(man_dir
)
209 @
[ -z
"$(Q)" ] || echo
'MAN $<'
210 $(Q
) $(HELP2MAN
) -N
-i play_command_list.man .
/$< > $@
212 $(man_dir
)/%.1: $(help2man_dir
)/% |
$(man_dir
)
213 @
[ -z
"$(Q)" ] || echo
'MAN $<'
214 $(Q
) $(HELP2MAN
) -N .
/$< > $@
216 $(hostbin_dir
)/error2
: error2.c |
$(hostbin_dir
)
217 @
[ -z
"$(Q)" ] || echo
'HCC $<'
218 $(Q
) $(HOSTCC
) -o
$@
$<
219 error2.h
: $(hostbin_dir
)/error2
220 @
[ -z
"$(Q)" ] || echo
'ER2 $<'
221 @echo
"$(object_executable_matrix)" |
$< > $@
223 $(object_dir
)/%.o
: %.c |
$(object_dir
)
224 $(object_dir
)/opus
%.o
: CPPFLAGS
+= $(opus_cppflags
)
225 $(object_dir
)/gui
%.o
: CPPFLAGS
+= $(curses_cppflags
)
226 $(object_dir
)/spx
%.o
: CPPFLAGS
+= $(speex_cppflags
)
227 $(object_dir
)/%.cmdline.o
: CPPFLAGS
+= -Wno-unused-function
229 $(object_dir
)/mp3_afh.o
: CPPFLAGS
+= $(id3tag_cppflags
)
230 $(object_dir
)/crypt.o
: CPPFLAGS
+= $(openssl_cppflags
)
231 $(object_dir
)/mp3dec_filter.o
: CPPFLAGS
+= $(mad_cppflags
)
232 $(object_dir
)/compress_filter.o
: CPPFLAGS
+= -O3
233 $(object_dir
)/ao_write.o
: CPPFLAGS
+= $(ao_cppflags
)
235 $(object_dir
)/aacdec_filter.o \
236 $(object_dir
)/aac_common.o \
237 $(object_dir
)/aac_afh.o \
238 : CPPFLAGS
+= $(faad_cppflags
)
240 $(object_dir
)/spx_common.o \
241 $(object_dir
)/spxdec_filter.o \
242 $(object_dir
)/spx_afh.o \
243 $(object_dir
)/oggdec_filter.o \
244 $(object_dir
)/ogg_afh.o \
245 $(object_dir
)/ogg_afh_common.o \
246 : CPPFLAGS
+= $(ogg_cppflags
)
248 $(object_dir
)/%.o
: %.c |
$(object_dir
)
249 @
[ -z
"$(Q)" ] || echo
'CC $<'
250 $(Q
) $(CC
) -c
-o
$@
$(CPPFLAGS
) $(DEBUG_CPPFLAGS
) $<
252 $(object_dir
)/%.cmdline.o
: $(cmdline_dir
)/%.cmdline.c
$(cmdline_dir
)/%.cmdline.h |
$(object_dir
)
253 @
[ -z
"$(Q)" ] || echo
'CC $<'
254 $(Q
) $(CC
) -c
$(CPPFLAGS
) -Wno-unused-function
-o
$@
$<
256 $(object_dir
)/%.o
: %.c |
$(object_dir
)
257 @
[ -z
"$(Q)" ] || echo
'CC $<'
258 $(Q
) $(CC
) -c
-o
$@
$(CPPFLAGS
) $(DEBUG_CPPFLAGS
) $<
260 $(dep_dir
)/%.cmdline.d
: $(cmdline_dir
)/%.cmdline.c |
$(dep_dir
)
261 @
[ -z
"$(Q)" ] || echo
'DEP $<'
262 $(Q
) .
/depend.sh
$(dep_dir
) $(object_dir
) $(cmdline_dir
) \
265 $(dep_dir
)/%.d
: %.c |
$(dep_dir
)
266 @
[ -z
"$(Q)" ] || echo
'DEP $<'
267 $(Q
) .
/depend.sh
$(dep_dir
) $(object_dir
) $(cmdline_dir
) \
270 ifeq ($(findstring clean, $(MAKECMDGOALS
)),)
275 para_recv para_afh para_play para_server
: LDFLAGS
+= $(id3tag_ldflags
)
276 para_write para_play para_audiod
: LDFLAGS
+= $(ao_ldflags
) $(core_audio_ldflags
)
277 para_client para_audioc para_play
: LDFLAGS
+= $(readline_ldflags
)
278 para_server
: LDFLAGS
+= $(osl_ldflags
)
279 para_gui
: LDFLAGS
+= $(curses_ldflags
)
292 $(samplerate_ldflags
) \
323 $(socket_ldflags
) $(nsl_ldflags
)
325 $(foreach exe
,$(executables
),$(eval para_
$(exe
): $$($(exe
)_objs
)))
326 $(prefixed_executables
):
327 @
[ -z
"$(Q)" ] || echo
'LD $@'
328 $(Q
) $(CC
) $^
-o
$@
$(LDFLAGS
)
331 @
[ -z
"$(Q)" ] || echo
'CLEAN'
332 $(Q
) rm -f
$(prefixed_executables
)
333 $(Q
) rm -rf
$(object_dir
)
336 @
[ -z
"$(Q)" ] || echo
'CLEAN2'
337 $(Q
) rm -f
*_command_list.
* *_completion.h
338 $(Q
) rm -rf
$(build_dir
)
339 distclean: clean2 test-clean
340 @
[ -z
"$(Q)" ] || echo
'DISTCLEAN'
341 $(Q
) rm -f Makefile autoscan.log config.status config.log
342 $(Q
) rm -rf autom4te.cache
343 $(Q
) rm -f GPATH GRTAGS GSYMS GTAGS
345 maintainer-clean
: distclean
346 rm -f
*.
tar.bz2 config.h configure config.h.in
350 $(MKDIR_P
) $(BINDIR
) $(MANDIR
)
351 $(INSTALL
) -s
--strip-program
$(STRIP
) -m
755 \
352 $(prefixed_executables
) $(BINDIR
)
353 $(INSTALL
) -m
644 $(man_pages
) $(MANDIR
)
354 $(MKDIR_P
) $(VARDIR
) >/dev
/null
2>&1 || true
# not fatal, so don't complain
357 rm -rf
$(tarball_pfx
).
tar.bz2
$(tarball_pfx
)
358 git archive
--format
=tar --prefix=$(tarball_pfx
)/ HEAD \
359 |
tar --delete
$(tarball_delete
) > $(tarball_pfx
).
tar
360 $(MKDIR_P
) $(tarball_pfx
)
361 .
/GIT-VERSION-GEN
> $(tarball_pfx
)/VERSION
362 cp
-r
$(autocrap
) $(tarball_pfx
)
363 tar rf
$(tarball_pfx
).
tar $(tarball_pfx
)/*
364 bzip2
-9 $(tarball_pfx
).
tar
365 ls
-l
$(tarball_pfx
).
tar.bz2
366 rm -rf
$(tarball_pfx
)
367 include $(test_dir
)/makefile.
test