synced with r20119
[mplayer/glamo.git] / Makefile
blob98c8c6aad6e515503a19611caf53cb3e171d5133
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 LIBAV_INC =
10 ifeq ($(CONFIG_LIBAVUTIL),yes)
11 LIBAV_INC += -I./libavutil
12 endif
13 ifeq ($(CONFIG_LIBAVCODEC),yes)
14 LIBAV_INC += -I./libavcodec
15 endif
17 CFLAGS = $(OPTFLAGS) -I. $(LIBAV_INC)
19 #CFLAGS += -Wall
21 # Do not strip the binaries at installation
22 ifeq ($(STRIPBINARIES),yes)
23 INSTALLSTRIP = -s
24 endif
26 SRCS_COMMON = asxparser.c \
27 codec-cfg.c \
28 cpudetect.c \
29 edl.c \
30 find_sub.c \
31 m_config.c \
32 m_option.c \
33 m_struct.c \
34 parser-cfg.c \
35 playtree.c \
36 playtreeparser.c \
37 spudec.c \
38 sub_cc.c \
39 subreader.c \
40 vobsub.c \
42 ifeq ($(UNRARLIB),yes)
43 SRCS_COMMON += unrarlib.c
44 endif
46 SRCS_MENCODER = mencoder.c \
47 mp_msg-mencoder.c \
48 $(SRCS_COMMON) \
49 libvo/aclib.c \
50 libvo/osd.c \
51 libvo/sub.c \
52 parser-mecmd.c \
53 xvid_vbr.c \
55 ifeq ($(BITMAP_FONT),yes)
56 SRCS_MENCODER += libvo/font_load.c
57 endif
59 SRCS_MPLAYER = mplayer.c \
60 m_property.c \
61 mp_msg.c \
62 $(SRCS_COMMON) \
63 mixer.c \
64 parser-mpcmd.c \
65 subopt-helper.c \
67 OBJS_MENCODER = $(SRCS_MENCODER:.c=.o)
68 OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o)
70 VO_LIBS = $(AA_LIB) \
71 $(X_LIB) \
72 $(SDL_LIB) \
73 $(GGI_LIB) \
74 $(SVGA_LIB) \
75 $(DIRECTFB_LIB) \
76 $(CACA_LIB) \
77 $(VESA_LIB) \
79 ifeq ($(VIDIX),yes)
80 VO_LIBS += vidix/libvidix.a
81 endif
82 ifeq ($(EXTERNAL_VIDIX),yes)
83 VO_LIBS += $(EXTERNAL_VIDIX_LIB)
84 endif
86 AO_LIBS = $(ARTS_LIB) \
87 $(ESD_LIB) \
88 $(JACK_LIB) \
89 $(OPENAL_LIB) \
90 $(NAS_LIB) \
91 $(SGIAUDIO_LIB) \
92 $(POLYP_LIB) \
94 CODEC_LIBS = $(AV_LIB) \
95 $(FAME_LIB) \
96 $(MAD_LIB) \
97 $(LIBDV_LIB) \
98 $(VORBIS_LIB) \
99 $(THEORA_LIB) \
100 $(FAAD_LIB) \
101 $(LIBLZO_LIB) \
102 $(XVID_LIB) \
103 $(DTS_LIB) \
104 $(PNG_LIB) \
105 $(Z_LIB) \
106 $(JPEG_LIB) \
107 $(ALSA_LIB) \
108 $(XMMS_LIB) \
109 $(X264_LIB) \
110 $(MUSEPACK_LIB) \
111 $(SPEEX_LIB) \
112 $(NUT_LIB) \
114 ifeq ($(LAVC_MP3LAME),yes)
115 CODEC_LIBS += $(MP3LAME_LIB)
116 endif
118 ifeq ($(TOOLAME),yes)
119 CODEC_LIBS += $(TOOLAME_LIB)
120 endif
122 ifeq ($(TWOLAME),yes)
123 CODEC_LIBS += $(TWOLAME_LIB)
124 endif
126 ifeq ($(FAAC),yes)
127 CODEC_LIBS += $(FAAC_LIB)
128 endif
130 COMMON_LIBS = libmpcodecs/libmpcodecs.a \
131 $(W32_LIB) \
132 libaf/libaf.a \
133 libmpdemux/libmpdemux.a \
134 stream/stream.a \
135 libswscale/libswscale.a \
136 osdep/libosdep.a \
137 $(EXTRA_LIB)\
138 $(DVDREAD_LIB) \
139 $(DVDNAV_LIB) \
140 $(CODEC_LIBS) \
141 $(TERMCAP_LIB) \
142 $(CDPARANOIA_LIB) \
143 $(MPLAYER_NETWORK_LIB) \
144 $(LIBCDIO_LIB) \
145 $(WIN32_LIB) \
146 $(MLIB_LIB) \
147 $(GIF_LIB) \
148 $(MACOSX_FRAMEWORKS) \
149 $(SMBSUPPORT_LIB) \
150 $(FRIBIDI_LIB) \
151 $(ENCA_LIB) \
152 $(LIRC_LIB) \
153 $(LIRCC_LIB) \
154 $(ARCH_LIB) \
155 $(MATH_LIB) \
156 $(LIBC_LIB) \
157 $(EXTRALIBS) \
159 PARTS = libmpdemux \
160 stream \
161 libmpcodecs \
162 libavutil \
163 libavcodec \
164 libpostproc \
165 libavformat \
166 libswscale \
167 libao2 \
168 osdep \
169 input \
170 libvo \
171 libaf \
173 ifeq ($(MP3LIB),yes)
174 PARTS += mp3lib
175 endif
176 ifeq ($(LIBA52),yes)
177 PARTS += liba52
178 endif
179 ifeq ($(LIBMPEG2),yes)
180 PARTS += libmpeg2
181 endif
182 ifeq ($(FAAD_INTERNAL),yes)
183 COMMON_LIBS += libfaad2/libfaad2.a
184 PARTS += libfaad2
185 endif
186 ifeq ($(VIDIX),yes)
187 PARTS += libdha vidix
188 endif
189 ifeq ($(FAME),yes)
190 PARTS += libfame
191 endif
192 ifeq ($(DVDKIT2),yes)
193 PARTS += libmpdvdkit2
194 endif
195 ifeq ($(GUI),yes)
196 PARTS += Gui
197 endif
198 ifneq ($(W32_LIB),)
199 PARTS += loader loader/dshow loader/dmo
200 endif
201 ifeq ($(LIBMENU),yes)
202 PARTS += libmenu
203 endif
204 ifeq ($(TREMOR_INTERNAL),yes)
205 PARTS += tremor
206 endif
208 ALL_PRG = $(PRG)
209 ifeq ($(MENCODER),yes)
210 ALL_PRG += $(PRG_MENCODER)
211 endif
213 COMMON_DEPS = $(W32_DEP) \
214 $(AV_DEP) \
215 libmpdemux/libmpdemux.a \
216 stream/stream.a \
217 libmpcodecs/libmpcodecs.a \
218 libao2/libao2.a \
219 osdep/libosdep.a \
220 libswscale/libswscale.a \
221 input/libinput.a \
222 libvo/libvo.a \
223 libaf/libaf.a \
225 ifeq ($(MP3LIB),yes)
226 COMMON_DEPS += mp3lib/libMP3.a
227 COMMON_LIBS += mp3lib/libMP3.a
228 endif
229 ifeq ($(LIBA52),yes)
230 COMMON_DEPS += liba52/liba52.a
231 COMMON_LIBS += liba52/liba52.a
232 endif
233 ifeq ($(LIBMPEG2),yes)
234 COMMON_DEPS += libmpeg2/libmpeg2.a
235 COMMON_LIBS += libmpeg2/libmpeg2.a
236 endif
237 ifeq ($(FAAD_INTERNAL),yes)
238 COMMON_DEPS += libfaad2/libfaad2.a
239 endif
240 ifeq ($(TREMOR_INTERNAL),yes)
241 COMMON_DEPS += tremor/libvorbisidec.a
242 COMMON_LIBS += tremor/libvorbisidec.a
243 endif
244 ifeq ($(VIDIX),yes)
245 COMMON_DEPS += libdha/libdha.so vidix/libvidix.a
246 endif
247 ifeq ($(FAME),yes)
248 COMMON_DEPS += libfame/libfame.a
249 endif
250 ifeq ($(DVDKIT2),yes)
251 COMMON_DEPS += libmpdvdkit2/libmpdvdkit.a
252 endif
253 ifeq ($(CONFIG_ASS),yes)
254 COMMON_DEPS += libass/libass.a
255 COMMON_LIBS += libass/libass.a
256 PARTS += libass
257 endif
258 # FontConfig and FreeType need to come after ASS to avoid link failures on MinGW
259 COMMON_LIBS += $(FONTCONFIG_LIB)
260 ifeq ($(FREETYPE),yes)
261 SRCS_MENCODER += libvo/font_load_ft.c
262 COMMON_LIBS += $(FREETYPE_LIB)
263 endif
264 ifeq ($(GUI),yes)
265 COMMON_DEPS += Gui/libgui.a
266 GUI_LIBS = Gui/libgui.a $(GTK_LIBS)
267 endif
269 .SUFFIXES: .cc .c .o
271 #.PHONY: $(COMMON_DEPS)
273 all: $(ALL_PRG)
275 .c.o:
276 $(CC) -c $(CFLAGS) -o $@ $<
278 libaf/libaf.a:
279 $(MAKE) -C libaf
281 libmpdvdkit2/libmpdvdkit.a:
282 $(MAKE) -C libmpdvdkit2
284 loader/libloader.a:
285 $(MAKE) -C loader
287 libfame/libfame.a:
288 $(MAKE) -C libfame
290 libass/libass.a:
291 $(MAKE) -C libass
293 libmpdemux/libmpdemux.a:
294 $(MAKE) -C libmpdemux
296 stream/stream.a:
297 $(MAKE) -C stream
299 libmpcodecs/libmpcodecs.a:
300 $(MAKE) -C libmpcodecs
302 loader/dshow/libDS_Filter.a:
303 $(MAKE) -C loader/dshow
305 loader/dmo/libDMO_Filter.a:
306 $(MAKE) -C loader/dmo
308 libavutil/libavutil.a:
309 $(MAKE) -C libavutil LIBPREF=lib LIBSUF=.a
311 libavcodec/libavcodec.a:
312 $(MAKE) -C libavcodec LIBPREF=lib LIBSUF=.a
314 libpostproc/libpostproc.a:
315 $(MAKE) -C libpostproc LIBPREF=lib LIBSUF=.a
317 libavformat/libavformat.a:
318 $(MAKE) -C libavformat LIBPREF=lib LIBSUF=.a
320 libswscale/libswscale.a:
321 $(MAKE) -C libswscale LIBPREF=lib LIBSUF=.a
323 libmpeg2/libmpeg2.a:
324 $(MAKE) -C libmpeg2
326 libvo/libvo.a:
327 $(MAKE) -C libvo
329 libao2/libao2.a:
330 $(MAKE) -C libao2
332 liba52/liba52.a:
333 $(MAKE) -C liba52
335 libfaad2/libfaad2.a:
336 $(MAKE) -C libfaad2
338 mp3lib/libMP3.a:
339 $(MAKE) -C mp3lib
341 tremor/libvorbisidec.a:
342 $(MAKE) -C tremor
344 libdha/libdha.so:
345 $(MAKE) -C libdha
347 vidix/libvidix.a: libdha/libdha.so
348 $(MAKE) -C vidix
350 Gui/libgui.a:
351 $(MAKE) -C Gui
353 osdep/libosdep.a:
354 $(MAKE) -C osdep
356 input/libinput.a:
357 $(MAKE) -C input
359 libmenu/libmenu.a:
360 $(MAKE) -C libmenu
362 MPLAYER_DEP = $(OBJS_MPLAYER) $(COMMON_DEPS)
364 ifeq ($(LIBMENU),yes)
365 MPLAYER_DEP += libmenu/libmenu.a
366 MENU_LIBS = libmenu/libmenu.a
367 PARTS += libmenu
368 endif
370 MENCODER_DEP = $(OBJS_MENCODER) $(COMMON_DEPS) libmpcodecs/libmpencoders.a
372 ifeq ($(TARGET_WIN32),yes)
373 OBJS_MPLAYER += osdep/mplayer-rc.o
374 endif
376 LIBS_MPLAYER = libvo/libvo.a \
377 libao2/libao2.a \
378 input/libinput.a \
379 $(MENU_LIBS) \
380 $(GUI_LIBS) \
381 $(COMMON_LIBS) \
382 $(VO_LIBS) \
383 $(AO_LIBS) \
384 $(STATIC_LIB) \
386 $(PRG): $(MPLAYER_DEP)
387 ifeq ($(TARGET_WIN32),yes)
388 windres -o osdep/mplayer-rc.o osdep/mplayer.rc
389 endif
390 $(CC) $(CFLAGS) -o $(PRG) $(OBJS_MPLAYER) $(LIBS_MPLAYER)
392 ifeq ($(MENCODER),yes)
393 LIBS_MENCODER = libmpcodecs/libmpencoders.a \
394 $(MP3LAME_LIB) \
395 $(COMMON_LIBS) \
397 $(PRG_MENCODER): $(MENCODER_DEP)
398 $(CC) $(CFLAGS) -o $(PRG_MENCODER) $(OBJS_MENCODER) $(LIBS_MENCODER)
399 endif
401 codec-cfg: codec-cfg.c codec-cfg.h help_mp.h
402 $(HOST_CC) -I. -DCODECS2HTML codec-cfg.c -o $@
404 codecs.conf.h: codec-cfg etc/codecs.conf
405 ./codec-cfg ./etc/codecs.conf > $@
407 codec-cfg.o: codecs.conf.h
409 codecs2html: mp_msg.o
410 $(CC) -DCODECS2HTML codec-cfg.c mp_msg.o -o $@
412 install: $(ALL_PRG)
413 ifeq ($(VIDIX),yes)
414 $(MAKE) -C libdha install
415 $(MAKE) -C vidix install
416 endif
417 $(INSTALL) -d $(BINDIR)
418 $(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG) $(BINDIR)/$(PRG)
419 ifeq ($(GUI),yes)
420 -ln -sf $(PRG) $(BINDIR)/gmplayer
421 endif
422 $(INSTALL) -d $(MANDIR)/man1
423 for i in $(MAN_LANG); do \
424 if test "$$i" = en ; then \
425 $(INSTALL) -c -m 644 DOCS/man/en/mplayer.1 $(MANDIR)/man1/mplayer.1 ; \
426 else \
427 $(INSTALL) -d $(MANDIR)/$$i/man1 ; \
428 $(INSTALL) -c -m 644 DOCS/man/$$i/mplayer.1 $(MANDIR)/$$i/man1/mplayer.1 ; \
429 fi ; \
430 done
431 ifeq ($(MENCODER),yes)
432 $(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG_MENCODER) $(BINDIR)/$(PRG_MENCODER)
433 for i in $(MAN_LANG); do \
434 if test "$$i" = en ; then \
435 cd $(MANDIR)/man1 && ln -sf mplayer.1 mencoder.1 ; \
436 else \
437 cd $(MANDIR)/$$i/man1 && ln -sf mplayer.1 mencoder.1 ; \
438 fi ; \
439 done
440 endif
441 @$(INSTALL) -d $(DATADIR)
442 @$(INSTALL) -d $(DATADIR)/font
443 @if test ! -f $(DATADIR)/font/font.desc ; then \
444 echo "*** Download font at http://www.mplayerhq.hu/dload.html" ; \
445 echo "*** for OSD/Subtitles support and extract to $(DATADIR)/font/" ; \
447 ifeq ($(GUI),yes)
448 @$(INSTALL) -d $(DATADIR)/skins
449 @echo "*** Download skin(s) at http://www.mplayerhq.hu/dload.html"
450 @echo "*** for GUI, and extract to $(DATADIR)/skins/"
451 @$(INSTALL) -d $(prefix)/share/pixmaps
452 $(INSTALL) -m 644 etc/mplayer.xpm $(prefix)/share/pixmaps/mplayer.xpm
453 @$(INSTALL) -d $(prefix)/share/applications
454 $(INSTALL) -m 644 etc/mplayer.desktop $(prefix)/share/applications/mplayer.desktop
455 endif
456 @$(INSTALL) -d $(CONFDIR)
457 @if test -f $(CONFDIR)/codecs.conf ; then mv -f $(CONFDIR)/codecs.conf $(CONFDIR)/codecs.conf.old ; fi
459 uninstall:
460 -rm -f $(BINDIR)/$(PRG) $(BINDIR)/gmplayer $(MANDIR)/man1/mplayer.1
461 -rm -f $(BINDIR)/$(PRG_MENCODER) $(MANDIR)/man1/mencoder.1
462 -rm -f $(prefix)/share/pixmaps/mplayer.xpm
463 -rm -f $(prefix)/share/applications/mplayer.desktop
464 for l in $(MAN_LANG); do \
465 if test "$$l" != "en"; then \
466 rm -f $(MANDIR)/$$l/man1/mplayer.1 \
467 $(MANDIR)/$$l/man1/mencoder.1 \
468 $(MANDIR)/$$l/man1/gmplayer.1 ; \
469 fi ; \
470 done
471 ifeq ($(VIDIX),yes)
472 $(MAKE) -C libdha uninstall
473 $(MAKE) -C vidix uninstall
474 endif
475 @echo "Uninstall completed"
477 dirclean:
478 -rm -f *.o *.a *~
480 clean: dirclean
481 @for a in $(PARTS); do $(MAKE) -C $$a clean; done
483 distclean: clean doxygen_clean
484 @for a in $(PARTS); do $(MAKE) -C $$a distclean; done
485 -rm -f *~ $(PRG) $(PRG_MENCODER) codec-cfg codecs2html codecs.conf.h \
486 .depend configure.log config.mak config.h help_mp.h version.h
488 strip:
489 strip -s $(ALL_PRG)
491 dep: depend
493 depend: help_mp.h version.h
494 $(CC) -MM $(CFLAGS) -DCODECS2HTML mplayer.c mencoder.c $(SRCS_MPLAYER) $(SRCS_MENCODER) 1>.depend
495 @for a in $(PARTS); do $(MAKE) -C $$a dep; done
497 # ./configure must be rerun if it changed
498 config.h: configure
499 @echo "############################################################"
500 @echo "####### Please run ./configure again - it's changed! #######"
501 @echo "############################################################"
503 # rebuild at every config.h/config.mak/Makefile change:
504 version.h: config.h config.mak Makefile
505 ./version.sh `$(CC) -dumpversion`
507 doxygen:
508 doxygen DOCS/tech/Doxyfile
510 doxygen_clean:
511 -rm -rf DOCS/tech/doxygen
513 help_mp.h: help/help_mp-en.h $(HELP_FILE)
514 @echo '// WARNING! This is a generated file. Do NOT edit.' > help_mp.h
515 @echo '// See the help/ subdir for the editable files.' >> help_mp.h
516 ifeq ($(CHARSET),)
517 @echo '#include "$(HELP_FILE)"' >> help_mp.h
518 else
519 iconv -f `cat $(HELP_FILE).charset` -t $(CHARSET) "$(HELP_FILE)" >> help_mp.h
520 endif
522 ifneq ($(HELP_FILE),help/help_mp-en.h)
523 @echo "Adding untranslated messages to help_mp.h"
524 @echo '// untranslated messages from the English master file:' >> help_mp.h
525 @help/help_diff.sh $(HELP_FILE) < help/help_mp-en.h >> help_mp.h
526 endif
528 # explicit dependencies to force version.h to be built even if .depend is missing
529 mplayer.o mencoder.o vobsub.o: version.h
531 # temporary measure to make sure help_mp.h is built. we desperately need correct deps!
532 $(MPLAYER_DEP) $(MENCODER_DEP): help_mp.h
535 # the following lines provide _partial_ dependency information
536 # for the 'library' directories under main dir, in order to cause
537 # the build process to recursively descend into them if something
538 # has changed. ideally this will be replaced with a single
539 # nonrecursive makefile for the whole project.
541 # Now all directories are recursed by default because these rules do not
542 # consider dependencies on files in other directories, while the recursively
543 # invoked Makefiles do. Conditional recursion only to the directories with
544 # changed files can be enabled by creating a file named ".norecurse" and
545 # optionally giving it a timestamp in the past. Directories whose .a files
546 # are newer than the timestamp and newer than other files in the directory
547 # will not be recursed.
548 .norecurse:
550 libvo/libvo.a: .norecurse $(wildcard libvo/*.[ch])
551 libao2/libao2.a: .norecurse $(wildcard libao2/*.[ch])
552 osdep/libosdep.a: .norecurse $(wildcard osdep/*.[ch])
553 input/libinput.a: .norecurse $(wildcard input/*.[ch])
555 libmenu/libmenu.a: .norecurse $(wildcard libmenu/*.[ch])
556 libaf/libaf.a: .norecurse $(wildcard libaf/*.[ch])
557 libmpdvdkit2/libmpdvdkit.a: .norecurse $(wildcard libmpdvdkit2/*.[ch])
559 libmpdemux/libmpdemux.a: .norecurse $(wildcard libmpdemux/*.[ch] libmpdemux/*/*.[ch])
560 stream/stream.a: .norecurse $(wildcard stream/*.[ch] stream/*/*.[ch])
561 libmpcodecs/libmpcodecs.a: .norecurse $(wildcard libmpcodecs/*.[ch]) $(wildcard libmpcodecs/native/*.[ch])
562 libmpcodecs/libmpencoders.a: .norecurse $(wildcard libmpcodecs/*.[ch])
564 libavutil/libavutil.a: .norecurse $(wildcard libavutil/*.[ch])
565 libavcodec/libavcodec.a: .norecurse $(wildcard libavcodec/*.[ch] libavcodec/*/*.[chS])
566 libavformat/libavformat.a: .norecurse $(wildcard libavformat/*.[ch])
567 libswscale/libswscale.a: .norecurse $(wildcard libswscale/*.[ch])
569 libmpeg2/libmpeg2.a: .norecurse $(wildcard libmpeg2/*.[ch])
570 liba52/liba52.a: .norecurse $(wildcard liba52/*.[ch])
571 mp3lib/libMP3.a: .norecurse $(wildcard mp3lib/*.[ch])
572 libfaad2/libfaad2.a: .norecurse $(wildcard libfaad2/*.[ch] libfaad2/*/*.[ch])
574 loader/libloader.a: .norecurse $(wildcard loader/*.[chSs])
575 loader/dmo/libDMO_Filter.a: .norecurse $(wildcard loader/dmo/*.[ch])
576 loader/dshow/libDS_Filter.a: .norecurse $(wildcard loader/dshow/*.[ch])
578 libdha/libdha.so: .norecurse $(wildcard libdha/*.[ch])
579 vidix/libvidix.a: .norecurse $(wildcard vidix/*.[ch])
580 Gui/libgui.a: .norecurse $(wildcard Gui/*.[ch] Gui/*/*.[ch] Gui/*/*/*.[ch])
582 libass/libass.a: .norecurse $(wildcard libass/*.[ch])
585 # include dependency files if they exist
587 ifneq ($(wildcard .depend),)
588 include .depend
589 endif