1 ###############################################################################
2 # vlc (VideoLAN Client) main Makefile - (c)1998 VideoLAN
3 ###############################################################################
5 ifeq ($(shell [ ! -r Makefile.opts ] && echo 1),)
9 ###############################################################################
11 ###############################################################################
14 # All possible plugin directories, needed for make clean
16 PLUGINS_DIR := ac3_adec \
53 PLUGINS_TARGETS := ac3_adec/ac3_adec \
58 chroma/chroma_i420_rgb \
59 chroma/chroma_i420_rgb_mmx \
60 chroma/chroma_i420_yuy2 \
61 chroma/chroma_i420_yuy2_mmx \
62 chroma/chroma_i422_yuy2 \
63 chroma/chroma_i422_yuy2_mmx \
64 chroma/chroma_i420_ymga \
65 chroma/chroma_i420_ymga_mmx \
74 filter/filter_deinterlace \
75 filter/filter_transform \
76 filter/filter_invert \
77 filter/filter_distort \
100 memcpy/memcpymmxext \
105 motion/motionmmxext \
107 motion/motionaltivec \
108 mpeg_system/mpeg_es \
109 mpeg_system/mpeg_ps \
110 mpeg_system/mpeg_ts \
111 mpeg_adec/mpeg_adec \
112 mpeg_vdec/mpeg_vdec \
125 INTERFACE := main interface intf_msg intf_playlist
126 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
127 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
128 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
129 MISC := mtime modules netutils iso_lang
131 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
132 $(INPUT:%=src/input/%.o) \
133 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
134 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
135 $(MISC:%=src/misc/%.o)
140 ifeq ($(NEED_GETOPT),1)
141 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
145 CPP_OBJ := src/misc/beos_specific.o
148 ifneq (,$(findstring darwin,$(SYS)))
149 C_OBJ += src/misc/darwin_specific.o
152 ifneq (,$(findstring mingw32,$(SYS)))
153 C_OBJ += src/misc/win32_specific.o
154 RESOURCE_OBJ := share/vlc_win32_rc.o
157 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
162 H_OBJ := src/misc/modules_builtin.h
165 # Included headers which don't get noticed by Makefile.dep
167 H_DEP := videolan/vlc.h \
183 # Other lists of files
185 C_DEP := $(C_OBJ:%.o=.dep/%.d)
186 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
189 # Translate plugin names
192 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
195 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
201 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
202 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
205 # All symbols must be exported
208 ###############################################################################
210 ###############################################################################
215 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
218 @echo "**** No configuration found, please run ./configure"
221 # $(MAKE) $(MAKECMDGOALS)
226 @echo CFLAGS: $(CFLAGS)
227 @echo DCFLAGS: $(DCFLAGS)
228 @echo LDFLAGS: $(LDFLAGS)
229 @echo PCFLAGS: $(PCFLAGS)
230 @echo PLDFLAGS: $(PLDFLAGS)
231 @echo C_OBJ: $(C_OBJ)
232 @echo CPP_OBJ: $(CPP_OBJ)
233 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
234 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
239 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
240 rm -f src/*/*.o extras/*/*.o
241 rm -f lib/*.so* lib/*.a
242 rm -f plugins/*.so plugins/*.a
243 rm -rf extras/MacOSX/build
246 -cd extras/libdvdcss && $(MAKE) clean
249 -cd po && $(MAKE) clean
252 -cd extras/libdvdread && $(MAKE) clean
255 for dir in $(PLUGINS_DIR) ; do \
256 ( cd plugins/$${dir} \
257 && $(MAKE) -f ../../Makefile.modules clean ) ; done
258 rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
261 rm -f $(C_OBJ) $(CPP_OBJ)
262 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
266 -cd po && $(MAKE) maintainer-clean
267 rm -f **/*.o **/*~ *.log
269 rm -f include/defs.h include/modules_builtin.h
270 rm -f src/misc/modules_builtin.h
271 rm -f config*status config*cache config*log
272 rm -f gmon.out core build-stamp
277 # Install/uninstall rules
279 install: libdvdcss-install vlc-install plugins-install po-install
281 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
284 mkdir -p $(DESTDIR)$(bindir)
285 $(INSTALL) vlc $(DESTDIR)$(bindir)
287 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
289 mkdir -p $(DESTDIR)$(datadir)/videolan
290 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
291 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
292 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
295 rm -f $(DESTDIR)$(bindir)/vlc
297 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
299 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
300 rm -f $(DESTDIR)$(datadir)/videolan/*.png
301 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
304 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
306 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
310 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
313 -cd extras/libdvdcss && $(MAKE) install
316 -cd extras/libdvdcss && $(MAKE) uninstall
319 -cd po && $(MAKE) install
322 -cd po && $(MAKE) uninstall
325 # Package generation rules
328 # Check that tmp isn't in the way
329 @if test -e tmp; then \
330 echo "Error: please remove ./tmp, it is in the way"; false; \
332 echo "OK."; mkdir tmp; \
334 # Copy directory structure in tmp
335 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
336 do mkdir -p tmp/vlc/$$i ; \
339 find debian -mindepth 1 -maxdepth 1 -type d | \
340 while read i ; do rm -Rf tmp/vlc/$$i ; done
341 # Copy .c .h .in .cpp and .glade files
342 find include src plugins -type f -name '*.[chig]*' | while read i ; \
343 do cp $$i tmp/vlc/$$i ; done
344 # Copy plugin Makefiles
345 find plugins -type f -name Makefile | while read i ; \
346 do cp $$i tmp/vlc/$$i ; done
347 # Copy extra programs and documentation
348 cp -a extras/* tmp/vlc/extras
349 cp -a doc/* tmp/vlc/doc
350 find tmp/vlc/extras tmp/vlc/doc \
351 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
352 while read i ; do rm -Rf $$i ; done
354 cp po/*.po tmp/vlc/po
355 for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
357 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
358 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
359 configure configure.in install-sh install-win32 vlc.spec \
360 config.sub config.guess acconfig.h aclocal.m4 mkinstalldirs \
362 # Copy Debian control files
363 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
364 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
365 for file in control changelog rules ; do \
366 cp debian/$$file tmp/vlc/debian/ ; done
367 # Copy ipkg control files
368 for file in control rules ; do \
369 cp ipkg/$$file tmp/vlc/ipkg/ ; done
370 # Copy fonts and icons
371 for file in share/*png share/*xpm share/*psf ; do \
372 cp $$file tmp/vlc/share ; done
373 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
374 cp share/$$file tmp/vlc/share/ ; done
376 snapshot: snapshot-common
378 F=vlc-${VLC_QUICKVERSION}; \
379 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
380 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
381 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
385 snapshot-nocss: snapshot-common
387 rm -Rf tmp/vlc/extras/libdvdcss
388 rm -f tmp/vlc/*.libdvdcss
389 # Fix debian information
390 rm -f tmp/vlc/debian/libdvdcss*
391 rm -f tmp/vlc/debian/control
392 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
393 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
394 > tmp/vlc/debian/control
395 rm -f tmp/vlc/debian/rules
396 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
397 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
398 > tmp/vlc/debian/rules
399 chmod +x tmp/vlc/debian/rules
400 # Build css-disabled archives
401 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
402 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
403 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
404 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
409 # XXX: this rule is probably only useful to you if you have exactly
410 # the same setup as me. Contact sam@zoy.org if you need to use it.
412 # Check that tmp isn't in the way
413 @if test -e tmp; then \
414 echo "Error: please remove ./tmp, it is in the way"; false; \
416 echo "OK."; mkdir tmp; \
418 # Create installation script
419 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
420 # Copy relevant files
421 cp vlc.exe $(PLUGINS:%=plugins/%.so) tmp/
422 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
423 README README.libdvdcss FAQ TODO tmp/
424 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
425 gnu-intl.dll SDL.dll README-SDL.txt ; \
426 do cp ${DLL_PATH}/$$file tmp/ ; done
428 for file in default8x16.psf default8x9.psf ; \
429 do cp share/$$file tmp/share/ ; done
431 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
432 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
433 vlc-${VLC_QUICKVERSION}-win32-installer.exe
438 # Check that tmp isn't in the way
439 @if test -e tmp; then \
440 echo "Error: please remove ./tmp, it is in the way"; false; \
442 echo "OK."; mkdir tmp; \
446 mkdir -p tmp/vlc/share
447 # Copy relevant files
449 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
450 README README.libdvdcss FAQ TODO tmp/vlc/
451 for file in default8x16.psf default8x9.psf ; \
452 do cp share/$$file tmp/vlc/share/ ; done
454 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
455 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
456 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
457 mv tmp/vlc-${VLC_QUICKVERSION}-BeOS-x86.zip .
461 libdvdcss-snapshot: snapshot-common
462 # Remove vlc sources and icons, doc, debian directory...
463 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
464 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
465 rm -Rf tmp/vlc/debian
467 # Remove useless headers
468 rm -f tmp/vlc/include/*
469 for file in defs.h.in config.h common.h int_types.h ; \
470 do cp include/$$file tmp/vlc/include/ ; done
471 # Remove misc files (??? - maybe not really needed)
472 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
473 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
474 mv tmp/vlc/README.libdvdcss tmp/vlc/README
475 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
477 rm -f tmp/vlc/Makefile
478 sed -e 's#^install:#install-unused:#' \
479 -e 's#^uninstall:#uninstall-unused:#' \
480 -e 's#^clean:#clean-unused:#' \
481 -e 's#^all:.*#all: libdvdcss#' \
482 -e 's#^libdvdcss-install:#install:#' \
483 -e 's#^libdvdcss-uninstall:#uninstall:#' \
484 -e 's#^libdvdcss-clean:#clean:#' \
485 < Makefile > tmp/vlc/Makefile
487 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
488 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
489 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
490 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
495 dpkg-buildpackage -rfakeroot -us -uc
498 # Gtk/Gnome/* aliases and OS X application
500 gnome-vlc gvlc kvlc qvlc: vlc
501 rm -f $@ && ln -s vlc $@
504 vlc.app: Makefile.opts
505 ifneq (,$(findstring darwin,$(SYS)))
507 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
508 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
509 $(INSTALL) -d vlc.app/Contents/MacOS/share
510 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
511 $(INSTALL) vlc vlc.app/Contents/MacOS/
513 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
515 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
521 # Generic rules (see below)
523 $(H_OBJ): Makefile.opts Makefile.dep Makefile
524 # @echo "regenerating $@"
525 @rm -f $@ && cp $@.in $@
527 @for i in $(BUILTINS) ; do \
528 echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \
529 echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \
530 echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \
534 @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
535 @echo " do \\" >> $@ ;
536 @echo " { \\" >> $@ ;
538 @for i in $(BUILTINS) ; do \
539 echo " ALLOCATE_BUILTIN("$$i"); \\" >> $@ ; \
542 @echo " } while( 0 );" >> $@ ;
546 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
548 $(CPP_DEP): %.dpp: FORCE
549 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
551 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
552 $(C_OBJ): %.o: $(H_OBJ) $(H_DEP:%=include/%)
553 $(C_OBJ): %.o: .dep/%.d
555 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
557 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
558 $(CPP_OBJ): %.o: $(H_OBJ) $(H_DEP:%=include/%)
559 $(CPP_OBJ): %.o: .dep/%.dpp
560 $(CPP_OBJ): %.o: %.cpp
561 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
563 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
564 ifneq (,(findstring mingw32,$(SYS)))
565 $(RESOURCE_OBJ): %.o: %.rc
566 $(WINDRES) -i $< -o $@
570 # Main application target
572 vlc: Makefile.opts Makefile.dep Makefile $(VLC_OBJ) $(BUILTIN_OBJ)
573 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS)
575 xres -o $@ ./share/vlc_beos.rsrc
582 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
584 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
587 # Built-in modules target
589 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
590 $(BUILTIN_OBJ): FORCE
591 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
596 libdvdcss: Makefile.opts
597 @cd extras/libdvdcss && $(MAKE)
602 libdvdread: Makefile.opts
603 @cd extras/libdvdread && $(MAKE)