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
62 PLUGINS_TARGETS := a52/a52 \
72 chroma/chroma_i420_rgb \
73 chroma/chroma_i420_rgb_mmx \
74 chroma/chroma_i420_yuy2 \
75 chroma/chroma_i420_yuy2_mmx \
76 chroma/chroma_i422_yuy2 \
77 chroma/chroma_i422_yuy2_mmx \
78 chroma/chroma_i420_ymga \
79 chroma/chroma_i420_ymga_mmx \
91 filter/filter_deinterlace \
92 filter/filter_transform \
93 filter/filter_invert \
94 filter/filter_distort \
111 lpcm_adec/lpcm_adec \
116 memcpy/memcpymmxext \
122 motion/motionmmxext \
124 motion/motionaltivec \
125 mpeg_system/mpeg_es \
126 mpeg_system/mpeg_ps \
127 mpeg_system/mpeg_ts \
128 mpeg_adec/mpeg_adec \
129 mpeg_vdec/mpeg_vdec \
134 satellite/satellite \
149 INTERFACE := main interface intf_msg intf_playlist intf_eject
150 INPUT := input input_ext-plugins input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
151 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
152 AUDIO_OUTPUT := audio_output aout_ext-dec aout_pcm aout_spdif
153 MISC := mtime modules configuration netutils iso_lang
155 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
156 $(INPUT:%=src/input/%.o) \
157 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
158 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
159 $(MISC:%=src/misc/%.o)
164 ifeq ($(NEED_GETOPT),1)
165 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
168 ifeq ($(NEED_SYMBOLS),1)
169 C_OBJ += src/misc/symbols.o
173 CPP_OBJ := src/misc/beos_specific.o
176 ifneq (,$(findstring darwin,$(SYS)))
177 C_OBJ += src/misc/darwin_specific.o
180 ifneq (,$(findstring mingw32,$(SYS)))
181 C_OBJ += src/misc/win32_specific.o
182 RESOURCE_OBJ := share/vlc_win32_rc.o
185 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
190 H_OBJ := src/misc/modules_builtin.h
193 # Other lists of files
195 C_DEP := $(C_OBJ:%.o=.dep/%.d)
196 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
199 # Translate plugin names
202 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
205 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
211 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
212 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
215 # All symbols must be exported
218 ###############################################################################
220 ###############################################################################
225 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
228 @echo "**** No configuration found, please run ./configure"
231 # $(MAKE) $(MAKECMDGOALS)
236 @echo CFLAGS: $(CFLAGS)
237 @echo DCFLAGS: $(DCFLAGS)
238 @echo LDFLAGS: $(LDFLAGS)
239 @echo PCFLAGS: $(PCFLAGS)
240 @echo PLDFLAGS: $(PLDFLAGS)
241 @echo C_OBJ: $(C_OBJ)
242 @echo CPP_OBJ: $(CPP_OBJ)
243 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
244 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
249 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
250 rm -f src/*/*.o extras/*/*.o
251 rm -f lib/*.so* lib/*.a
252 rm -f plugins/*.so plugins/*.a
253 rm -rf extras/MacOSX/build
256 -cd extras/libdvdcss && $(MAKE) clean
259 -cd po && $(MAKE) clean
262 -cd extras/libdvdread && $(MAKE) clean
265 for dir in $(PLUGINS_DIR) ; do \
266 ( cd plugins/$${dir} \
267 && $(MAKE) -f ../../Makefile.modules clean ) ; done
268 rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
271 rm -f $(C_OBJ) $(CPP_OBJ)
272 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
276 -cd po && $(MAKE) maintainer-clean
277 rm -f **/*.o **/*~ *.log
279 rm -f include/defs.h include/modules_builtin.h
280 rm -f src/misc/modules_builtin.h
281 rm -f config*status config*cache config*log
282 rm -f gmon.out core build-stamp
287 # Install/uninstall rules
289 install: libdvdcss-install vlc-install plugins-install po-install
291 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
294 mkdir -p $(DESTDIR)$(bindir)
295 $(INSTALL) vlc $(DESTDIR)$(bindir)
297 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
299 mkdir -p $(DESTDIR)$(datadir)/videolan
300 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
301 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
302 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
305 rm -f $(DESTDIR)$(bindir)/vlc
307 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
309 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
310 rm -f $(DESTDIR)$(datadir)/videolan/*.png
311 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
314 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
316 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
320 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
323 -cd extras/libdvdcss && $(MAKE) install
326 -cd extras/libdvdcss && $(MAKE) uninstall
329 -cd extras/libdvdread && $(MAKE) install
331 libdvdread-uninstall:
332 -cd extras/libdvdread && $(MAKE) uninstall
335 -cd po && $(MAKE) install
338 -cd po && $(MAKE) uninstall
341 # Package generation rules
344 # Check that tmp isn't in the way
345 @if test -e tmp; then \
346 echo "Error: please remove ./tmp, it is in the way"; false; \
348 echo "OK."; mkdir tmp; \
350 # Copy directory structure in tmp
351 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
352 do mkdir -p tmp/vlc/$$i ; \
355 find debian -mindepth 1 -maxdepth 1 -type d | \
356 while read i ; do rm -Rf tmp/vlc/$$i ; done
357 # Copy .c .h .in .cpp and .glade files
358 find include src plugins -type f -name '*.[chig]*' | while read i ; \
359 do cp $$i tmp/vlc/$$i ; done
360 # Copy plugin Makefiles
361 find plugins -type f -name Makefile | while read i ; \
362 do cp $$i tmp/vlc/$$i ; done
363 # Copy extra programs and documentation
364 cp -a extras/* tmp/vlc/extras
365 cp -a doc/* tmp/vlc/doc
366 find tmp/vlc/extras tmp/vlc/doc \
367 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
368 while read i ; do rm -Rf $$i ; done
370 cp po/*.po tmp/vlc/po
371 for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
373 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
374 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
375 configure configure.in install-sh install-win32 vlc.spec \
376 config.sub config.guess acconfig.h aclocal.m4 mkinstalldirs \
378 # Copy Debian control files
379 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
380 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
381 for file in control changelog rules ; do \
382 cp debian/$$file tmp/vlc/debian/ ; done
383 # Copy ipkg control files
384 for file in control rules ; do \
385 cp ipkg/$$file tmp/vlc/ipkg/ ; done
386 # Copy fonts and icons
387 for file in share/*png share/*xpm share/*psf ; do \
388 cp $$file tmp/vlc/share ; done
389 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
390 cp share/$$file tmp/vlc/share/ ; done
392 snapshot: snapshot-common
394 F=vlc-${VLC_QUICKVERSION}; \
395 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
396 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
397 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
401 snapshot-nocss: snapshot-common
403 rm -Rf tmp/vlc/extras/libdvdcss
404 rm -f tmp/vlc/*.libdvdcss
405 # Fix debian information
406 rm -f tmp/vlc/debian/libdvdcss*
407 rm -f tmp/vlc/debian/control
408 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
409 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
410 > tmp/vlc/debian/control
411 rm -f tmp/vlc/debian/rules
412 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
413 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
414 > tmp/vlc/debian/rules
415 chmod +x tmp/vlc/debian/rules
416 # Build css-disabled archives
417 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
418 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
419 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
420 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
425 # XXX: this rule is probably only useful to you if you have exactly
426 # the same setup as me. Contact sam@zoy.org if you need to use it.
428 # Check that tmp isn't in the way
429 @if test -e tmp; then \
430 echo "Error: please remove ./tmp, it is in the way"; false; \
432 echo "OK."; mkdir tmp; \
434 # Create installation script
435 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
436 # Copy relevant files
437 cp vlc.exe $(PLUGINS:%=plugins/%.so) tmp/
438 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
439 README README.libdvdcss FAQ TODO tmp/
440 for file in iconv.dll libgmodule-1.3-12.dll libgtk-0.dll libgdk-0.dll \
441 libgobject-1.3-12.dll libintl-1.dll libglib-1.3-12.dll \
442 libgthread-1.3-12.dll SDL.dll README-SDL.txt ; \
443 do cp ${DLL_PATH}/$$file tmp/ ; done
445 for file in default8x16.psf default8x9.psf ; \
446 do cp share/$$file tmp/share/ ; done
448 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
449 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
450 vlc-${VLC_QUICKVERSION}-win32-installer.exe
455 # Check that tmp isn't in the way
456 @if test -e tmp; then \
457 echo "Error: please remove ./tmp, it is in the way"; false; \
459 echo "OK."; mkdir tmp; \
463 mkdir -p tmp/vlc/share
464 # Copy relevant files
466 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
467 README README.libdvdcss FAQ TODO tmp/vlc/
468 for file in default8x16.psf default8x9.psf ; \
469 do cp share/$$file tmp/vlc/share/ ; done
471 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
472 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
473 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
474 mv tmp/vlc-${VLC_QUICKVERSION}-BeOS-x86.zip .
479 # Check that tmp isn't in the way
480 @if test -e tmp; then \
481 echo "Error: please remove ./tmp, it is in the way"; false; \
483 echo "OK."; mkdir tmp; \
486 # Copy relevant files
488 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
489 README README.libdvdcss FAQ TODO tmp/
492 ./macosx-dmg 0 "vlc-${VLC_QUICKVERSION}" tmp/*
497 libdvdcss-snapshot: snapshot-common
498 # Remove vlc sources and icons, doc, debian directory...
499 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
500 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
501 rm -Rf tmp/vlc/debian
503 # Remove useless headers
504 rm -f tmp/vlc/include/*
505 for file in defs.h.in config.h common.h int_types.h ; \
506 do cp include/$$file tmp/vlc/include/ ; done
507 # Remove misc files (??? - maybe not really needed)
508 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
509 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
510 mv tmp/vlc/README.libdvdcss tmp/vlc/README
511 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
513 rm -f tmp/vlc/Makefile
514 sed -e 's#^install:#install-unused:#' \
515 -e 's#^uninstall:#uninstall-unused:#' \
516 -e 's#^clean:#clean-unused:#' \
517 -e 's#^all:.*#all: libdvdcss#' \
518 -e 's#^libdvdcss-install:#install:#' \
519 -e 's#^libdvdcss-uninstall:#uninstall:#' \
520 -e 's#^libdvdcss-clean:#clean:#' \
521 < Makefile > tmp/vlc/Makefile
523 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
524 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
525 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
526 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
531 dpkg-buildpackage -rfakeroot -us -uc
534 # Gtk/Gnome/* aliases and OS X application
536 gnome-vlc gvlc kvlc qvlc: vlc
537 rm -f $@ && ln -s vlc $@
541 ifneq (,$(findstring darwin,$(SYS)))
543 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
544 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
545 $(INSTALL) -d vlc.app/Contents/MacOS/share
546 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
547 $(INSTALL) vlc vlc.app/Contents/MacOS/
549 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
551 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
557 # Generic rules (see below)
559 $(H_OBJ): Makefile.opts Makefile.dep Makefile
560 # @echo "regenerating $@"
561 @rm -f $@ && cp $@.in $@
563 @for i in $(BUILTINS) ; do \
564 echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \
565 echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \
566 echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \
570 @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
571 @echo " do \\" >> $@ ;
572 @echo " { \\" >> $@ ;
574 @for i in $(BUILTINS) ; do \
575 echo " ALLOCATE_BUILTIN("$$i"); \\" >> $@ ; \
578 @echo " } while( 0 );" >> $@ ;
582 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
584 $(CPP_DEP): %.dpp: FORCE
585 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
587 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
588 $(C_OBJ): %.o: $(H_OBJ)
589 $(C_OBJ): %.o: .dep/%.d
591 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
593 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
594 $(CPP_OBJ): %.o: $(H_OBJ)
595 $(CPP_OBJ): %.o: .dep/%.dpp
596 $(CPP_OBJ): %.o: %.cpp
597 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
599 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
600 ifneq (,(findstring mingw32,$(SYS)))
601 $(RESOURCE_OBJ): %.o: %.rc
602 $(WINDRES) -i $< -o $@
606 # Main application target
608 vlc: Makefile.opts Makefile.dep Makefile $(VLC_OBJ) $(BUILTIN_OBJ)
609 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS) $(LIB_VLC) $(LIB_BUILTINS) $(LIB_COMMON)
611 xres -o $@ ./share/vlc_beos.rsrc
618 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
620 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
623 # Built-in modules target
625 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
626 $(BUILTIN_OBJ): FORCE
627 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
632 libdvdcss: Makefile.opts
633 @cd extras/libdvdcss && $(MAKE)
638 libdvdread: Makefile.opts
639 @cd extras/libdvdread && $(MAKE)