synced with r24386
[mplayer/glamo.git] / Makefile
blob13ecdff1e3b73f5c50bf3f72cb8e8f3e61be888b
1 # LINUX Makefile made by A'rpi / Astral
2 # Some cleanup by LGB: * 'make -C dir' instead of 'cd dir;make;cd..'
3 # * for loops instead of linear sequence of make directories
4 # * some minor problems with make clean and distclean were corrected
5 # * DVD support
7 include config.mak
9 COMMON_LDFLAGS += $(EXTRA_LIB)\
10 $(EXTRALIBS) \
12 LDFLAGS_MPLAYER = $(EXTRALIBS_MPLAYER) \
13 $(COMMON_LDFLAGS) \
15 LDFLAGS_MENCODER = $(EXTRALIBS_MENCODER) \
16 $(COMMON_LDFLAGS) \
18 SRCS_COMMON = asxparser.c \
19 codec-cfg.c \
20 cpudetect.c \
21 edl.c \
22 find_sub.c \
23 get_path.c \
24 m_config.c \
25 m_option.c \
26 m_struct.c \
27 mpcommon.c \
28 parser-cfg.c \
29 playtree.c \
30 playtreeparser.c \
31 spudec.c \
32 sub_cc.c \
33 subreader.c \
34 vobsub.c \
36 SRCS_COMMON-$(UNRARLIB) += unrarlib.c
38 SRCS_MPLAYER = mplayer.c \
39 m_property.c \
40 mp_fifo.c \
41 mp_msg.c \
42 mixer.c \
43 parser-mpcmd.c \
44 subopt-helper.c \
45 command.c \
47 SRCS_MENCODER = mencoder.c \
48 mp_msg-mencoder.c \
49 parser-mecmd.c \
50 xvid_vbr.c \
52 COMMON_LIBS = libmpcodecs/libmpcodecs.a \
53 libaf/libaf.a \
54 libmpdemux/libmpdemux.a \
55 stream/stream.a \
56 libswscale/libswscale.a \
57 libvo/libosd.a \
59 COMMON_LIBS-$(LIBAVFORMAT_A) += libavformat/libavformat.a
60 COMMON_LIBS-$(LIBAVCODEC_A) += libavcodec/libavcodec.a
61 COMMON_LIBS-$(LIBAVUTIL_A) += libavutil/libavutil.a
62 COMMON_LIBS-$(LIBPOSTPROC_A) += libpostproc/libpostproc.a
63 COMMON_LIBS-$(WIN32DLL) += loader/libloader.a
64 COMMON_LIBS-$(MP3LIB) += mp3lib/libmp3.a
65 COMMON_LIBS-$(LIBA52) += liba52/liba52.a
66 COMMON_LIBS-$(LIBMPEG2) += libmpeg2/libmpeg2.a
67 COMMON_LIBS-$(FAAD_INTERNAL) += libfaad2/libfaad2.a
68 COMMON_LIBS-$(TREMOR_INTERNAL) += tremor/libvorbisidec.a
69 COMMON_LIBS-$(DVDREAD_INTERNAL) += dvdread/libdvdread.a
70 COMMON_LIBS-$(DVDCSS_INTERNAL) += libdvdcss/libdvdcss.a
71 COMMON_LIBS-$(ASS) += libass/libass.a
73 LIBS_MPLAYER = libvo/libvo.a \
74 libao2/libao2.a \
75 input/libinput.a \
77 LIBS_MPLAYER-$(VIDIX) += vidix/libvidix.a
78 LIBS_MPLAYER-$(GUI) += gui/libgui.a
79 LIBS_MPLAYER-$(LIBMENU) += libmenu/libmenu.a
81 LIBS_MENCODER = libmpcodecs/libmpencoders.a \
82 libmpdemux/libmpmux.a \
84 # Having this in libosdep.a is not enough.
85 OBJS_MPLAYER-$(TARGET_WIN32) += osdep/mplayer-rc.o
87 ALL_PRG-$(MPLAYER) += mplayer$(EXESUF)
88 ALL_PRG-$(MENCODER) += mencoder$(EXESUF)
90 COMMON_LIBS += $(COMMON_LIBS-yes)
91 LIBS_MPLAYER += $(LIBS_MPLAYER-yes)
92 OBJS_MPLAYER += $(OBJS_MPLAYER-yes)
93 PARTS += $(PARTS-yes)
94 ALL_PRG += $(ALL_PRG-yes)
96 COMMON_LIBS += osdep/libosdep.a
98 MPLAYER_DEPS = $(OBJS_MPLAYER) $(OBJS_COMMON) $(LIBS_MPLAYER) $(COMMON_LIBS)
99 MENCODER_DEPS = $(OBJS_MENCODER) $(OBJS_COMMON) $(LIBS_MENCODER) $(COMMON_LIBS)
101 INSTALL_TARGETS-$(MPLAYER) += install-mplayer install-mplayer-man
102 INSTALL_TARGETS-$(MENCODER) += install-mencoder install-mplayer-man
103 INSTALL_TARGETS-$(GUI) += install-gui
104 INSTALL_TARGETS += $(INSTALL_TARGETS-yes)
106 PARTS = dvdread \
107 gui \
108 input \
109 liba52 \
110 libaf \
111 libao2 \
112 libass \
113 libavcodec \
114 libavformat \
115 libavutil \
116 libdvdcss \
117 libfaad2 \
118 libmenu \
119 libmpcodecs \
120 libmpdemux \
121 libmpeg2 \
122 libpostproc \
123 libswscale \
124 libvo \
125 loader \
126 mp3lib \
127 osdep \
128 stream \
129 tremor \
130 vidix \
133 all: $(ALL_PRG)
135 dep depend:: help_mp.h version.h codecs.conf.h
136 @for a in $(PARTS); do $(MAKE) -C $$a dep; done
138 include mpcommon.mak
140 CFLAGS := $(subst -I..,-I.,$(CFLAGS))
142 libaf/libaf.a:
143 $(MAKE) -C libaf
145 dvdread/libdvdread.a:
146 $(MAKE) -C dvdread
148 libdvdcss/libdvdcss.a:
149 $(MAKE) -C libdvdcss
151 loader/libloader.a:
152 $(MAKE) -C loader
154 libass/libass.a:
155 $(MAKE) -C libass
157 libmpdemux/libmpdemux.a:
158 $(MAKE) -C libmpdemux libmpdemux.a
160 libmpdemux/libmpmux.a:
161 $(MAKE) -C libmpdemux libmpmux.a
163 stream/stream.a:
164 $(MAKE) -C stream
166 libmpcodecs/libmpcodecs.a:
167 $(MAKE) -C libmpcodecs
169 libavutil/libavutil.a:
170 $(MAKE) -C libavutil
172 libavcodec/libavcodec.a:
173 $(MAKE) -C libavcodec
175 libpostproc/libpostproc.a:
176 $(MAKE) -C libpostproc
178 libavformat/libavformat.a:
179 $(MAKE) -C libavformat
181 libswscale/libswscale.a:
182 $(MAKE) -C libswscale
184 libmpeg2/libmpeg2.a:
185 $(MAKE) -C libmpeg2
187 libvo/libvo.a:
188 $(MAKE) -C libvo libvo.a
190 libvo/libosd.a:
191 $(MAKE) -C libvo libosd.a
193 libao2/libao2.a:
194 $(MAKE) -C libao2
196 liba52/liba52.a:
197 $(MAKE) -C liba52
199 libfaad2/libfaad2.a:
200 $(MAKE) -C libfaad2
202 mp3lib/libmp3.a:
203 $(MAKE) -C mp3lib
205 tremor/libvorbisidec.a:
206 $(MAKE) -C tremor
208 vidix/libvidix.a:
209 $(MAKE) -C vidix
211 gui/libgui.a:
212 $(MAKE) -C gui
214 osdep/libosdep.a:
215 $(MAKE) -C osdep
217 osdep/mplayer-rc.o: version.h
218 $(MAKE) -C osdep mplayer-rc.o
220 input/libinput.a:
221 $(MAKE) -C input
223 libmenu/libmenu.a:
224 $(MAKE) -C libmenu
226 mplayer$(EXESUF): $(MPLAYER_DEPS)
227 $(CC) -o $@ $^ $(LDFLAGS_MPLAYER)
229 mencoder$(EXESUF): $(MENCODER_DEPS)
230 $(CC) -o $@ $^ $(LDFLAGS_MENCODER)
232 codec-cfg$(EXESUF): codec-cfg.c codec-cfg.h help_mp.h
233 $(HOST_CC) -I. -DCODECS2HTML $< -o $@
235 codecs.conf.h: codec-cfg$(EXESUF) etc/codecs.conf
236 ./codec-cfg$(EXESUF) ./etc/codecs.conf > $@
238 codec-cfg.o: codecs.conf.h
240 codecs2html$(EXESUF): mp_msg.o
241 $(CC) -DCODECS2HTML codec-cfg.c $^ -o $@
243 codec-cfg-test$(EXESUF): codecs.conf.h codec-cfg.h mp_msg.o osdep/getch2.o
244 $(CC) -I. -DTESTING codec-cfg.c mp_msg.o osdep/getch2.o -ltermcap -o $@
246 install: install-dirs $(INSTALL_TARGETS)
248 install-dirs:
249 $(INSTALL) -d $(BINDIR)
250 $(INSTALL) -d $(DATADIR)
251 $(INSTALL) -d $(MANDIR)/man1
252 $(INSTALL) -d $(CONFDIR)
253 if test -f $(CONFDIR)/codecs.conf ; then mv -f $(CONFDIR)/codecs.conf $(CONFDIR)/codecs.conf.old ; fi
255 install-mplayer: mplayer$(EXESUF)
256 $(INSTALL) -m 755 $(INSTALLSTRIP) mplayer$(EXESUF) $(BINDIR)
258 install-mplayer-man:
259 for i in $(MAN_LANG); do \
260 if test "$$i" = en ; then \
261 $(INSTALL) -c -m 644 DOCS/man/en/mplayer.1 $(MANDIR)/man1/ ; \
262 else \
263 $(INSTALL) -d $(MANDIR)/$$i/man1 ; \
264 $(INSTALL) -c -m 644 DOCS/man/$$i/mplayer.1 $(MANDIR)/$$i/man1/ ; \
265 fi ; \
266 done
268 install-mencoder: mencoder$(EXESUF)
269 $(INSTALL) -m 755 $(INSTALLSTRIP) mencoder$(EXESUF) $(BINDIR)
270 for i in $(MAN_LANG); do \
271 if test "$$i" = en ; then \
272 cd $(MANDIR)/man1 && ln -sf mplayer.1 mencoder.1 ; \
273 else \
274 cd $(MANDIR)/$$i/man1 && ln -sf mplayer.1 mencoder.1 ; \
275 fi ; \
276 done
278 install-gui:
279 -ln -sf mplayer$(EXESUF) $(BINDIR)/gmplayer$(EXESUF)
280 $(INSTALL) -d $(DATADIR)/skins
281 @echo "*** Download skin(s) at http://www.mplayerhq.hu/design7/dload.html"
282 @echo "*** for GUI, and extract to $(DATADIR)/skins/"
283 $(INSTALL) -d $(prefix)/share/pixmaps
284 $(INSTALL) -m 644 etc/mplayer.xpm $(prefix)/share/pixmaps/
285 $(INSTALL) -d $(prefix)/share/applications
286 $(INSTALL) -m 644 etc/mplayer.desktop $(prefix)/share/applications/
288 uninstall:
289 -rm -f $(BINDIR)/mplayer$(EXESUF) $(BINDIR)/gmplayer$(EXESUF)
290 -rm -f $(BINDIR)/mencoder$(EXESUF)
291 -rm -f $(MANDIR)/man1/mencoder.1 $(MANDIR)/man1/mplayer.1
292 -rm -f $(prefix)/share/pixmaps/mplayer.xpm
293 -rm -f $(prefix)/share/applications/mplayer.desktop
294 for l in $(MAN_LANG); do \
295 if test "$$l" != "en"; then \
296 rm -f $(MANDIR)/$$l/man1/mplayer.1 \
297 $(MANDIR)/$$l/man1/mencoder.1 \
298 $(MANDIR)/$$l/man1/gmplayer.1 ; \
299 fi ; \
300 done
302 clean::
303 -rm -f mplayer$(EXESUF) mencoder$(EXESUF) codec-cfg$(EXESUF) \
304 codecs2html$(EXESUF) codec-cfg-test$(EXESUF) cpuinfo$(EXESUF) \
305 codecs.conf.h help_mp.h version.h
306 @for a in $(PARTS); do $(MAKE) -C $$a clean; done
308 distclean:: doxygen_clean
309 @for a in $(PARTS); do $(MAKE) -C $$a distclean; done
310 $(MAKE) -C TOOLS distclean
311 -rm -f configure.log config.mak config.h
313 strip:
314 strip -s $(ALL_PRG)
316 # ./configure must be rerun if it changed
317 config.mak: configure
318 @echo "############################################################"
319 @echo "####### Please run ./configure again - it's changed! #######"
320 @echo "############################################################"
322 # rebuild at every config.h/config.mak/Makefile change:
323 version.h: config.h config.mak Makefile
324 ./version.sh `$(CC) -dumpversion`
326 doxygen:
327 doxygen DOCS/tech/Doxyfile
329 doxygen_clean:
330 -rm -rf DOCS/tech/doxygen
332 help_mp.h: help/help_mp-en.h $(HELP_FILE)
333 @echo '// WARNING! This is a generated file. Do NOT edit.' > help_mp.h
334 @echo '// See the help/ subdir for the editable files.' >> help_mp.h
335 ifeq ($(CHARSET),)
336 @echo '#include "$(HELP_FILE)"' >> help_mp.h
337 else
338 iconv -f UTF-8 -t $(CHARSET) "$(HELP_FILE)" >> help_mp.h
339 endif
341 ifneq ($(HELP_FILE),help/help_mp-en.h)
342 @echo "Adding untranslated messages to help_mp.h"
343 @echo '// untranslated messages from the English master file:' >> help_mp.h
344 @help/help_diff.sh $(HELP_FILE) < help/help_mp-en.h >> help_mp.h
345 endif
347 # explicit dependencies to force version.h to be built even if .depend is missing
348 mplayer.o mencoder.o vobsub.o: version.h
350 # temporary measure to make sure help_mp.h is built. we desperately need correct deps!
351 $(MPLAYER_DEPS) $(MENCODER_DEPS): help_mp.h
354 # the following lines provide _partial_ dependency information
355 # for the 'library' directories under main dir, in order to cause
356 # the build process to recursively descend into them if something
357 # has changed. ideally this will be replaced with a single
358 # nonrecursive makefile for the whole project.
360 # Now all directories are recursed by default because these rules do not
361 # consider dependencies on files in other directories, while the recursively
362 # invoked Makefiles do. Conditional recursion only to the directories with
363 # changed files can be enabled by creating a file named ".norecurse" and
364 # optionally giving it a timestamp in the past. Directories whose .a files
365 # are newer than the timestamp and newer than other files in the directory
366 # will not be recursed.
367 .norecurse:
369 libvo/libvo.a: .norecurse $(wildcard libvo/*.[ch])
370 libvo/libosd.a: .norecurse $(wildcard libvo/*.[ch])
371 libao2/libao2.a: .norecurse $(wildcard libao2/*.[ch])
372 osdep/libosdep.a: .norecurse $(wildcard osdep/*.[ch])
373 input/libinput.a: .norecurse $(wildcard input/*.[ch])
375 libmenu/libmenu.a: .norecurse $(wildcard libmenu/*.[ch])
376 libaf/libaf.a: .norecurse $(wildcard libaf/*.[ch])
377 dvdread/libdvdread.a: .norecurse $(wildcard dvdread/*.[ch])
378 libdvdcss/libdvdcss.a: .norecurse $(wildcard libdvdcss/*.[ch])
380 libmpdemux/libmpdemux.a: .norecurse $(wildcard libmpdemux/*.[ch])
381 libmpdemux/libmpmux.a: .norecurse $(wildcard libmpdemux/*.[ch])
382 stream/stream.a: .norecurse $(wildcard stream/*.[ch] stream/*/*.[ch])
383 libmpcodecs/libmpcodecs.a: .norecurse $(wildcard libmpcodecs/*.[ch]) $(wildcard libmpcodecs/native/*.[ch])
384 libmpcodecs/libmpencoders.a: .norecurse $(wildcard libmpcodecs/*.[ch])
386 libavutil/libavutil.a: .norecurse $(wildcard libavutil/*.[ch])
387 libavcodec/libavcodec.a: .norecurse $(wildcard libavcodec/*.[ch] libavcodec/*/*.[chS])
388 libavformat/libavformat.a: .norecurse $(wildcard libavformat/*.[ch])
389 libswscale/libswscale.a: .norecurse $(wildcard libswscale/*.[ch])
391 libmpeg2/libmpeg2.a: .norecurse $(wildcard libmpeg2/*.[ch])
392 liba52/liba52.a: .norecurse $(wildcard liba52/*.[ch])
393 mp3lib/libmp3.a: .norecurse $(wildcard mp3lib/*.[ch])
394 libfaad2/libfaad2.a: .norecurse $(wildcard libfaad2/*.[ch] libfaad2/*/*.[ch])
396 loader/libloader.a: .norecurse $(wildcard loader/*.[chSs])
397 vidix/libvidix.a: .norecurse $(wildcard vidix/*.[ch])
398 gui/libgui.a: .norecurse $(wildcard gui/*.[ch] gui/*/*.[ch] gui/*/*/*.[ch])
400 libass/libass.a: .norecurse $(wildcard libass/*.[ch])
402 .PHONY: all install* uninstall strip doxygen doxygen_clean