cosmetics: reformatting
[mplayer/greg.git] / Makefile
blob9f79e1991be3dca7a3eb2a821855626fff54be5b
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 subopt-helper.c \
34 subreader.c \
35 vobsub.c \
37 SRCS_COMMON-$(UNRARLIB) += unrarlib.c
38 SRCS_COMMON-$(UNRAR_EXEC) += unrar_exec.c
40 SRCS_MPLAYER = mplayer.c \
41 m_property.c \
42 mp_fifo.c \
43 mp_msg.c \
44 mixer.c \
45 parser-mpcmd.c \
46 command.c \
48 SRCS_MENCODER = mencoder.c \
49 mp_msg-mencoder.c \
50 parser-mecmd.c \
51 xvid_vbr.c \
53 COMMON_LIBS = libmpcodecs/libmpcodecs.a \
54 libaf/libaf.a \
55 libmpdemux/libmpdemux.a \
56 stream/stream.a \
57 libswscale/libswscale.a \
58 libvo/libosd.a \
60 COMMON_LIBS-$(LIBAVFORMAT_A) += libavformat/libavformat.a
61 COMMON_LIBS-$(LIBAVCODEC_A) += libavcodec/libavcodec.a
62 COMMON_LIBS-$(LIBAVUTIL_A) += libavutil/libavutil.a
63 COMMON_LIBS-$(LIBPOSTPROC_A) += libpostproc/libpostproc.a
64 COMMON_LIBS-$(WIN32DLL) += loader/libloader.a
65 COMMON_LIBS-$(MP3LIB) += mp3lib/libmp3.a
66 COMMON_LIBS-$(LIBA52) += liba52/liba52.a
67 COMMON_LIBS-$(LIBMPEG2) += libmpeg2/libmpeg2.a
68 COMMON_LIBS-$(FAAD_INTERNAL) += libfaad2/libfaad2.a
69 COMMON_LIBS-$(TREMOR_INTERNAL) += tremor/libvorbisidec.a
70 COMMON_LIBS-$(DVDREAD_INTERNAL) += dvdread/libdvdread.a
71 COMMON_LIBS-$(DVDCSS_INTERNAL) += libdvdcss/libdvdcss.a
72 COMMON_LIBS-$(ASS) += libass/libass.a
74 LIBS_MPLAYER = libvo/libvo.a \
75 libao2/libao2.a \
76 input/libinput.a \
78 LIBS_MPLAYER-$(VIDIX) += vidix/libvidix.a
79 LIBS_MPLAYER-$(GUI) += gui/libgui.a
80 LIBS_MPLAYER-$(LIBMENU) += libmenu/libmenu.a
82 LIBS_MENCODER = libmpcodecs/libmpencoders.a \
83 libmpdemux/libmpmux.a \
85 # Having this in libosdep.a is not enough.
86 OBJS_MPLAYER-$(TARGET_WIN32) += osdep/mplayer-rc.o
88 ALL_PRG-$(MPLAYER) += mplayer$(EXESUF)
89 ALL_PRG-$(MENCODER) += mencoder$(EXESUF)
91 COMMON_LIBS += $(COMMON_LIBS-yes)
92 LIBS_MPLAYER += $(LIBS_MPLAYER-yes)
93 OBJS_MPLAYER += $(OBJS_MPLAYER-yes)
94 PARTS += $(PARTS-yes)
95 ALL_PRG += $(ALL_PRG-yes)
97 COMMON_LIBS += osdep/libosdep.a
99 MPLAYER_DEPS = $(OBJS_MPLAYER) $(OBJS_COMMON) $(LIBS_MPLAYER) $(COMMON_LIBS)
100 MENCODER_DEPS = $(OBJS_MENCODER) $(OBJS_COMMON) $(LIBS_MENCODER) $(COMMON_LIBS)
102 INSTALL_TARGETS-$(MPLAYER) += install-mplayer install-mplayer-man
103 INSTALL_TARGETS-$(MENCODER) += install-mencoder install-mplayer-man
104 INSTALL_TARGETS-$(GUI) += install-gui
105 INSTALL_TARGETS += $(INSTALL_TARGETS-yes)
107 PARTS = dvdread \
108 gui \
109 input \
110 liba52 \
111 libaf \
112 libao2 \
113 libass \
114 libavcodec \
115 libavformat \
116 libavutil \
117 libdvdcss \
118 libfaad2 \
119 libmenu \
120 libmpcodecs \
121 libmpdemux \
122 libmpeg2 \
123 libpostproc \
124 libswscale \
125 libvo \
126 loader \
127 mp3lib \
128 osdep \
129 stream \
130 tremor \
131 vidix \
134 all: $(ALL_PRG)
136 dep depend:: help_mp.h version.h codecs.conf.h
137 @for a in $(PARTS); do $(MAKE) -C $$a dep; done
139 include mpcommon.mak
141 CFLAGS := $(subst -I..,-I.,$(CFLAGS))
143 libaf/libaf.a:
144 $(MAKE) -C libaf
146 dvdread/libdvdread.a:
147 $(MAKE) -C dvdread
149 libdvdcss/libdvdcss.a:
150 $(MAKE) -C libdvdcss
152 loader/libloader.a:
153 $(MAKE) -C loader
155 libass/libass.a:
156 $(MAKE) -C libass
158 libmpdemux/libmpdemux.a:
159 $(MAKE) -C libmpdemux libmpdemux.a
161 libmpdemux/libmpmux.a:
162 $(MAKE) -C libmpdemux libmpmux.a
164 stream/stream.a:
165 $(MAKE) -C stream
167 libmpcodecs/libmpcodecs.a:
168 $(MAKE) -C libmpcodecs
170 libavutil/libavutil.a:
171 $(MAKE) -C libavutil
173 libavcodec/libavcodec.a:
174 $(MAKE) -C libavcodec
176 libpostproc/libpostproc.a:
177 $(MAKE) -C libpostproc
179 libavformat/libavformat.a:
180 $(MAKE) -C libavformat
182 libswscale/libswscale.a:
183 $(MAKE) -C libswscale
185 libmpeg2/libmpeg2.a:
186 $(MAKE) -C libmpeg2
188 libvo/libvo.a:
189 $(MAKE) -C libvo libvo.a
191 libvo/libosd.a:
192 $(MAKE) -C libvo libosd.a
194 libao2/libao2.a:
195 $(MAKE) -C libao2
197 liba52/liba52.a:
198 $(MAKE) -C liba52
200 libfaad2/libfaad2.a:
201 $(MAKE) -C libfaad2
203 mp3lib/libmp3.a:
204 $(MAKE) -C mp3lib
206 tremor/libvorbisidec.a:
207 $(MAKE) -C tremor
209 vidix/libvidix.a:
210 $(MAKE) -C vidix
212 gui/libgui.a:
213 $(MAKE) -C gui
215 osdep/libosdep.a:
216 $(MAKE) -C osdep
218 osdep/mplayer-rc.o: version.h
219 $(MAKE) -C osdep mplayer-rc.o
221 input/libinput.a:
222 $(MAKE) -C input
224 libmenu/libmenu.a:
225 $(MAKE) -C libmenu
227 mplayer$(EXESUF): $(MPLAYER_DEPS)
228 $(CC) -o $@ $^ $(LDFLAGS_MPLAYER)
230 mencoder$(EXESUF): $(MENCODER_DEPS)
231 $(CC) -o $@ $^ $(LDFLAGS_MENCODER)
233 codec-cfg$(EXESUF): codec-cfg.c codec-cfg.h help_mp.h
234 $(HOST_CC) -I. -DCODECS2HTML $< -o $@
236 codecs.conf.h: codec-cfg$(EXESUF) etc/codecs.conf
237 ./codec-cfg$(EXESUF) ./etc/codecs.conf > $@
239 codec-cfg.o: codecs.conf.h
241 codecs2html$(EXESUF): mp_msg.o
242 $(CC) -DCODECS2HTML codec-cfg.c $^ -o $@
244 codec-cfg-test$(EXESUF): codecs.conf.h codec-cfg.h mp_msg.o osdep/getch2.o
245 $(CC) -I. -DTESTING codec-cfg.c mp_msg.o osdep/getch2.o -ltermcap -o $@
247 install: install-dirs $(INSTALL_TARGETS)
249 install-dirs:
250 $(INSTALL) -d $(BINDIR)
251 $(INSTALL) -d $(DATADIR)
252 $(INSTALL) -d $(MANDIR)/man1
253 $(INSTALL) -d $(CONFDIR)
254 if test -f $(CONFDIR)/codecs.conf ; then mv -f $(CONFDIR)/codecs.conf $(CONFDIR)/codecs.conf.old ; fi
256 install-mplayer: mplayer$(EXESUF)
257 $(INSTALL) -m 755 $(INSTALLSTRIP) mplayer$(EXESUF) $(BINDIR)
259 install-mplayer-man:
260 for i in $(MAN_LANG); do \
261 if test "$$i" = en ; then \
262 $(INSTALL) -c -m 644 DOCS/man/en/mplayer.1 $(MANDIR)/man1/ ; \
263 else \
264 $(INSTALL) -d $(MANDIR)/$$i/man1 ; \
265 $(INSTALL) -c -m 644 DOCS/man/$$i/mplayer.1 $(MANDIR)/$$i/man1/ ; \
266 fi ; \
267 done
269 install-mencoder: mencoder$(EXESUF)
270 $(INSTALL) -m 755 $(INSTALLSTRIP) mencoder$(EXESUF) $(BINDIR)
271 for i in $(MAN_LANG); do \
272 if test "$$i" = en ; then \
273 cd $(MANDIR)/man1 && ln -sf mplayer.1 mencoder.1 ; \
274 else \
275 cd $(MANDIR)/$$i/man1 && ln -sf mplayer.1 mencoder.1 ; \
276 fi ; \
277 done
279 install-gui:
280 -ln -sf mplayer$(EXESUF) $(BINDIR)/gmplayer$(EXESUF)
281 $(INSTALL) -d $(DATADIR)/skins
282 @echo "*** Download skin(s) at http://www.mplayerhq.hu/design7/dload.html"
283 @echo "*** for GUI, and extract to $(DATADIR)/skins/"
284 $(INSTALL) -d $(prefix)/share/pixmaps
285 $(INSTALL) -m 644 etc/mplayer.xpm $(prefix)/share/pixmaps/
286 $(INSTALL) -d $(prefix)/share/applications
287 $(INSTALL) -m 644 etc/mplayer.desktop $(prefix)/share/applications/
289 uninstall:
290 -rm -f $(BINDIR)/mplayer$(EXESUF) $(BINDIR)/gmplayer$(EXESUF)
291 -rm -f $(BINDIR)/mencoder$(EXESUF)
292 -rm -f $(MANDIR)/man1/mencoder.1 $(MANDIR)/man1/mplayer.1
293 -rm -f $(prefix)/share/pixmaps/mplayer.xpm
294 -rm -f $(prefix)/share/applications/mplayer.desktop
295 for l in $(MAN_LANG); do \
296 if test "$$l" != "en"; then \
297 rm -f $(MANDIR)/$$l/man1/mplayer.1 \
298 $(MANDIR)/$$l/man1/mencoder.1 \
299 $(MANDIR)/$$l/man1/gmplayer.1 ; \
300 fi ; \
301 done
303 clean::
304 -rm -f mplayer$(EXESUF) mencoder$(EXESUF) codec-cfg$(EXESUF) \
305 codecs2html$(EXESUF) codec-cfg-test$(EXESUF) cpuinfo$(EXESUF) \
306 codecs.conf.h help_mp.h version.h
307 @for a in $(PARTS); do $(MAKE) -C $$a clean; done
309 distclean:: doxygen_clean
310 @for a in $(PARTS); do $(MAKE) -C $$a distclean; done
311 $(MAKE) -C TOOLS distclean
312 -rm -f configure.log config.mak config.h
314 strip:
315 strip -s $(ALL_PRG)
317 # ./configure must be rerun if it changed
318 config.mak: configure
319 @echo "############################################################"
320 @echo "####### Please run ./configure again - it's changed! #######"
321 @echo "############################################################"
323 # rebuild at every config.h/config.mak/Makefile change:
324 version.h: config.h config.mak Makefile
325 ./version.sh `$(CC) -dumpversion`
327 doxygen:
328 doxygen DOCS/tech/Doxyfile
330 doxygen_clean:
331 -rm -rf DOCS/tech/doxygen
333 help_mp.h: help/help_mp-en.h $(HELP_FILE)
334 @echo '// WARNING! This is a generated file. Do NOT edit.' > help_mp.h
335 @echo '// See the help/ subdir for the editable files.' >> help_mp.h
336 ifeq ($(CHARSET),)
337 @echo '#include "$(HELP_FILE)"' >> help_mp.h
338 else
339 iconv -f UTF-8 -t $(CHARSET) "$(HELP_FILE)" >> help_mp.h
340 endif
342 ifneq ($(HELP_FILE),help/help_mp-en.h)
343 @echo "Adding untranslated messages to help_mp.h"
344 @echo '// untranslated messages from the English master file:' >> help_mp.h
345 @help/help_diff.sh $(HELP_FILE) < help/help_mp-en.h >> help_mp.h
346 endif
348 # explicit dependencies to force version.h to be built even if .depend is missing
349 mplayer.o mencoder.o vobsub.o: version.h
351 # temporary measure to make sure help_mp.h is built. we desperately need correct deps!
352 $(MPLAYER_DEPS) $(MENCODER_DEPS): help_mp.h
355 # the following lines provide _partial_ dependency information
356 # for the 'library' directories under main dir, in order to cause
357 # the build process to recursively descend into them if something
358 # has changed. ideally this will be replaced with a single
359 # nonrecursive makefile for the whole project.
361 # Now all directories are recursed by default because these rules do not
362 # consider dependencies on files in other directories, while the recursively
363 # invoked Makefiles do. Conditional recursion only to the directories with
364 # changed files can be enabled by creating a file named ".norecurse" and
365 # optionally giving it a timestamp in the past. Directories whose .a files
366 # are newer than the timestamp and newer than other files in the directory
367 # will not be recursed.
368 .norecurse:
370 libvo/libvo.a: .norecurse $(wildcard libvo/*.[ch])
371 libvo/libosd.a: .norecurse $(wildcard libvo/*.[ch])
372 libao2/libao2.a: .norecurse $(wildcard libao2/*.[ch])
373 osdep/libosdep.a: .norecurse $(wildcard osdep/*.[ch])
374 input/libinput.a: .norecurse $(wildcard input/*.[ch])
376 libmenu/libmenu.a: .norecurse $(wildcard libmenu/*.[ch])
377 libaf/libaf.a: .norecurse $(wildcard libaf/*.[ch])
378 dvdread/libdvdread.a: .norecurse $(wildcard dvdread/*.[ch])
379 libdvdcss/libdvdcss.a: .norecurse $(wildcard libdvdcss/*.[ch])
381 libmpdemux/libmpdemux.a: .norecurse $(wildcard libmpdemux/*.[ch])
382 libmpdemux/libmpmux.a: .norecurse $(wildcard libmpdemux/*.[ch])
383 stream/stream.a: .norecurse $(wildcard stream/*.[ch] stream/*/*.[ch])
384 libmpcodecs/libmpcodecs.a: .norecurse $(wildcard libmpcodecs/*.[ch]) $(wildcard libmpcodecs/native/*.[ch])
385 libmpcodecs/libmpencoders.a: .norecurse $(wildcard libmpcodecs/*.[ch])
387 libavutil/libavutil.a: .norecurse $(wildcard libavutil/*.[ch])
388 libavcodec/libavcodec.a: .norecurse $(wildcard libavcodec/*.[ch] libavcodec/*/*.[chS])
389 libavformat/libavformat.a: .norecurse $(wildcard libavformat/*.[ch])
390 libswscale/libswscale.a: .norecurse $(wildcard libswscale/*.[ch])
392 libmpeg2/libmpeg2.a: .norecurse $(wildcard libmpeg2/*.[ch])
393 liba52/liba52.a: .norecurse $(wildcard liba52/*.[ch])
394 mp3lib/libmp3.a: .norecurse $(wildcard mp3lib/*.[ch])
395 libfaad2/libfaad2.a: .norecurse $(wildcard libfaad2/*.[ch] libfaad2/*/*.[ch])
397 loader/libloader.a: .norecurse $(wildcard loader/*.[chSs])
398 vidix/libvidix.a: .norecurse $(wildcard vidix/*.[ch])
399 gui/libgui.a: .norecurse $(wildcard gui/*.[ch] gui/*/*.[ch] gui/*/*/*.[ch])
401 libass/libass.a: .norecurse $(wildcard libass/*.[ch])
403 .PHONY: all install* uninstall strip doxygen doxygen_clean