10l to Nico for this copy&paste bug
[mplayer/glamo.git] / Makefile
blob8a176707a25e16be0b2866f084f7107516628de3
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 PRG_CFG = codec-cfg
11 # Do not strip the binaries at installation
12 ifeq ($(STRIPBINARIES),yes)
13 INSTALLSTRIP = -s
14 endif
16 # These subdirectories require installation due to binaries within them.
17 ifeq ($(VIDIX),yes)
18 SUBDIRS += libdha vidix
19 DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
20 endif
22 SRCS_COMMON = asxparser.c \
23 codec-cfg.c \
24 cpudetect.c \
25 edl.c \
26 find_sub.c \
27 m_config.c \
28 m_option.c \
29 m_struct.c \
30 parser-cfg.c \
31 playtree.c \
32 playtreeparser.c \
33 spudec.c \
34 sub_cc.c \
35 subreader.c \
36 vobsub.c \
38 SRCS_MENCODER = mencoder.c \
39 mp_msg-mencoder.c \
40 $(SRCS_COMMON) \
41 divx4_vbr.c \
42 libvo/aclib.c \
43 libvo/font_load.c \
44 libvo/font_load_ft.c \
45 libvo/osd.c \
46 libvo/sub.c \
47 parser-mecmd.c \
48 xvid_vbr.c \
50 SRCS_MPLAYER = mplayer.c \
51 mp_msg.c \
52 $(SRCS_COMMON) \
53 mixer.c \
54 parser-mpcmd.c \
55 subopt-helper.c \
57 ifeq ($(UNRARLIB),yes)
58 SRCS_COMMON += unrarlib.c
59 endif
61 OBJS_MENCODER = $(SRCS_MENCODER:.c=.o)
62 OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o)
64 VO_LIBS = $(AA_LIB) \
65 $(X_LIB) \
66 $(SDL_LIB) \
67 $(GGI_LIB) \
68 $(MP1E_LIB) \
69 $(MLIB_LIB) \
70 $(SVGA_LIB) \
71 $(DIRECTFB_LIB) \
72 $(CACA_LIB) \
74 AO_LIBS = $(ARTS_LIB) \
75 $(ESD_LIB) \
76 $(JACK_LIB) \
77 $(NAS_LIB) \
78 $(SGIAUDIO_LIB) \
79 $(POLYP_LIB) \
81 CODEC_LIBS = $(AV_LIB) \
82 $(FAME_LIB) \
83 $(MAD_LIB) \
84 $(VORBIS_LIB) \
85 $(THEORA_LIB) \
86 $(FAAD_LIB) \
87 $(LIBLZO_LIB) \
88 $(DECORE_LIB) \
89 $(XVID_LIB) \
90 $(DTS_LIB) \
91 $(PNG_LIB) \
92 $(Z_LIB) \
93 $(JPEG_LIB) \
94 $(ALSA_LIB) \
95 $(XMMS_LIB) \
96 $(X264_LIB) \
98 COMMON_LIBS = libmpcodecs/libmpcodecs.a \
99 $(W32_LIB) \
100 $(DS_LIB) \
101 libaf/libaf.a \
102 libmpdemux/libmpdemux.a \
103 input/libinput.a \
104 postproc/libswscale.a \
105 osdep/libosdep.a \
106 $(DVDREAD_LIB) \
107 $(CODEC_LIBS) \
108 $(FREETYPE_LIB) \
109 $(TERMCAP_LIB) \
110 $(CDPARANOIA_LIB) \
111 $(MPLAYER_NETWORK_LIB) \
112 $(WIN32_LIB) \
113 $(GIF_LIB) \
114 $(MACOSX_FRAMEWORKS) \
115 $(SMBSUPPORT_LIB) \
116 $(FRIBIDI_LIB) \
117 $(FONTCONFIG_LIB) \
118 $(ENCA_LIB) \
120 CFLAGS = $(OPTFLAGS) -I. \
121 $(CACA_INC) \
122 $(CDPARANOIA_INC) \
123 $(DVB_INC) \
124 $(EXTRA_INC) \
125 $(FONTCONFIG_INC) \
126 $(FREETYPE_INC) \
127 $(FRIBIDI_INC) \
128 $(SDL_INC) \
129 $(X11_INC) \
130 $(XVID_INC) \
132 #CFLAGS += -Wall
134 ifeq ($(TOOLAME),yes)
135 CFLAGS += $(TOOLAME_EXTRAFLAGS)
136 CODEC_LIBS += $(TOOLAME_LIB)
137 endif
139 ifeq ($(TWOLAME),yes)
140 CODEC_LIBS += $(TWOLAME_LIB)
141 endif
143 ifeq ($(FAAC),yes)
144 CODEC_LIBS += $(FAAC_LIB)
145 endif
147 PARTS = libmpdemux \
148 libmpcodecs \
149 libavcodec \
150 libavformat \
151 libao2 \
152 osdep \
153 postproc \
154 input \
155 libvo \
156 libaf \
158 ifeq ($(MP3LIB),yes)
159 PARTS += mp3lib
160 endif
161 ifeq ($(LIBA52),yes)
162 PARTS += liba52
163 endif
164 ifeq ($(LIBMPEG2),yes)
165 PARTS += libmpeg2
166 endif
167 ifeq ($(INTERNAL_FAAD),yes)
168 COMMON_LIBS += libfaad2/libfaad2.a
169 PARTS += libfaad2
170 endif
171 ifeq ($(VIDIX),yes)
172 PARTS += libdha vidix
173 endif
174 ifeq ($(FAME),yes)
175 PARTS += libfame
176 endif
177 ifeq ($(DVDKIT2),yes)
178 PARTS += libmpdvdkit2
179 else
180 ifeq ($(DVDKIT),yes)
181 PARTS += libmpdvdkit
182 endif
183 endif
184 ifeq ($(GUI),yes)
185 PARTS += Gui
186 endif
187 ifneq ($(W32_LIB),)
188 PARTS += loader loader/dshow loader/dmo
189 endif
190 ifeq ($(LIBMENU),yes)
191 PARTS += libmenu
192 endif
193 ifeq ($(TREMOR),yes)
194 PARTS += tremor
195 endif
197 ALL_PRG = $(PRG)
198 ifeq ($(MENCODER),yes)
199 ALL_PRG += $(PRG_MENCODER)
200 endif
202 COMMON_DEPS = $(W32_DEP) \
203 $(DS_DEP) \
204 $(MP1E_DEP) \
205 $(AV_DEP) \
206 libmpdemux/libmpdemux.a \
207 libmpcodecs/libmpcodecs.a \
208 libao2/libao2.a \
209 osdep/libosdep.a \
210 postproc/libswscale.a \
211 input/libinput.a \
212 libvo/libvo.a \
213 libaf/libaf.a \
215 ifeq ($(MP3LIB),yes)
216 COMMON_DEPS += mp3lib/libMP3.a
217 COMMON_LIBS += mp3lib/libMP3.a
218 endif
219 ifeq ($(LIBA52),yes)
220 COMMON_DEPS += liba52/liba52.a
221 COMMON_LIBS += liba52/liba52.a
222 endif
223 ifeq ($(LIBMPEG2),yes)
224 COMMON_DEPS += libmpeg2/libmpeg2.a
225 COMMON_LIBS += libmpeg2/libmpeg2.a
226 endif
227 ifeq ($(INTERNAL_FAAD),yes)
228 COMMON_DEPS += libfaad2/libfaad2.a
229 endif
230 ifeq ($(TREMOR),yes)
231 COMMON_DEPS += tremor/libvorbisidec.a
232 COMMON_LIBS += tremor/libvorbisidec.a
233 endif
234 ifeq ($(VIDIX),yes)
235 COMMON_DEPS += libdha/libdha.so vidix/libvidix.a
236 endif
237 ifeq ($(FAME),yes)
238 COMMON_DEPS += libfame/libfame.a
239 endif
240 ifeq ($(DVDKIT2),yes)
241 ifeq ($(DVDKIT_SHARED),yes)
242 COMMON_DEPS += libmpdvdkit2/libmpdvdkit.so
243 else
244 COMMON_DEPS += libmpdvdkit2/libmpdvdkit.a
245 endif
246 endif
248 ifeq ($(SHARED_PP),yes)
249 COMMON_DEPS += libavcodec/libpostproc/libpostproc.so
250 COMMON_LIBS += libavcodec/libpostproc/libpostproc.so
251 endif
253 ifeq ($(GUI),yes)
254 COMMON_DEPS += Gui/libgui.a
255 GUI_LIBS = Gui/libgui.a
256 endif
258 .SUFFIXES: .cc .c .o
260 #.PHONY: $(COMMON_DEPS)
262 all: version.h $(ALL_PRG)
264 .c.o:
265 $(CC) -c $(CFLAGS) -o $@ $<
267 libaf/libaf.a:
268 $(MAKE) -C libaf
270 libmpdvdkit2/libmpdvdkit.a:
271 $(MAKE) -C libmpdvdkit2
273 libmpdvdkit2/libmpdvdkit.so:
274 $(MAKE) -C libmpdvdkit2 libmpdvdkit.so
276 loader/libloader.a:
277 $(MAKE) -C loader
279 libfame/libfame.a:
280 $(MAKE) -C libfame
282 libmpdemux/libmpdemux.a:
283 $(MAKE) -C libmpdemux
285 libmpcodecs/libmpcodecs.a:
286 $(MAKE) -C libmpcodecs
288 loader/dshow/libDS_Filter.a:
289 $(MAKE) -C loader/dshow
291 loader/dmo/libDMO_Filter.a:
292 $(MAKE) -C loader/dmo
294 libavcodec/libavcodec.a:
295 $(MAKE) -C libavcodec LIBPREF=lib LIBSUF=.a
297 libavformat/libavformat.a:
298 $(MAKE) -C libavformat LIBPREF=lib LIBSUF=.a
300 libmpeg2/libmpeg2.a:
301 $(MAKE) -C libmpeg2
303 libvo/libvo.a:
304 $(MAKE) -C libvo
306 libao2/libao2.a:
307 $(MAKE) -C libao2
309 liba52/liba52.a:
310 $(MAKE) -C liba52
312 libfaad2/libfaad2.a:
313 $(MAKE) -C libfaad2
315 mp3lib/libMP3.a:
316 $(MAKE) -C mp3lib
318 tremor/libvorbisidec.a:
319 $(MAKE) -C tremor
321 libdha/libdha.so:
322 $(MAKE) -C libdha
324 vidix/libvidix.a:
325 $(MAKE) -C vidix
327 Gui/libgui.a:
328 $(MAKE) -C Gui
330 osdep/libosdep.a:
331 $(MAKE) -C osdep
333 postproc/libswscale.a:
334 $(MAKE) -C postproc
336 input/libinput.a:
337 $(MAKE) -C input
339 libmenu/libmenu.a:
340 $(MAKE) -C libmenu
342 libavcodec/libpostproc/libpostproc.so:
343 $(MAKE) -C libavcodec/libpostproc
345 MPLAYER_DEP = $(OBJS_MPLAYER) $(COMMON_DEPS)
347 ifeq ($(LIBMENU),yes)
348 MPLAYER_DEP += libmenu/libmenu.a
349 MENU_LIBS = libmenu/libmenu.a
350 PARTS += libmenu
351 else
352 MENU_LIBS =
353 endif
355 MENCODER_DEP = $(OBJS_MENCODER) $(COMMON_DEPS) libmpcodecs/libmpencoders.a
357 ifeq ($(VIDIX),yes)
358 VIDIX_LIBS = vidix/libvidix.a
359 else
360 VIDIX_LIBS =
361 endif
363 ifeq ($(TARGET_WIN32),yes)
364 OBJS_MPLAYER += osdep/mplayer-rc.o
365 endif
367 LIBS_MPLAYER = libvo/libvo.a \
368 libao2/libao2.a \
369 $(MENU_LIBS) \
370 $(VIDIX_LIBS) \
371 $(GUI_LIBS) \
372 $(COMMON_LIBS) \
373 $(GTK_LIBS) \
374 $(VO_LIBS) \
375 $(AO_LIBS) \
376 $(EXTRA_LIB)\
377 $(LIRC_LIB) \
378 $(LIRCC_LIB) \
379 $(STATIC_LIB) \
380 $(ARCH_LIB) \
381 $(I18NLIBS) \
382 $(MATH_LIB) \
384 $(PRG): $(MPLAYER_DEP)
385 ifeq ($(TARGET_WIN32),yes)
386 windres -o osdep/mplayer-rc.o osdep/mplayer.rc
387 endif
388 $(CC) $(CFLAGS) -o $(PRG) $(OBJS_MPLAYER) $(LIBS_MPLAYER)
390 mplayer.exe.spec.c: libmpcodecs/libmpcodecs.a
391 winebuild -fPIC -o mplayer.exe.spec.c -exe mplayer.exe -mcui \
392 libmpcodecs/ad_qtaudio.o libmpcodecs/vd_qtvideo.o \
393 -L/usr/local/lib/wine -lkernel32
395 mplayer.exe.so: $(MPLAYER_DEP) mplayer.exe.spec.c
396 $(CC) $(CFLAGS) -Wall -shared -Wl,-rpath,/usr/local/lib -Wl,-Bsymbolic -o mplayer.exe.so $(OBJS_MPLAYER) mplayer.exe.spec.c libvo/libvo.a libao2/libao2.a $(MENU_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(COMMON_LIBS) $(GTK_LIBS) $(VO_LIBS) $(AO_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(STATIC_LIB) $(ARCH_LIB) -lwine $(MATH_LIB)
398 mplayer_wine.so: $(MPLAYER_DEP)
399 $(CC) $(CFLAGS) -shared -Wl,-Bsymbolic -o mplayer_wine.so mplayer_wine.spec.c $(OBJS_MPLAYER) libvo/libvo.a libao2/libao2.a $(MENU_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(COMMON_LIBS) $(GTK_LIBS) $(VO_LIBS) $(AO_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(STATIC_LIB) -lwine $(ARCH_LIB) $(MATH_LIB)
401 ifeq ($(MENCODER),yes)
402 LIBS_MENCODER = libmpcodecs/libmpencoders.a \
403 $(ENCORE_LIB) \
404 $(COMMON_LIBS) \
405 $(EXTRA_LIB) \
406 $(MLIB_LIB) \
407 $(LIRC_LIB) \
408 $(LIRCC_LIB) \
409 $(ARCH_LIB) \
410 $(I18NLIBS) \
411 $(MATH_LIB) \
413 $(PRG_MENCODER): $(MENCODER_DEP)
414 $(CC) $(CFLAGS) -o $(PRG_MENCODER) $(OBJS_MENCODER) $(LIBS_MENCODER)
415 endif
417 codecs.conf.h: $(PRG_CFG) etc/codecs.conf
418 ./$(PRG_CFG) ./etc/codecs.conf > $@
420 codec-cfg.o: codecs.conf.h
422 # Every mplayer dependency depends on version.h, to force building version.h
423 # first (in serial mode) before any other of the dependencies for a parallel make
424 # run. This is necessary, because the make rule for version.h removes objects
425 # in a recursive "make distclean" and we must wait for this "make distclean" to
426 # finish before we can start building new object files.
427 # help_mp.h is also required by a lot of files, so force generating it early.
428 $(MPLAYER_DEP): version.h help_mp.h
429 $(MENCODER_DEP): version.h help_mp.h
431 $(PRG_CFG): version.h codec-cfg.c codec-cfg.h
432 $(HOST_CC) $(HOST_CFLAGS) -I. -g codec-cfg.c mp_msg.c -o $(PRG_CFG) -DCODECS2HTML $(EXTRA_LIB) $(EXTRA_INC) $(I18NLIBS)
434 install: $(ALL_PRG)
435 ifeq ($(VIDIX),yes)
436 $(DO_MAKE)
437 endif
438 ifeq ($(SHARED_PP),yes)
439 $(MAKE) install -C libavcodec/libpostproc
440 endif
441 if test ! -d $(BINDIR) ; then mkdir -p $(BINDIR) ; fi
442 $(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG) $(BINDIR)/$(PRG)
443 ifeq ($(GUI),yes)
444 -ln -sf $(PRG) $(BINDIR)/gmplayer
445 endif
446 if test ! -d $(MANDIR)/man1 ; then mkdir -p $(MANDIR)/man1; fi
447 for i in $(MAN_LANG); do \
448 if test "$$i" = en ; then \
449 $(INSTALL) -c -m 644 DOCS/man/en/mplayer.1 $(MANDIR)/man1/mplayer.1 ; \
450 else \
451 mkdir -p $(MANDIR)/$$i/man1 ; \
452 $(INSTALL) -c -m 644 DOCS/man/$$i/mplayer.1 $(MANDIR)/$$i/man1/mplayer.1 ; \
453 fi ; \
454 done
455 ifeq ($(MENCODER),yes)
456 $(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG_MENCODER) $(BINDIR)/$(PRG_MENCODER)
457 for i in $(MAN_LANG); do \
458 if test "$$i" = en ; then \
459 ln -sf mplayer.1 $(MANDIR)/man1/mencoder.1 ; \
460 else \
461 ln -sf mplayer.1 $(MANDIR)/$$i/man1/mencoder.1 ; \
462 fi ; \
463 done
464 endif
465 @if test ! -d $(DATADIR) ; then mkdir -p $(DATADIR) ; fi
466 @if test ! -d $(DATADIR)/font ; then mkdir -p $(DATADIR)/font ; fi
467 @if test ! -f $(DATADIR)/font/font.desc ; then \
468 echo "*** Download font at http://www.mplayerhq.hu/homepage/dload.html" ; \
469 echo "*** for OSD/Subtitles support and extract to $(DATADIR)/font/" ; \
471 ifeq ($(GUI),yes)
472 @if test ! -d $(DATADIR)/Skin ; then mkdir -p $(DATADIR)/Skin ; fi
473 @echo "*** Download skin(s) at http://www.mplayerhq.hu/homepage/dload.html"
474 @echo "*** for GUI, and extract to $(DATADIR)/Skin/"
475 @if test ! -d $(prefix)/share/pixmaps ; then mkdir -p $(prefix)/share/pixmaps ; fi
476 $(INSTALL) -m 644 Gui/mplayer/pixmaps/mplayer-desktop.xpm $(prefix)/share/pixmaps/mplayer-desktop.xpm
477 @if test ! -d $(prefix)/share/applications ; then mkdir -p $(prefix)/share/applications ; fi
478 $(INSTALL) -m 644 etc/mplayer.desktop $(prefix)/share/applications/mplayer.desktop
479 endif
480 @if test ! -d $(CONFDIR) ; then mkdir -p $(CONFDIR) ; fi
481 @if test -f $(CONFDIR)/codecs.conf ; then mv -f $(CONFDIR)/codecs.conf $(CONFDIR)/codecs.conf.old ; fi
482 ifeq ($(DVDKIT_SHARED),yes)
483 ifeq ($(DVDKIT2),yes)
484 if test ! -d $(LIBDIR) ; then mkdir -p $(LIBDIR) ; fi
485 $(INSTALL) -m 755 $(INSTALLSTRIP) libmpdvdkit2/libmpdvdkit.so $(LIBDIR)/libmpdvdkit.so
486 else
487 ifeq ($(DVDKIT),yes)
488 if test ! -d $(LIBDIR) ; then mkdir -p $(LIBDIR) ; fi
489 $(INSTALL) -m 755 $(INSTALLSTRIP) libmpdvdkit/libmpdvdkit.so $(LIBDIR)/libmpdvdkit.so
490 endif
491 endif
492 endif
494 uninstall:
495 -rm -f $(BINDIR)/$(PRG) $(BINDIR)/gmplayer $(MANDIR)/man1/mplayer.1
496 -rm -f $(BINDIR)/$(PRG_MENCODER) $(MANDIR)/man1/mencoder.1
497 -rm -f $(prefix)/share/pixmaps/mplayer-desktop.xpm
498 -rm -f $(prefix)/share/applications/mplayer.desktop
499 -rm -f $(LIBDIR)/libmpdvdkit.so
500 for l in $(MAN_LANG); do \
501 if test "i$$l" != "en"; then \
502 -rm -f $(MANDIR)/$$l/man1/mplayer.1 $(MANDIR)/$$l/man1/mencoder.1 \
503 -rm -f $(MANDIR)/$$l/man1/gmplayer.1 \
504 fi \
505 done
506 ifeq ($(VIDIX),yes)
507 $(DO_MAKE)
508 endif
509 @echo "Uninstall completed"
511 clean:
512 -rm -f *.o *~ $(OBJS) codecs.conf.h
514 distclean: doxygen_clean
515 -rm -f *~ $(PRG) $(PRG_MENCODER) $(PRG_CFG) $(OBJS)
516 -rm -f *.o *.a .depend configure.log codecs.conf.h help_mp.h
517 @for a in $(PARTS); do $(MAKE) -C $$a distclean; done
519 strip:
520 strip -s $(ALL_PRG)
522 dep: depend
524 depend: help_mp.h
525 ./version.sh `$(CC) -dumpversion`
526 $(CC) -MM $(CFLAGS) -DCODECS2HTML mplayer.c mencoder.c $(SRCS_MPLAYER) $(SRCS_MENCODER) 1>.depend
527 @for a in $(PARTS); do $(MAKE) -C $$a dep; done
529 # ./configure must be run if it changed in CVS
530 config.h: configure
531 @echo "############################################################"
532 @echo "####### Please run ./configure again - it's changed! #######"
533 @echo "############################################################"
534 ifeq ($(wildcard .developer),)
535 @exit 1
536 endif
538 # do not rebuild after cvs commits if .developer file is present!
540 # rebuild at every config.h/config.mak change:
541 version.h:
542 ./version.sh `$(CC) -dumpversion`
543 ifeq ($(wildcard .developer),)
544 $(MAKE) distclean
545 endif
546 $(MAKE) depend
548 doxygen:
549 doxygen DOCS/tech/Doxyfile
551 doxygen_clean:
552 -rm -rf DOCS/tech/doxygen
554 help_mp.h: help/help_mp-en.h $(HELP_FILE)
555 @echo '// WARNING! This is a generated file. Do NOT edit.' > help_mp.h
556 @echo '// See the help/ subdir for the editable files.' >> help_mp.h
557 ifeq ($(CHARSET),)
558 @echo '#include "$(HELP_FILE)"' >> help_mp.h
559 else
560 iconv -f `cat $(HELP_FILE).charset` -t $(CHARSET) "$(HELP_FILE)" >> help_mp.h
561 endif
563 ifneq ($(HELP_FILE),help/help_mp-en.h)
564 @echo "Adding untranslated messages to help_mp.h"
565 @echo '// untranslated messages from the English master file:' >> help_mp.h
566 @help/help_diff.sh $(HELP_FILE) < help/help_mp-en.h >> help_mp.h
567 endif
569 # rebuild at every CVS update or config/makefile change:
570 ifeq ($(wildcard .developer),)
571 ifneq ($(wildcard CVS/Entries),)
572 version.h: CVS/Entries
573 endif
574 version.h: config.h config.mak Makefile
575 endif
578 # include dependencies to get make to recurse into lib dirs,
579 # if the user desires such behavior
581 ifneq ($(wildcard .libdeps),)
582 include .libdeps
583 endif
586 # include dependency files if they exist
588 ifneq ($(wildcard .depend),)
589 include .depend
590 endif