10l initial patch by Oded Shimon <ods15 at ods15.dyndns.org>
[mplayer/greg.git] / Makefile
bloba246f90339ac96140a03e1e203d7c65e7993d7f9
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 = cpudetect.c codec-cfg.c spudec.c playtree.c playtreeparser.c asxparser.c vobsub.c subreader.c sub_cc.c find_sub.c m_config.c m_option.c parser-cfg.c m_struct.c edl.c
23 SRCS_MENCODER = mencoder.c mp_msg-mencoder.c $(SRCS_COMMON) libao2/afmt.c divx4_vbr.c libvo/aclib.c libvo/osd.c libvo/sub.c libvo/font_load.c libvo/font_load_ft.c xvid_vbr.c parser-mecmd.c
24 SRCS_MPLAYER = mplayer.c mp_msg.c $(SRCS_COMMON) mixer.c parser-mpcmd.c
26 ifeq ($(UNRARLIB),yes)
27 SRCS_COMMON += unrarlib.c
28 endif
30 OBJS_MENCODER = $(SRCS_MENCODER:.c=.o)
31 OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o)
33 VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB) $(CACA_LIB)
34 AO_LIBS = $(ARTS_LIB) $(ESD_LIB) $(JACK_LIB) $(NAS_LIB) $(SGIAUDIO_LIB) $(POLYP_LIB)
35 CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(THEORA_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(DECORE_LIB) $(XVID_LIB) $(DTS_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB) $(X264_LIB)
36 COMMON_LIBS = libmpcodecs/libmpcodecs.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a postproc/libswscale.a osdep/libosdep.a $(DVDREAD_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(MPLAYER_NETWORK_LIB) $(WIN32_LIB) $(GIF_LIB) $(MACOSX_FRAMEWORKS) $(SMBSUPPORT_LIB) $(FRIBIDI_LIB) $(FONTCONFIG_LIB) $(ENCA_LIB)
38 CFLAGS = $(OPTFLAGS) -I. $(FREETYPE_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(SDL_INC) $(X11_INC) $(FRIBIDI_INC) $(DVB_INC) $(XVID_INC) $(FONTCONFIG_INC) $(CACA_INC) # -Wall
39 ifeq ($(TOOLAME),yes)
40 CFLAGS += $(TOOLAME_EXTRAFLAGS)
41 CODEC_LIBS += $(TOOLAME_LIB)
42 endif
44 PARTS = libmpdemux libmpcodecs libavcodec libavformat libao2 drivers osdep postproc input libvo libaf
45 ifeq ($(MP3LIB),yes)
46 PARTS += mp3lib
47 endif
48 ifeq ($(LIBA52),yes)
49 PARTS += liba52
50 endif
51 ifeq ($(LIBMPEG2),yes)
52 PARTS += libmpeg2
53 endif
54 ifeq ($(INTERNAL_FAAD),yes)
55 COMMON_LIBS += libfaad2/libfaad2.a
56 PARTS += libfaad2
57 endif
58 ifeq ($(VIDIX),yes)
59 PARTS += libdha vidix
60 endif
61 ifeq ($(FAME),yes)
62 PARTS += libfame
63 endif
64 ifeq ($(DVDKIT2),yes)
65 PARTS += libmpdvdkit2
66 else
67 ifeq ($(DVDKIT),yes)
68 PARTS += libmpdvdkit
69 endif
70 endif
71 ifeq ($(GUI),yes)
72 PARTS += Gui
73 endif
74 ifneq ($(W32_LIB),)
75 PARTS += loader loader/dshow loader/dmo
76 endif
77 ifeq ($(LIBMENU),yes)
78 PARTS += libmenu
79 endif
81 ALL_PRG = $(PRG)
82 ifeq ($(MENCODER),yes)
83 ALL_PRG += $(PRG_MENCODER)
84 endif
86 COMMON_DEPS = $(W32_DEP) $(DS_DEP) $(MP1E_DEP) $(AV_DEP) libmpdemux/libmpdemux.a libmpcodecs/libmpcodecs.a libao2/libao2.a osdep/libosdep.a postproc/libswscale.a input/libinput.a libvo/libvo.a libaf/libaf.a
88 ifeq ($(MP3LIB),yes)
89 COMMON_DEPS += mp3lib/libMP3.a
90 COMMON_LIBS += mp3lib/libMP3.a
91 endif
92 ifeq ($(LIBA52),yes)
93 COMMON_DEPS += liba52/liba52.a
94 COMMON_LIBS += liba52/liba52.a
95 endif
96 ifeq ($(LIBMPEG2),yes)
97 COMMON_DEPS += libmpeg2/libmpeg2.a
98 COMMON_LIBS += libmpeg2/libmpeg2.a
99 endif
100 ifeq ($(INTERNAL_FAAD),yes)
101 COMMON_DEPS += libfaad2/libfaad2.a
102 endif
103 ifeq ($(VIDIX),yes)
104 COMMON_DEPS += libdha/libdha.so vidix/libvidix.a
105 endif
106 ifeq ($(FAME),yes)
107 COMMON_DEPS += libfame/libfame.a
108 endif
109 ifeq ($(DVDKIT2),yes)
110 ifeq ($(DVDKIT_SHARED),yes)
111 COMMON_DEPS += libmpdvdkit2/libmpdvdkit.so
112 else
113 COMMON_DEPS += libmpdvdkit2/libmpdvdkit.a
114 endif
115 endif
117 ifeq ($(SHARED_PP),yes)
118 COMMON_DEPS += libavcodec/libpostproc/libpostproc.so
119 COMMON_LIBS += libavcodec/libpostproc/libpostproc.so
120 endif
122 ifeq ($(GUI),yes)
123 COMMON_DEPS += Gui/libgui.a
124 GUI_LIBS = Gui/libgui.a
125 endif
127 .SUFFIXES: .cc .c .o
129 #.PHONY: $(COMMON_DEPS)
131 all: version.h $(ALL_PRG)
133 .c.o:
134 $(CC) -c $(CFLAGS) -o $@ $<
136 libaf/libaf.a:
137 $(MAKE) -C libaf
139 libmpdvdkit2/libmpdvdkit.a:
140 $(MAKE) -C libmpdvdkit2
142 libmpdvdkit2/libmpdvdkit.so:
143 $(MAKE) -C libmpdvdkit2 libmpdvdkit.so
145 loader/libloader.a:
146 $(MAKE) -C loader
148 libfame/libfame.a:
149 $(MAKE) -C libfame
151 libmpdemux/libmpdemux.a:
152 $(MAKE) -C libmpdemux
154 libmpcodecs/libmpcodecs.a:
155 $(MAKE) -C libmpcodecs
157 loader/dshow/libDS_Filter.a:
158 $(MAKE) -C loader/dshow
160 loader/dmo/libDMO_Filter.a:
161 $(MAKE) -C loader/dmo
163 libavcodec/libavcodec.a:
164 $(MAKE) -C libavcodec LIBPREF=lib LIBSUF=.a
166 libavformat/libavformat.a:
167 $(MAKE) -C libavformat LIBPREF=lib LIBSUF=.a
169 libmpeg2/libmpeg2.a:
170 $(MAKE) -C libmpeg2
172 libvo/libvo.a:
173 $(MAKE) -C libvo
175 libao2/libao2.a:
176 $(MAKE) -C libao2
178 liba52/liba52.a:
179 $(MAKE) -C liba52
181 libfaad2/libfaad2.a:
182 $(MAKE) -C libfaad2
184 mp3lib/libMP3.a:
185 $(MAKE) -C mp3lib
187 libdha/libdha.so:
188 $(MAKE) -C libdha
190 vidix/libvidix.a:
191 $(MAKE) -C vidix
193 Gui/libgui.a:
194 $(MAKE) -C Gui
196 osdep/libosdep.a:
197 $(MAKE) -C osdep
199 postproc/libswscale.a:
200 $(MAKE) -C postproc
202 input/libinput.a:
203 $(MAKE) -C input
205 libmenu/libmenu.a:
206 $(MAKE) -C libmenu
208 libavcodec/libpostproc/libpostproc.so:
209 $(MAKE) -C libavcodec/libpostproc
211 MPLAYER_DEP = $(OBJS_MPLAYER) $(COMMON_DEPS)
213 ifeq ($(LIBMENU),yes)
214 MPLAYER_DEP += libmenu/libmenu.a
215 MENU_LIBS = libmenu/libmenu.a
216 PARTS += libmenu
217 else
218 MENU_LIBS =
219 endif
221 MENCODER_DEP = $(OBJS_MENCODER) $(COMMON_DEPS) libmpcodecs/libmpencoders.a
223 ifeq ($(VIDIX),yes)
224 VIDIX_LIBS = vidix/libvidix.a
225 else
226 VIDIX_LIBS =
227 endif
229 ifeq ($(TARGET_WIN32),yes)
230 OBJS_MPLAYER += osdep/mplayer-rc.o
231 endif
233 $(PRG): $(MPLAYER_DEP)
234 ifeq ($(TARGET_WIN32),yes)
235 windres -o osdep/mplayer-rc.o osdep/mplayer.rc
236 endif
237 $(CC) $(CFLAGS) -o $(PRG) $(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) $(ARCH_LIB) $(I18NLIBS) $(MATH_LIB)
239 mplayer.exe.spec.c: libmpcodecs/libmpcodecs.a
240 winebuild -fPIC -o mplayer.exe.spec.c -exe mplayer.exe -mcui \
241 libmpcodecs/ad_qtaudio.o libmpcodecs/vd_qtvideo.o \
242 -L/usr/local/lib/wine -lkernel32
244 mplayer.exe.so: $(MPLAYER_DEP) mplayer.exe.spec.c
245 $(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)
247 mplayer_wine.so: $(MPLAYER_DEP)
248 $(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)
250 ifeq ($(MENCODER),yes)
251 $(PRG_MENCODER): $(MENCODER_DEP)
252 $(CC) $(CFLAGS) -o $(PRG_MENCODER) $(OBJS_MENCODER) libmpcodecs/libmpencoders.a $(ENCORE_LIB) $(COMMON_LIBS) $(EXTRA_LIB) $(MLIB_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(ARCH_LIB) $(I18NLIBS) $(MATH_LIB)
253 endif
255 codecs.conf.h: $(PRG_CFG) etc/codecs.conf
256 ./$(PRG_CFG) ./etc/codecs.conf > $@
258 codec-cfg.o: codecs.conf.h
260 # Every mplayer dependency depends on version.h, to force building version.h
261 # first (in serial mode) before any other of the dependencies for a parallel make
262 # run. This is necessary, because the make rule for version.h removes objects
263 # in a recursive "make distclean" and we must wait for this "make distclean" to
264 # finish before we can start building new object files.
265 # help_mp.h is also required by a lot of files, so force generating it early.
266 $(MPLAYER_DEP): version.h help_mp.h
267 $(MENCODER_DEP): version.h help_mp.h
269 $(PRG_CFG): version.h codec-cfg.c codec-cfg.h
270 $(HOST_CC) $(CFLAGS) -g codec-cfg.c mp_msg.c -o $(PRG_CFG) -DCODECS2HTML $(EXTRA_LIB) $(I18NLIBS)
272 install: $(ALL_PRG)
273 ifeq ($(VIDIX),yes)
274 $(DO_MAKE)
275 endif
276 if test ! -d $(BINDIR) ; then mkdir -p $(BINDIR) ; fi
277 $(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG) $(BINDIR)/$(PRG)
278 ifeq ($(GUI),yes)
279 -ln -sf $(PRG) $(BINDIR)/gmplayer
280 endif
281 if test ! -d $(MANDIR)/man1 ; then mkdir -p $(MANDIR)/man1; fi
282 for i in $(MAN_LANG); do \
283 if test "$$i" = en ; then \
284 $(INSTALL) -c -m 644 DOCS/man/en/mplayer.1 $(MANDIR)/man1/mplayer.1 ; \
285 else \
286 mkdir -p $(MANDIR)/$$i/man1 ; \
287 $(INSTALL) -c -m 644 DOCS/man/$$i/mplayer.1 $(MANDIR)/$$i/man1/mplayer.1 ; \
288 fi ; \
289 done
290 ifeq ($(MENCODER),yes)
291 $(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG_MENCODER) $(BINDIR)/$(PRG_MENCODER)
292 for i in $(MAN_LANG); do \
293 if test "$$i" = en ; then \
294 ln -sf mplayer.1 $(MANDIR)/man1/mencoder.1 ; \
295 else \
296 ln -sf mplayer.1 $(MANDIR)/$$i/man1/mencoder.1 ; \
297 fi ; \
298 done
299 endif
300 @if test ! -d $(DATADIR) ; then mkdir -p $(DATADIR) ; fi
301 @if test ! -d $(DATADIR)/font ; then mkdir -p $(DATADIR)/font ; fi
302 @if test ! -f $(DATADIR)/font/font.desc ; then \
303 echo "*** Download font at http://www.mplayerhq.hu/homepage/dload.html" ; \
304 echo "*** for OSD/Subtitles support and extract to $(DATADIR)/font/" ; \
306 ifeq ($(GUI),yes)
307 @if test ! -d $(DATADIR)/Skin ; then mkdir -p $(DATADIR)/Skin ; fi
308 @echo "*** Download skin(s) at http://www.mplayerhq.hu/homepage/dload.html"
309 @echo "*** for GUI, and extract to $(DATADIR)/Skin/"
310 @if test ! -d $(prefix)/share/pixmaps ; then mkdir -p $(prefix)/share/pixmaps ; fi
311 $(INSTALL) -m 644 Gui/mplayer/pixmaps/mplayer-desktop.xpm $(prefix)/share/pixmaps/mplayer-desktop.xpm
312 @if test ! -d $(prefix)/share/applications ; then mkdir -p $(prefix)/share/applications ; fi
313 $(INSTALL) -m 644 etc/mplayer.desktop $(prefix)/share/applications/mplayer.desktop
314 endif
315 @if test ! -d $(CONFDIR) ; then mkdir -p $(CONFDIR) ; fi
316 @if test -f $(CONFDIR)/codecs.conf ; then mv -f $(CONFDIR)/codecs.conf $(CONFDIR)/codecs.conf.old ; fi
317 ifeq ($(DVDKIT_SHARED),yes)
318 ifeq ($(DVDKIT2),yes)
319 if test ! -d $(LIBDIR) ; then mkdir -p $(LIBDIR) ; fi
320 $(INSTALL) -m 755 $(INSTALLSTRIP) libmpdvdkit2/libmpdvdkit.so $(LIBDIR)/libmpdvdkit.so
321 else
322 ifeq ($(DVDKIT),yes)
323 if test ! -d $(LIBDIR) ; then mkdir -p $(LIBDIR) ; fi
324 $(INSTALL) -m 755 $(INSTALLSTRIP) libmpdvdkit/libmpdvdkit.so $(LIBDIR)/libmpdvdkit.so
325 endif
326 endif
327 endif
329 uninstall:
330 -rm -f $(BINDIR)/$(PRG) $(BINDIR)/gmplayer $(MANDIR)/man1/mplayer.1
331 -rm -f $(BINDIR)/$(PRG_MENCODER) $(MANDIR)/man1/mencoder.1
332 -rm -f $(prefix)/share/pixmaps/mplayer-desktop.xpm
333 -rm -f $(prefix)/share/applications/mplayer.desktop
334 -rm -f $(LIBDIR)/libmpdvdkit.so
335 for l in $(MAN_LANG); do \
336 if test "i$$l" != "en"; then \
337 -rm -f $(MANDIR)/$$l/man1/mplayer.1 $(MANDIR)/$$l/man1/mencoder.1 \
338 -rm -f $(MANDIR)/$$l/man1/gmplayer.1 \
339 fi \
340 done
341 ifeq ($(VIDIX),yes)
342 $(DO_MAKE)
343 endif
344 @echo "Uninstall completed"
346 clean:
347 -rm -f *.o *~ $(OBJS) codecs.conf.h
349 distclean: doxygen_clean
350 -rm -f *~ $(PRG) $(PRG_MENCODER) $(PRG_CFG) $(OBJS)
351 -rm -f *.o *.a .depend configure.log codecs.conf.h help_mp.h
352 @for a in $(PARTS); do $(MAKE) -C $$a distclean; done
354 strip:
355 strip -s $(ALL_PRG)
357 dep: depend
359 depend: help_mp.h
360 ./version.sh `$(CC) -dumpversion`
361 $(CC) -MM $(CFLAGS) -DCODECS2HTML mplayer.c mencoder.c $(SRCS_MPLAYER) $(SRCS_MENCODER) 1>.depend
362 @for a in $(PARTS); do $(MAKE) -C $$a dep; done
364 # ./configure must be run if it changed in CVS
365 config.h: configure
366 @echo "############################################################"
367 @echo "####### Please run ./configure again - it's changed! #######"
368 @echo "############################################################"
369 ifeq ($(wildcard .developer),)
370 @exit 1
371 endif
373 # do not rebuild after cvs commits if .developer file is present!
375 # rebuild at every config.h/config.mak change:
376 version.h:
377 ./version.sh `$(CC) -dumpversion`
378 ifeq ($(wildcard .developer),)
379 $(MAKE) distclean
380 endif
381 $(MAKE) depend
383 doxygen:
384 doxygen DOCS/tech/Doxyfile
386 doxygen_clean:
387 -rm -rf DOCS/tech/doxygen
389 help_mp.h: help/help_mp-en.h $(HELP_FILE)
390 @echo '// WARNING! This is a generated file. Do NOT edit.' > help_mp.h
391 @echo '// See the help/ subdir for the editable files.' >> help_mp.h
392 @echo '#include "$(HELP_FILE)"' >> help_mp.h
394 ifneq ($(HELP_FILE),help/help_mp-en.h)
395 @echo "Adding untranslated messages to help_mp.h"
396 @echo '// untranslated messages from the English master file:' >> help_mp.h
397 @help/help_diff.sh $(HELP_FILE) < help/help_mp-en.h >> help_mp.h
398 endif
400 # rebuild at every CVS update or config/makefile change:
401 ifeq ($(wildcard .developer),)
402 ifneq ($(wildcard CVS/Entries),)
403 version.h: CVS/Entries
404 endif
405 version.h: config.h config.mak Makefile
406 endif
409 # include dependencies to get make to recurse into lib dirs,
410 # if the user desires such behavior
412 ifneq ($(wildcard .libdeps),)
413 include .libdeps
414 endif
417 # include dependency files if they exist
419 ifneq ($(wildcard .depend),)
420 include .depend
421 endif