Fix make install. 10l for Diego.
[mplayer/glamo.git] / Makefile
blob177e381ceae45158202e89887aaa3e447dce5ee5
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 $(DECORE_LIB) \
103 $(XVID_LIB) \
104 $(DTS_LIB) \
105 $(PNG_LIB) \
106 $(Z_LIB) \
107 $(JPEG_LIB) \
108 $(ALSA_LIB) \
109 $(XMMS_LIB) \
110 $(X264_LIB) \
111 $(MUSEPACK_LIB) \
112 $(SPEEX_LIB) \
113 $(NUT_LIB) \
115 ifeq ($(TOOLAME),yes)
116 CODEC_LIBS += $(TOOLAME_LIB)
117 endif
119 ifeq ($(TWOLAME),yes)
120 CODEC_LIBS += $(TWOLAME_LIB)
121 endif
123 ifeq ($(FAAC),yes)
124 CODEC_LIBS += $(FAAC_LIB)
125 endif
127 COMMON_LIBS = libmpcodecs/libmpcodecs.a \
128 $(W32_LIB) \
129 libaf/libaf.a \
130 libmpdemux/libmpdemux.a \
131 stream/stream.a \
132 libswscale/libswscale.a \
133 osdep/libosdep.a \
134 $(EXTRA_LIB)\
135 $(DVDREAD_LIB) \
136 $(DVDNAV_LIB) \
137 $(CODEC_LIBS) \
138 $(TERMCAP_LIB) \
139 $(CDPARANOIA_LIB) \
140 $(MPLAYER_NETWORK_LIB) \
141 $(LIBCDIO_LIB) \
142 $(WIN32_LIB) \
143 $(MLIB_LIB) \
144 $(GIF_LIB) \
145 $(MACOSX_FRAMEWORKS) \
146 $(SMBSUPPORT_LIB) \
147 $(FRIBIDI_LIB) \
148 $(ENCA_LIB) \
149 $(LIRC_LIB) \
150 $(LIRCC_LIB) \
151 $(ARCH_LIB) \
152 $(MATH_LIB) \
153 $(LIBC_LIB) \
154 $(EXTRALIBS) \
156 PARTS = libmpdemux \
157 stream \
158 libmpcodecs \
159 libavutil \
160 libavcodec \
161 libpostproc \
162 libavformat \
163 libswscale \
164 libao2 \
165 osdep \
166 input \
167 libvo \
168 libaf \
170 ifeq ($(MP3LIB),yes)
171 PARTS += mp3lib
172 endif
173 ifeq ($(LIBA52),yes)
174 PARTS += liba52
175 endif
176 ifeq ($(LIBMPEG2),yes)
177 PARTS += libmpeg2
178 endif
179 ifeq ($(FAAD_INTERNAL),yes)
180 COMMON_LIBS += libfaad2/libfaad2.a
181 PARTS += libfaad2
182 endif
183 ifeq ($(VIDIX),yes)
184 PARTS += libdha vidix
185 endif
186 ifeq ($(FAME),yes)
187 PARTS += libfame
188 endif
189 ifeq ($(DVDKIT2),yes)
190 PARTS += libmpdvdkit2
191 endif
192 ifeq ($(GUI),yes)
193 PARTS += Gui
194 endif
195 ifneq ($(W32_LIB),)
196 PARTS += loader loader/dshow loader/dmo
197 endif
198 ifeq ($(LIBMENU),yes)
199 PARTS += libmenu
200 endif
201 ifeq ($(TREMOR_INTERNAL),yes)
202 PARTS += tremor
203 endif
205 ALL_PRG = $(PRG)
206 ifeq ($(MENCODER),yes)
207 ALL_PRG += $(PRG_MENCODER)
208 endif
210 COMMON_DEPS = $(W32_DEP) \
211 $(AV_DEP) \
212 libmpdemux/libmpdemux.a \
213 stream/stream.a \
214 libmpcodecs/libmpcodecs.a \
215 libao2/libao2.a \
216 osdep/libosdep.a \
217 libswscale/libswscale.a \
218 input/libinput.a \
219 libvo/libvo.a \
220 libaf/libaf.a \
222 ifeq ($(MP3LIB),yes)
223 COMMON_DEPS += mp3lib/libMP3.a
224 COMMON_LIBS += mp3lib/libMP3.a
225 endif
226 ifeq ($(LIBA52),yes)
227 COMMON_DEPS += liba52/liba52.a
228 COMMON_LIBS += liba52/liba52.a
229 endif
230 ifeq ($(LIBMPEG2),yes)
231 COMMON_DEPS += libmpeg2/libmpeg2.a
232 COMMON_LIBS += libmpeg2/libmpeg2.a
233 endif
234 ifeq ($(FAAD_INTERNAL),yes)
235 COMMON_DEPS += libfaad2/libfaad2.a
236 endif
237 ifeq ($(TREMOR_INTERNAL),yes)
238 COMMON_DEPS += tremor/libvorbisidec.a
239 COMMON_LIBS += tremor/libvorbisidec.a
240 endif
241 ifeq ($(VIDIX),yes)
242 COMMON_DEPS += libdha/libdha.so vidix/libvidix.a
243 endif
244 ifeq ($(FAME),yes)
245 COMMON_DEPS += libfame/libfame.a
246 endif
247 ifeq ($(DVDKIT2),yes)
248 COMMON_DEPS += libmpdvdkit2/libmpdvdkit.a
249 endif
250 ifeq ($(CONFIG_ASS),yes)
251 COMMON_DEPS += libass/libass.a
252 COMMON_LIBS += libass/libass.a
253 PARTS += libass
254 endif
255 # FontConfig and FreeType need to come after ASS to avoid link failures on MinGW
256 COMMON_LIBS += $(FONTCONFIG_LIB)
257 ifeq ($(FREETYPE),yes)
258 SRCS_MENCODER += libvo/font_load_ft.c
259 COMMON_LIBS += $(FREETYPE_LIB)
260 endif
261 ifeq ($(GUI),yes)
262 COMMON_DEPS += Gui/libgui.a
263 GUI_LIBS = Gui/libgui.a $(GTK_LIBS)
264 endif
266 .SUFFIXES: .cc .c .o
268 #.PHONY: $(COMMON_DEPS)
270 all: $(ALL_PRG)
272 .c.o:
273 $(CC) -c $(CFLAGS) -o $@ $<
275 libaf/libaf.a:
276 $(MAKE) -C libaf
278 libmpdvdkit2/libmpdvdkit.a:
279 $(MAKE) -C libmpdvdkit2
281 loader/libloader.a:
282 $(MAKE) -C loader
284 libfame/libfame.a:
285 $(MAKE) -C libfame
287 libass/libass.a:
288 $(MAKE) -C libass
290 libmpdemux/libmpdemux.a:
291 $(MAKE) -C libmpdemux
293 stream/stream.a:
294 $(MAKE) -C stream
296 libmpcodecs/libmpcodecs.a:
297 $(MAKE) -C libmpcodecs
299 loader/dshow/libDS_Filter.a:
300 $(MAKE) -C loader/dshow
302 loader/dmo/libDMO_Filter.a:
303 $(MAKE) -C loader/dmo
305 libavutil/libavutil.a:
306 $(MAKE) -C libavutil LIBPREF=lib LIBSUF=.a
308 libavcodec/libavcodec.a:
309 $(MAKE) -C libavcodec LIBPREF=lib LIBSUF=.a
311 libpostproc/libpostproc.a:
312 $(MAKE) -C libpostproc LIBPREF=lib LIBSUF=.a
314 libavformat/libavformat.a:
315 $(MAKE) -C libavformat LIBPREF=lib LIBSUF=.a
317 libswscale/libswscale.a:
318 $(MAKE) -C libswscale LIBPREF=lib LIBSUF=.a
320 libmpeg2/libmpeg2.a:
321 $(MAKE) -C libmpeg2
323 libvo/libvo.a:
324 $(MAKE) -C libvo
326 libao2/libao2.a:
327 $(MAKE) -C libao2
329 liba52/liba52.a:
330 $(MAKE) -C liba52
332 libfaad2/libfaad2.a:
333 $(MAKE) -C libfaad2
335 mp3lib/libMP3.a:
336 $(MAKE) -C mp3lib
338 tremor/libvorbisidec.a:
339 $(MAKE) -C tremor
341 libdha/libdha.so:
342 $(MAKE) -C libdha
344 vidix/libvidix.a: libdha/libdha.so
345 $(MAKE) -C vidix
347 Gui/libgui.a:
348 $(MAKE) -C Gui
350 osdep/libosdep.a:
351 $(MAKE) -C osdep
353 input/libinput.a:
354 $(MAKE) -C input
356 libmenu/libmenu.a:
357 $(MAKE) -C libmenu
359 MPLAYER_DEP = $(OBJS_MPLAYER) $(COMMON_DEPS)
361 ifeq ($(LIBMENU),yes)
362 MPLAYER_DEP += libmenu/libmenu.a
363 MENU_LIBS = libmenu/libmenu.a
364 PARTS += libmenu
365 endif
367 MENCODER_DEP = $(OBJS_MENCODER) $(COMMON_DEPS) libmpcodecs/libmpencoders.a
369 ifeq ($(TARGET_WIN32),yes)
370 OBJS_MPLAYER += osdep/mplayer-rc.o
371 endif
373 LIBS_MPLAYER = libvo/libvo.a \
374 libao2/libao2.a \
375 input/libinput.a \
376 $(MENU_LIBS) \
377 $(GUI_LIBS) \
378 $(COMMON_LIBS) \
379 $(VO_LIBS) \
380 $(AO_LIBS) \
381 $(STATIC_LIB) \
383 $(PRG): $(MPLAYER_DEP)
384 ifeq ($(TARGET_WIN32),yes)
385 windres -o osdep/mplayer-rc.o osdep/mplayer.rc
386 endif
387 $(CC) $(CFLAGS) -o $(PRG) $(OBJS_MPLAYER) $(LIBS_MPLAYER)
389 ifeq ($(MENCODER),yes)
390 LIBS_MENCODER = libmpcodecs/libmpencoders.a \
391 $(ENCORE_LIB) \
392 $(COMMON_LIBS) \
394 $(PRG_MENCODER): $(MENCODER_DEP)
395 $(CC) $(CFLAGS) -o $(PRG_MENCODER) $(OBJS_MENCODER) $(LIBS_MENCODER)
396 endif
398 codec-cfg: codec-cfg.c codec-cfg.h help_mp.h
399 $(HOST_CC) -I. -DCODECS2HTML codec-cfg.c -o $@
401 codecs.conf.h: codec-cfg etc/codecs.conf
402 ./codec-cfg ./etc/codecs.conf > $@
404 codec-cfg.o: codecs.conf.h
406 codecs2html: mp_msg.o
407 $(CC) -DCODECS2HTML codec-cfg.c mp_msg.o -o $@
409 install: $(ALL_PRG)
410 ifeq ($(VIDIX),yes)
411 $(MAKE) -C libdha install
412 $(MAKE) -C vidix install
413 endif
414 $(INSTALL) -d $(BINDIR)
415 $(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG) $(BINDIR)/$(PRG)
416 ifeq ($(GUI),yes)
417 -ln -sf $(PRG) $(BINDIR)/gmplayer
418 endif
419 $(INSTALL) -d $(MANDIR)/man1
420 for i in $(MAN_LANG); do \
421 if test "$$i" = en ; then \
422 $(INSTALL) -c -m 644 DOCS/man/en/mplayer.1 $(MANDIR)/man1/mplayer.1 ; \
423 else \
424 $(INSTALL) -d $(MANDIR)/$$i/man1 ; \
425 $(INSTALL) -c -m 644 DOCS/man/$$i/mplayer.1 $(MANDIR)/$$i/man1/mplayer.1 ; \
426 fi ; \
427 done
428 ifeq ($(MENCODER),yes)
429 $(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG_MENCODER) $(BINDIR)/$(PRG_MENCODER)
430 for i in $(MAN_LANG); do \
431 if test "$$i" = en ; then \
432 cd $(MANDIR)/man1 && ln -sf mplayer.1 mencoder.1 ; \
433 else \
434 cd $(MANDIR)/$$i/man1 && ln -sf mplayer.1 mencoder.1 ; \
435 fi ; \
436 done
437 endif
438 @$(INSTALL) -d $(DATADIR)
439 @$(INSTALL) -d $(DATADIR)/font
440 @if test ! -f $(DATADIR)/font/font.desc ; then \
441 echo "*** Download font at http://www.mplayerhq.hu/dload.html" ; \
442 echo "*** for OSD/Subtitles support and extract to $(DATADIR)/font/" ; \
444 ifeq ($(GUI),yes)
445 @$(INSTALL) -d $(DATADIR)/skins
446 @echo "*** Download skin(s) at http://www.mplayerhq.hu/dload.html"
447 @echo "*** for GUI, and extract to $(DATADIR)/skins/"
448 @$(INSTALL) -d $(prefix)/share/pixmaps
449 $(INSTALL) -m 644 etc/mplayer.xpm $(prefix)/share/pixmaps/mplayer.xpm
450 @$(INSTALL) -d $(prefix)/share/applications
451 $(INSTALL) -m 644 etc/mplayer.desktop $(prefix)/share/applications/mplayer.desktop
452 endif
453 @$(INSTALL) -d $(CONFDIR)
454 @if test -f $(CONFDIR)/codecs.conf ; then mv -f $(CONFDIR)/codecs.conf $(CONFDIR)/codecs.conf.old ; fi
456 uninstall:
457 -rm -f $(BINDIR)/$(PRG) $(BINDIR)/gmplayer $(MANDIR)/man1/mplayer.1
458 -rm -f $(BINDIR)/$(PRG_MENCODER) $(MANDIR)/man1/mencoder.1
459 -rm -f $(prefix)/share/pixmaps/mplayer.xpm
460 -rm -f $(prefix)/share/applications/mplayer.desktop
461 for l in $(MAN_LANG); do \
462 if test "$$l" != "en"; then \
463 rm -f $(MANDIR)/$$l/man1/mplayer.1 \
464 $(MANDIR)/$$l/man1/mencoder.1 \
465 $(MANDIR)/$$l/man1/gmplayer.1 ; \
466 fi ; \
467 done
468 ifeq ($(VIDIX),yes)
469 $(MAKE) -C libdha uninstall
470 $(MAKE) -C vidix uninstall
471 endif
472 @echo "Uninstall completed"
474 dirclean:
475 -rm -f *.o *.a *~
477 clean: dirclean
478 @for a in $(PARTS); do $(MAKE) -C $$a clean; done
480 distclean: clean doxygen_clean
481 @for a in $(PARTS); do $(MAKE) -C $$a distclean; done
482 -rm -f *~ $(PRG) $(PRG_MENCODER) codec-cfg codecs2html codecs.conf.h \
483 .depend configure.log config.mak config.h help_mp.h version.h
485 strip:
486 strip -s $(ALL_PRG)
488 dep: depend
490 depend: help_mp.h version.h
491 $(CC) -MM $(CFLAGS) -DCODECS2HTML mplayer.c mencoder.c $(SRCS_MPLAYER) $(SRCS_MENCODER) 1>.depend
492 @for a in $(PARTS); do $(MAKE) -C $$a dep; done
494 # ./configure must be rerun if it changed
495 config.h: configure
496 @echo "############################################################"
497 @echo "####### Please run ./configure again - it's changed! #######"
498 @echo "############################################################"
500 # rebuild at every config.h/config.mak/Makefile change:
501 version.h: config.h config.mak Makefile
502 ./version.sh `$(CC) -dumpversion`
504 doxygen:
505 doxygen DOCS/tech/Doxyfile
507 doxygen_clean:
508 -rm -rf DOCS/tech/doxygen
510 help_mp.h: help/help_mp-en.h $(HELP_FILE)
511 @echo '// WARNING! This is a generated file. Do NOT edit.' > help_mp.h
512 @echo '// See the help/ subdir for the editable files.' >> help_mp.h
513 ifeq ($(CHARSET),)
514 @echo '#include "$(HELP_FILE)"' >> help_mp.h
515 else
516 iconv -f `cat $(HELP_FILE).charset` -t $(CHARSET) "$(HELP_FILE)" >> help_mp.h
517 endif
519 ifneq ($(HELP_FILE),help/help_mp-en.h)
520 @echo "Adding untranslated messages to help_mp.h"
521 @echo '// untranslated messages from the English master file:' >> help_mp.h
522 @help/help_diff.sh $(HELP_FILE) < help/help_mp-en.h >> help_mp.h
523 endif
525 # explicit dependencies to force version.h to be built even if .depend is missing
526 mplayer.o mencoder.o vobsub.o: version.h
528 # temporary measure to make sure help_mp.h is built. we desperately need correct deps!
529 $(MPLAYER_DEP) $(MENCODER_DEP): help_mp.h
532 # the following lines provide _partial_ dependency information
533 # for the 'library' directories under main dir, in order to cause
534 # the build process to recursively descend into them if something
535 # has changed. ideally this will be replaced with a single
536 # nonrecursive makefile for the whole project.
538 # Now all directories are recursed by default because these rules do not
539 # consider dependencies on files in other directories, while the recursively
540 # invoked Makefiles do. Conditional recursion only to the directories with
541 # changed files can be enabled by creating a file named ".norecurse" and
542 # optionally giving it a timestamp in the past. Directories whose .a files
543 # are newer than the timestamp and newer than other files in the directory
544 # will not be recursed.
545 .norecurse:
547 libvo/libvo.a: .norecurse $(wildcard libvo/*.[ch])
548 libao2/libao2.a: .norecurse $(wildcard libao2/*.[ch])
549 osdep/libosdep.a: .norecurse $(wildcard osdep/*.[ch])
550 input/libinput.a: .norecurse $(wildcard input/*.[ch])
552 libmenu/libmenu.a: .norecurse $(wildcard libmenu/*.[ch])
553 libaf/libaf.a: .norecurse $(wildcard libaf/*.[ch])
554 libmpdvdkit2/libmpdvdkit.a: .norecurse $(wildcard libmpdvdkit2/*.[ch])
556 libmpdemux/libmpdemux.a: .norecurse $(wildcard libmpdemux/*.[ch] libmpdemux/*/*.[ch])
557 stream/stream.a: .norecurse $(wildcard stream/*.[ch] stream/*/*.[ch])
558 libmpcodecs/libmpcodecs.a: .norecurse $(wildcard libmpcodecs/*.[ch]) $(wildcard libmpcodecs/native/*.[ch])
559 libmpcodecs/libmpencoders.a: .norecurse $(wildcard libmpcodecs/*.[ch])
561 libavutil/libavutil.a: .norecurse $(wildcard libavutil/*.[ch])
562 libavcodec/libavcodec.a: .norecurse $(wildcard libavcodec/*.[ch] libavcodec/*/*.[chS])
563 libavformat/libavformat.a: .norecurse $(wildcard libavformat/*.[ch])
564 libswscale/libswscale.a: .norecurse $(wildcard libswscale/*.[ch])
566 libmpeg2/libmpeg2.a: .norecurse $(wildcard libmpeg2/*.[ch])
567 liba52/liba52.a: .norecurse $(wildcard liba52/*.[ch])
568 mp3lib/libMP3.a: .norecurse $(wildcard mp3lib/*.[ch])
569 libfaad2/libfaad2.a: .norecurse $(wildcard libfaad2/*.[ch] libfaad2/*/*.[ch])
571 loader/libloader.a: .norecurse $(wildcard loader/*.[chSs])
572 loader/dmo/libDMO_Filter.a: .norecurse $(wildcard loader/dmo/*.[ch])
573 loader/dshow/libDS_Filter.a: .norecurse $(wildcard loader/dshow/*.[ch])
575 libdha/libdha.so: .norecurse $(wildcard libdha/*.[ch])
576 vidix/libvidix.a: .norecurse $(wildcard vidix/*.[ch])
577 Gui/libgui.a: .norecurse $(wildcard Gui/*.[ch] Gui/*/*.[ch] Gui/*/*/*.[ch])
579 libass/libass.a: .norecurse $(wildcard libass/*.[ch])
582 # include dependency files if they exist
584 ifneq ($(wildcard .depend),)
585 include .depend
586 endif