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 \
106 motion/motionmmxext \
108 motion/motionaltivec \
109 mpeg_system/mpeg_es \
110 mpeg_system/mpeg_ps \
111 mpeg_system/mpeg_ts \
112 mpeg_adec/mpeg_adec \
113 mpeg_vdec/mpeg_vdec \
126 INTERFACE := main interface intf_msg intf_playlist intf_eject
127 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
128 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
129 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
130 MISC := mtime modules netutils iso_lang
132 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
133 $(INPUT:%=src/input/%.o) \
134 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
135 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
136 $(MISC:%=src/misc/%.o)
141 ifeq ($(NEED_GETOPT),1)
142 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
146 CPP_OBJ := src/misc/beos_specific.o
149 ifneq (,$(findstring darwin,$(SYS)))
150 C_OBJ += src/misc/darwin_specific.o
153 ifneq (,$(findstring mingw32,$(SYS)))
154 C_OBJ += src/misc/win32_specific.o
155 RESOURCE_OBJ := share/vlc_win32_rc.o
158 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
163 H_OBJ := src/misc/modules_builtin.h
166 # Included headers which don't get noticed by Makefile.dep
168 H_DEP := videolan/vlc.h \
184 # Other lists of files
186 C_DEP := $(C_OBJ:%.o=.dep/%.d)
187 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
190 # Translate plugin names
193 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
196 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
202 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
203 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
206 # All symbols must be exported
209 ###############################################################################
211 ###############################################################################
216 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
219 @echo "**** No configuration found, please run ./configure"
222 # $(MAKE) $(MAKECMDGOALS)
227 @echo CFLAGS: $(CFLAGS)
228 @echo DCFLAGS: $(DCFLAGS)
229 @echo LDFLAGS: $(LDFLAGS)
230 @echo PCFLAGS: $(PCFLAGS)
231 @echo PLDFLAGS: $(PLDFLAGS)
232 @echo C_OBJ: $(C_OBJ)
233 @echo CPP_OBJ: $(CPP_OBJ)
234 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
235 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
240 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
241 rm -f src/*/*.o extras/*/*.o
242 rm -f lib/*.so* lib/*.a
243 rm -f plugins/*.so plugins/*.a
244 rm -rf extras/MacOSX/build
247 -cd extras/libdvdcss && $(MAKE) clean
250 -cd po && $(MAKE) clean
253 -cd extras/libdvdread && $(MAKE) clean
256 for dir in $(PLUGINS_DIR) ; do \
257 ( cd plugins/$${dir} \
258 && $(MAKE) -f ../../Makefile.modules clean ) ; done
259 rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
262 rm -f $(C_OBJ) $(CPP_OBJ)
263 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
267 -cd po && $(MAKE) maintainer-clean
268 rm -f **/*.o **/*~ *.log
270 rm -f include/defs.h include/modules_builtin.h
271 rm -f src/misc/modules_builtin.h
272 rm -f config*status config*cache config*log
273 rm -f gmon.out core build-stamp
278 # Install/uninstall rules
280 install: libdvdcss-install vlc-install plugins-install po-install
282 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
285 mkdir -p $(DESTDIR)$(bindir)
286 $(INSTALL) vlc $(DESTDIR)$(bindir)
288 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
290 mkdir -p $(DESTDIR)$(datadir)/videolan
291 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
292 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
293 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
296 rm -f $(DESTDIR)$(bindir)/vlc
298 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
300 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
301 rm -f $(DESTDIR)$(datadir)/videolan/*.png
302 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
305 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
307 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
311 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
314 -cd extras/libdvdcss && $(MAKE) install
317 -cd extras/libdvdcss && $(MAKE) uninstall
320 -cd po && $(MAKE) install
323 -cd po && $(MAKE) uninstall
326 # Package generation rules
329 # Check that tmp isn't in the way
330 @if test -e tmp; then \
331 echo "Error: please remove ./tmp, it is in the way"; false; \
333 echo "OK."; mkdir tmp; \
335 # Copy directory structure in tmp
336 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
337 do mkdir -p tmp/vlc/$$i ; \
340 find debian -mindepth 1 -maxdepth 1 -type d | \
341 while read i ; do rm -Rf tmp/vlc/$$i ; done
342 # Copy .c .h .in .cpp and .glade files
343 find include src plugins -type f -name '*.[chig]*' | while read i ; \
344 do cp $$i tmp/vlc/$$i ; done
345 # Copy plugin Makefiles
346 find plugins -type f -name Makefile | while read i ; \
347 do cp $$i tmp/vlc/$$i ; done
348 # Copy extra programs and documentation
349 cp -a extras/* tmp/vlc/extras
350 cp -a doc/* tmp/vlc/doc
351 find tmp/vlc/extras tmp/vlc/doc \
352 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
353 while read i ; do rm -Rf $$i ; done
355 cp po/*.po tmp/vlc/po
356 for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
358 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
359 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
360 configure configure.in install-sh install-win32 vlc.spec \
361 config.sub config.guess acconfig.h aclocal.m4 mkinstalldirs \
363 # Copy Debian control files
364 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
365 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
366 for file in control changelog rules ; do \
367 cp debian/$$file tmp/vlc/debian/ ; done
368 # Copy ipkg control files
369 for file in control rules ; do \
370 cp ipkg/$$file tmp/vlc/ipkg/ ; done
371 # Copy fonts and icons
372 for file in share/*png share/*xpm share/*psf ; do \
373 cp $$file tmp/vlc/share ; done
374 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
375 cp share/$$file tmp/vlc/share/ ; done
377 snapshot: snapshot-common
379 F=vlc-${VLC_QUICKVERSION}; \
380 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
381 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
382 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
386 snapshot-nocss: snapshot-common
388 rm -Rf tmp/vlc/extras/libdvdcss
389 rm -f tmp/vlc/*.libdvdcss
390 # Fix debian information
391 rm -f tmp/vlc/debian/libdvdcss*
392 rm -f tmp/vlc/debian/control
393 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
394 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
395 > tmp/vlc/debian/control
396 rm -f tmp/vlc/debian/rules
397 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
398 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
399 > tmp/vlc/debian/rules
400 chmod +x tmp/vlc/debian/rules
401 # Build css-disabled archives
402 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
403 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
404 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
405 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
410 # XXX: this rule is probably only useful to you if you have exactly
411 # the same setup as me. Contact sam@zoy.org if you need to use it.
413 # Check that tmp isn't in the way
414 @if test -e tmp; then \
415 echo "Error: please remove ./tmp, it is in the way"; false; \
417 echo "OK."; mkdir tmp; \
419 # Create installation script
420 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
421 # Copy relevant files
422 cp vlc.exe $(PLUGINS:%=plugins/%.so) tmp/
423 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
424 README README.libdvdcss FAQ TODO tmp/
425 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
426 gnu-intl.dll SDL.dll README-SDL.txt ; \
427 do cp ${DLL_PATH}/$$file tmp/ ; done
429 for file in default8x16.psf default8x9.psf ; \
430 do cp share/$$file tmp/share/ ; done
432 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
433 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
434 vlc-${VLC_QUICKVERSION}-win32-installer.exe
439 # Check that tmp isn't in the way
440 @if test -e tmp; then \
441 echo "Error: please remove ./tmp, it is in the way"; false; \
443 echo "OK."; mkdir tmp; \
447 mkdir -p tmp/vlc/share
448 # Copy relevant files
450 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
451 README README.libdvdcss FAQ TODO tmp/vlc/
452 for file in default8x16.psf default8x9.psf ; \
453 do cp share/$$file tmp/vlc/share/ ; done
455 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
456 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
457 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
458 mv tmp/vlc-${VLC_QUICKVERSION}-BeOS-x86.zip .
462 libdvdcss-snapshot: snapshot-common
463 # Remove vlc sources and icons, doc, debian directory...
464 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
465 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
466 rm -Rf tmp/vlc/debian
468 # Remove useless headers
469 rm -f tmp/vlc/include/*
470 for file in defs.h.in config.h common.h int_types.h ; \
471 do cp include/$$file tmp/vlc/include/ ; done
472 # Remove misc files (??? - maybe not really needed)
473 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
474 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
475 mv tmp/vlc/README.libdvdcss tmp/vlc/README
476 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
478 rm -f tmp/vlc/Makefile
479 sed -e 's#^install:#install-unused:#' \
480 -e 's#^uninstall:#uninstall-unused:#' \
481 -e 's#^clean:#clean-unused:#' \
482 -e 's#^all:.*#all: libdvdcss#' \
483 -e 's#^libdvdcss-install:#install:#' \
484 -e 's#^libdvdcss-uninstall:#uninstall:#' \
485 -e 's#^libdvdcss-clean:#clean:#' \
486 < Makefile > tmp/vlc/Makefile
488 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
489 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
490 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
491 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
496 dpkg-buildpackage -rfakeroot -us -uc
499 # Gtk/Gnome/* aliases and OS X application
501 gnome-vlc gvlc kvlc qvlc: vlc
502 rm -f $@ && ln -s vlc $@
505 vlc.app: Makefile.opts
506 ifneq (,$(findstring darwin,$(SYS)))
508 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
509 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
510 $(INSTALL) -d vlc.app/Contents/MacOS/share
511 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
512 $(INSTALL) vlc vlc.app/Contents/MacOS/
514 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
516 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
522 # Generic rules (see below)
524 $(H_OBJ): Makefile.opts Makefile.dep Makefile
525 # @echo "regenerating $@"
526 @rm -f $@ && cp $@.in $@
528 @for i in $(BUILTINS) ; do \
529 echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \
530 echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \
531 echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \
535 @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
536 @echo " do \\" >> $@ ;
537 @echo " { \\" >> $@ ;
539 @for i in $(BUILTINS) ; do \
540 echo " ALLOCATE_BUILTIN("$$i"); \\" >> $@ ; \
543 @echo " } while( 0 );" >> $@ ;
547 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
549 $(CPP_DEP): %.dpp: FORCE
550 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
552 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
553 $(C_OBJ): %.o: $(H_OBJ) $(H_DEP:%=include/%)
554 $(C_OBJ): %.o: .dep/%.d
556 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
558 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
559 $(CPP_OBJ): %.o: $(H_OBJ) $(H_DEP:%=include/%)
560 $(CPP_OBJ): %.o: .dep/%.dpp
561 $(CPP_OBJ): %.o: %.cpp
562 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
564 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
565 ifneq (,(findstring mingw32,$(SYS)))
566 $(RESOURCE_OBJ): %.o: %.rc
567 $(WINDRES) -i $< -o $@
571 # Main application target
573 vlc: Makefile.opts Makefile.dep Makefile $(VLC_OBJ) $(BUILTIN_OBJ)
574 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS)
576 xres -o $@ ./share/vlc_beos.rsrc
583 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
585 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
588 # Built-in modules target
590 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
591 $(BUILTIN_OBJ): FORCE
592 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
597 libdvdcss: Makefile.opts
598 @cd extras/libdvdcss && $(MAKE)
603 libdvdread: Makefile.opts
604 @cd extras/libdvdread && $(MAKE)