]> git.sesse.net Git - vlc/blob - Makefile
Finally fixed the A/52 TS input.
[vlc] / Makefile
1 ###############################################################################
2 # vlc (VideoLAN Client) main Makefile - (c)1998 VideoLAN
3 ###############################################################################
4
5 ifeq ($(shell [ ! -r Makefile.opts ] && echo 1),)
6     include Makefile.opts
7 endif
8 ifeq ($(shell [ ! -r Makefile.config ] && echo 1),)
9     include Makefile.config
10 endif
11
12 ###############################################################################
13 # Objects and files
14 ###############################################################################
15
16
17 # All possible plugin directories, needed for make clean
18 #
19 PLUGINS_DIR :=  a52 \
20                 aa \
21                 ac3_adec \
22                 ac3_spdif \
23                 access \
24                 alsa \
25                 arts \
26                 avi \
27                 beos \
28                 chroma \
29                 directx \
30                 downmix \
31                 dsp \
32                 dummy \
33                 dvd \
34                 dvdread \
35                 esd \
36                 familiar \
37                 fb \
38                 ffmpeg \
39                 filter \
40                 fx \
41                 ggi \
42                 glide \
43                 gtk \
44                 idct \
45                 imdct \
46                 kde \
47                 lirc \
48                 lpcm_adec \
49                 macosx \
50                 mad \
51                 memcpy \
52                 mga \
53                 motion \
54                 mpeg_system \
55                 mpeg_adec \
56                 mpeg_vdec \
57                 network \
58                 ogg \
59                 opie \
60                 qnx \
61                 qt \
62                 qte \
63                 satellite \
64                 sdl \
65                 spudec \
66                 text \
67                 vcd \
68                 win32 \
69                 x11
70
71 PLUGINS_TARGETS := a52/a52 \
72                 aa/aa \
73                 ac3_adec/ac3_adec \
74                 ac3_spdif/ac3_spdif \
75                 access/file \
76                 access/udp \
77                 access/http \
78                 alsa/alsa \
79                 arts/arts \
80                 avi/avi \
81                 beos/beos \
82                 chroma/chroma_i420_rgb \
83                 chroma/chroma_i420_rgb_mmx \
84                 chroma/chroma_i420_yuy2 \
85                 chroma/chroma_i420_yuy2_mmx \
86                 chroma/chroma_i422_yuy2 \
87                 chroma/chroma_i422_yuy2_mmx \
88                 chroma/chroma_i420_ymga \
89                 chroma/chroma_i420_ymga_mmx \
90                 directx/directx \
91                 downmix/downmix \
92                 downmix/downmixsse \
93                 downmix/downmix3dn \
94                 dsp/dsp \
95                 dummy/dummy \
96                 dummy/null \
97                 dvd/dvd \
98                 dvdread/dvdread \
99                 esd/esd \
100                 familiar/familiar \
101                 fb/fb \
102                 ffmpeg/ffmpeg \
103                 filter/filter_deinterlace \
104                 filter/filter_transform \
105                 filter/filter_invert \
106                 filter/filter_distort \
107                 filter/filter_wall \
108                 filter/filter_clone \
109                 filter/filter_crop \
110                 fx/fx_scope \
111                 ggi/ggi \
112                 glide/glide \
113                 gtk/gnome \
114                 gtk/gtk \
115                 idct/idct \
116                 idct/idctclassic \
117                 idct/idctmmx \
118                 idct/idctmmxext \
119                 idct/idctaltivec \
120                 imdct/imdct \
121                 imdct/imdct3dn \
122                 imdct/imdctsse \
123                 kde/kde \
124                 lirc/lirc \
125                 lpcm_adec/lpcm_adec \
126                 macosx/macosx \
127                 mad/mad \
128                 memcpy/memcpy \
129                 memcpy/memcpymmx \
130                 memcpy/memcpymmxext \
131                 memcpy/memcpy3dn \
132                 memcpy/memcpyaltivec \
133                 mga/mga \
134                 mga/xmga \
135                 motion/motion \
136                 motion/motionmmx \
137                 motion/motionmmxext \
138                 motion/motion3dnow \
139                 motion/motionaltivec \
140         mpeg_system/mpeg_audio \
141                 mpeg_system/mpeg_es \
142                 mpeg_system/mpeg_ps \
143                 mpeg_system/mpeg_ts \
144                 mpeg_system/mpeg_ts_dvbpsi \
145                 mpeg_adec/mpeg_adec \
146                 mpeg_vdec/mpeg_vdec \
147                 network/ipv4 \
148                 network/ipv6 \
149                 ogg/vorbis \
150                 opie/opie \
151                 qnx/qnx \
152                 qt/qt \
153                 qte/qte \
154                 satellite/satellite \
155                 sdl/sdl \
156                 spudec/spudec \
157                 text/logger \
158                 text/ncurses \
159                 text/rc \
160                 vcd/vcd \
161                 win32/waveout \
162                 win32/intfwin \
163                 x11/x11 \
164                 x11/xvideo
165
166 #
167 # C Objects
168
169 INTERFACE := main interface intf_msg intf_playlist intf_eject
170 INPUT := input input_ext-plugins input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
171 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
172 AUDIO_OUTPUT := audio_output aout_ext-dec aout_pcm aout_spdif
173 MISC := mtime modules configuration netutils iso_lang
174
175 C_OBJ :=        $(INTERFACE:%=src/interface/%.o) \
176                 $(INPUT:%=src/input/%.o) \
177                 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
178                 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
179                 $(MISC:%=src/misc/%.o)
180
181 #
182 # Misc Objects
183
184 ifeq ($(NEED_GETOPT),1)
185 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o 
186 endif
187
188 ifeq ($(NEED_SYMBOLS),1)
189 C_OBJ += src/misc/symbols.o
190 endif
191
192 ifeq ($(SYS),beos)
193 CPP_OBJ :=      src/misc/beos_specific.o
194 endif
195
196 ifneq (,$(findstring darwin,$(SYS)))
197 C_OBJ +=        src/misc/darwin_specific.o
198 endif
199
200 ifneq (,$(findstring mingw32,$(SYS)))
201 C_OBJ +=        src/misc/win32_specific.o
202 RESOURCE_OBJ := share/vlc_win32_rc.o
203 endif
204
205 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(M_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
206
207 #
208 # Generated header
209 #
210 H_OBJ :=        src/misc/modules_builtin.h
211
212 #
213 # Other lists of files
214 #
215 C_DEP := $(C_OBJ:%.o=.dep/%.d)
216 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
217
218 #
219 # Translate plugin names
220 #
221 ifneq (,$(PLUGINS))
222 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
223 endif
224 ifneq (,$(BUILTINS))
225 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
226 endif
227
228 #
229 # Misc variables
230 #
231 VERSION := $(shell grep '^ *VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
232
233 # All symbols must be exported
234 export
235
236 ###############################################################################
237 # Targets
238 ###############################################################################
239
240 #
241 # Virtual targets
242 #
243 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
244
245 Makefile.opts:
246         @echo "**** No configuration found, please run ./configure"
247         @exit 1
248 #       ./configure
249 #       $(MAKE) $(MAKECMDGOALS)
250 #       exit    
251
252 show:
253         @echo CC: $(CC)
254         @echo CFLAGS: $(CFLAGS)
255         @echo LDFLAGS: $(LDFLAGS)
256         @echo plugins_CFLAGS: $(plugins_CFLAGS)
257         @echo plugins_LDFLAGS: $(plugins_LDFLAGS)
258         @echo builtins_CFLAGS: $(builtins_CFLAGS)
259         @echo builtins_LDFLAGS: $(builtins_LDFLAGS)
260         @echo C_OBJ: $(C_OBJ)
261         @echo CPP_OBJ: $(CPP_OBJ)
262         @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
263         @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
264
265 #
266 # Cleaning rules
267 #
268 clean: plugins-clean po-clean vlc-clean
269         rm -f src/*/*.o extras/*/*.o
270         rm -f lib/*.so* lib/*.a
271         rm -f plugins/*.so plugins/*.a plugins/*.lib plugins/*.tds
272         rm -rf extras/MacOSX/build
273
274 po-clean:
275         -cd po && $(MAKE) clean
276
277 plugins-clean:
278         for dir in $(PLUGINS_DIR) ; do \
279                 ( cd plugins/$${dir} \
280                         && $(MAKE) -f ../../Makefile.modules clean ) ; done
281         rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
282
283 vlc-clean:
284         rm -f $(C_OBJ) $(CPP_OBJ)
285         rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
286         rm -Rf vlc.app
287
288 distclean: clean
289         -cd po && $(MAKE) maintainer-clean
290         rm -f **/*.o **/*~ *.log
291         rm -f Makefile.opts Makefile.config
292         rm -f include/defs.h include/modules_builtin.h
293         rm -f src/misc/modules_builtin.h
294         rm -f config*status config*cache config*log conftest*
295         rm -f gmon.out core build-stamp
296         rm -Rf .dep
297         rm -f .gdb_history
298
299 #
300 # Install/uninstall rules
301 #
302 install: vlc-install plugins-install po-install
303
304 uninstall: vlc-uninstall plugins-uninstall po-uninstall
305
306 vlc-install:
307         mkdir -p $(DESTDIR)$(bindir)
308         $(INSTALL) vlc $(DESTDIR)$(bindir)
309 ifneq (,$(ALIASES))
310         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
311 endif
312         mkdir -p $(DESTDIR)$(datadir)/videolan
313         $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
314         $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
315         $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
316
317 vlc-uninstall:
318         rm -f $(DESTDIR)$(bindir)/vlc
319 ifneq (,$(ALIASES))
320         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
321 endif
322         rm -f $(DESTDIR)$(datadir)/videolan/*.psf
323         rm -f $(DESTDIR)$(datadir)/videolan/*.png
324         rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
325
326 plugins-install:
327         mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
328 ifneq (,$(PLUGINS))
329         $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
330 endif
331
332 plugins-uninstall:
333         rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
334
335 po-install:
336         -cd po && $(MAKE) install
337
338 po-uninstall:
339         -cd po && $(MAKE) uninstall
340
341 #
342 # Package generation rules
343 #
344 dist:
345         # Check that tmp isn't in the way
346         @if test -e tmp; then \
347                 echo "Error: please remove ./tmp, it is in the way"; false; \
348         else \
349                 echo "OK."; mkdir tmp; \
350         fi
351         # Copy directory structure in tmp
352         find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
353                 do mkdir -p tmp/vlc/$$i ; \
354         done
355         rm -Rf tmp/vlc/tmp
356         find debian -mindepth 1 -maxdepth 1 -type d | \
357                 while read i ; do rm -Rf tmp/vlc/$$i ; done
358         # Copy .c .h .in .cpp .m and .glade files
359         find include src plugins -type f -name '*.[bcdhigmrst]*' | while read i ; \
360                 do cp $$i tmp/vlc/$$i ; done
361         # Grmbl... special case...
362         for i in API BUGS DESIGN TODO ; \
363                 do cp plugins/mad/$$i tmp/vlc/plugins/mad ; done
364         # Copy plugin Makefiles
365         find plugins -type f -name Makefile | while read i ; \
366                 do cp $$i tmp/vlc/$$i ; done
367         # Copy extra programs and documentation
368         cp -a extras/* tmp/vlc/extras
369         cp -a doc/* tmp/vlc/doc
370         find tmp/vlc/extras tmp/vlc/doc \
371                 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
372                         while read i ; do rm -Rf $$i ; done
373         # Copy gettext stuff
374         cp po/ChangeLog po/vlc.pot po/*.po tmp/vlc/po
375         for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
376         # Copy misc files
377         cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
378                 ABOUT-NLS BUGS plugins/LIST vlc.spec \
379                 Makefile Makefile.*.in Makefile.dep Makefile.modules \
380                 configure configure.in install-sh install-win32 macosx-dmg \
381                 config.sub config.guess aclocal.m4 mkinstalldirs \
382                         tmp/vlc/
383         # Copy Debian control files
384         for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
385                 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
386         for file in control changelog rules ; do \
387                 cp debian/$$file tmp/vlc/debian/ ; done
388         # Copy ipkg control files
389         for file in control rules patch ; do \
390                 cp ipkg/$$file tmp/vlc/ipkg/ ; done
391         # Copy fonts and icons
392         for file in share/*vlc* share/*psf; do \
393                 cp $$file tmp/vlc/share ; done
394         # Build archives
395         F=vlc-${VERSION}; \
396         mv tmp/vlc tmp/$$F; (cd tmp ; tar czf ../$$F.tar.gz $$F); \
397         # Clean up
398         rm -Rf tmp
399
400 package-win32:
401         # XXX: this rule is probably only useful to you if you have exactly
402         # the same setup as me. Contact sam@zoy.org if you need to use it.
403         #
404         # Check that tmp isn't in the way
405         @if test -e tmp; then \
406                 echo "Error: please remove ./tmp, it is in the way"; false; \
407         else \
408                 echo "OK."; mkdir tmp; \
409         fi
410         # Create installation script
411         cp install-win32 tmp/nsi
412         # Copy relevant files
413         cp vlc.exe tmp/ 
414         $(STRIP) tmp/vlc.exe
415         cp INSTALL.win32 tmp/INSTALL.txt ; unix2dos tmp/INSTALL.txt
416         for file in AUTHORS COPYING ChangeLog README FAQ TODO ; \
417                         do cp $$file tmp/$${file}.txt ; \
418                         unix2dos tmp/$${file}.txt ; done
419         mkdir tmp/plugins
420         cp $(PLUGINS:%=plugins/%.so) tmp/plugins/ 
421         # don't include these two
422         #rm -f tmp/plugins/gtk.so tmp/plugins/sdl.so
423 ifneq (,$(PLUGINS))
424         for i in $(PLUGINS) ; do if test $$i != intfwin ; then $(STRIP) tmp/plugins/$$i.so ; fi ; done
425 endif
426         mkdir tmp/share
427         for file in default8x16.psf default8x9.psf ; \
428                 do cp share/$$file tmp/share/ ; done
429         # Create package 
430         wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe -- /DVERSION=${VERSION} /CD tmp/nsi
431         # Clean up
432         rm -Rf tmp
433
434 package-beos:
435         # Check that tmp isn't in the way
436         @if test -e tmp; then \
437                 echo "Error: please remove ./tmp, it is in the way"; false; \
438         else \
439                 echo "OK."; mkdir tmp; \
440         fi
441         
442         # Create dir
443         mkdir -p tmp/vlc/share
444         # Copy relevant files
445         cp vlc tmp/vlc/
446         strip tmp/vlc/vlc
447         xres -o tmp/vlc/vlc ./share/vlc_beos.rsrc
448         cp AUTHORS COPYING ChangeLog README FAQ TODO tmp/vlc/
449         for file in default8x16.psf default8x9.psf ; \
450                 do cp share/$$file tmp/vlc/share/ ; done
451         mkdir tmp/vlc/plugins
452         cp $(PLUGINS:%=plugins/%.so) tmp/vlc/plugins/ 
453         strip $(PLUGINS:%=tmp/vlc/plugins/%.so)
454         # Create package 
455         mv tmp/vlc tmp/vlc-${VERSION}
456         (cd tmp ; find vlc-${VERSION} | \
457         zip -9 -@ vlc-${VERSION}-BeOS-x86.zip )
458         mv tmp/vlc-${VERSION}-BeOS-x86.zip .
459         # Clean up
460         rm -Rf tmp
461
462 package-macosx:
463         # Check that tmp isn't in the way
464         @if test -e tmp; then \
465                 echo "Error: please remove ./tmp, it is in the way"; false; \
466         else \
467                 echo "OK."; mkdir tmp; \
468         fi
469
470         # Copy relevant files 
471         cp -R vlc.app tmp/
472         cp AUTHORS COPYING ChangeLog README README.MacOSX.rtf FAQ TODO tmp/
473
474         # Create disk image 
475         ./macosx-dmg 0 "vlc-${VERSION}" tmp/* 
476
477         # Clean up
478         rm -Rf tmp
479
480 #
481 # Gtk/Gnome/* aliases and OS X application
482 #
483 gnome-vlc gvlc kvlc qvlc: vlc
484         rm -f $@ && ln -s vlc $@
485
486 .PHONY: vlc.app
487 vlc.app: vlc plugins
488 ifneq (,$(findstring darwin,$(SYS)))
489         rm -Rf vlc.app
490         cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t' | grep -v "^$$"
491         cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
492         $(INSTALL) -d vlc.app/Contents/MacOS/share
493         $(INSTALL) -d vlc.app/Contents/MacOS/plugins
494         $(INSTALL) vlc vlc.app/Contents/MacOS/
495 ifneq (,$(PLUGINS))
496         $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
497 endif
498         $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
499 endif
500
501 FORCE:
502
503 #
504 # Generic rules (see below)
505 #
506 $(H_OBJ): Makefile.opts Makefile.dep Makefile
507 #       @echo "regenerating $@"
508         @rm -f $@ && cp $@.in $@
509 ifneq (,$(BUILTINS))
510         @for i in $(BUILTINS) ; do \
511                 echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \
512                 echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \
513                 echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \
514         done
515         @echo "" >> $@ ;
516 endif
517         @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
518         @echo "    do \\" >> $@ ;
519         @echo "    { \\" >> $@ ;
520 ifneq (,$(BUILTINS))
521         @for i in $(BUILTINS) ; do \
522                 echo "        ALLOCATE_BUILTIN("$$i"); \\" >> $@ ; \
523         done
524 endif
525         @echo "    } while( 0 );" >> $@ ;
526         @echo "" >> $@ ;
527
528 $(C_DEP): %.d: FORCE
529         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
530
531 $(CPP_DEP): %.dpp: FORCE
532         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
533
534 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
535 $(C_OBJ): %.o: $(H_OBJ)
536 $(C_OBJ): %.o: .dep/%.d
537 $(C_OBJ): %.o: %.c
538         $(CC) $(CFLAGS) $(vlc_CFLAGS) -c -o $@ $<
539
540 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
541 $(CPP_OBJ): %.o: $(H_OBJ)
542 $(CPP_OBJ): %.o: .dep/%.dpp
543 $(CPP_OBJ): %.o: %.cpp
544         $(CC) $(CFLAGS) $(vlc_CFLAGS) -c -o $@ $<
545
546 $(M_OBJ): %.o: Makefile.opts Makefile.dep Makefile
547 $(M_OBJ): %.o: $(H_OBJ)
548 $(M_OBJ): %.o: .dep/%.dm
549 $(M_OBJ): %.o: %.m
550         $(CC) $(CFLAGS) $(vlc_CFLAGS) -c -o $@ $<
551
552 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
553 ifneq (,(findstring mingw32,$(SYS)))
554 $(RESOURCE_OBJ): %.o: %.rc
555         $(WINDRES) -i $< -o $@
556 endif
557
558 #
559 # Main application target
560 #
561 vlc: Makefile.config Makefile.opts Makefile.dep Makefile $(VLC_OBJ) $(BUILTIN_OBJ)
562         $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS) $(vlc_LDFLAGS) $(builtins_LDFLAGS)
563 ifeq ($(SYS),beos)
564         xres -o $@ ./share/vlc_beos.rsrc
565         mimeset -f $@
566 endif
567
568 #
569 # Plugins target
570 #
571 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
572 $(PLUGIN_OBJ): FORCE
573         @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
574
575 #
576 # Built-in modules target
577 #
578 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
579 $(BUILTIN_OBJ): FORCE
580         @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
581
582 #
583 # gettext target
584 #
585 po: FORCE
586         @cd po && $(MAKE)
587