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 \
72 filter/filter_deinterlace \
73 filter/filter_transform \
74 filter/filter_invert \
75 filter/filter_distort \
103 motion/motionmmxext \
105 motion/motionaltivec \
106 mpeg_system/mpeg_es \
107 mpeg_system/mpeg_ps \
108 mpeg_system/mpeg_ts \
109 mpeg_adec/mpeg_adec \
110 mpeg_vdec/mpeg_vdec \
123 INTERFACE := main interface intf_msg intf_playlist
124 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
125 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
126 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
127 MISC := mtime modules netutils iso_lang
129 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
130 $(INPUT:%=src/input/%.o) \
131 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
132 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
133 $(MISC:%=src/misc/%.o)
138 ifeq ($(NEED_GETOPT),1)
139 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
143 CPP_OBJ := src/misc/beos_specific.o
146 ifneq (,$(findstring darwin,$(SYS)))
147 C_OBJ += src/misc/darwin_specific.o
150 ifneq (,$(findstring mingw32,$(SYS)))
151 C_OBJ += src/misc/win32_specific.o
152 RESOURCE_OBJ := share/vlc_win32_rc.o
155 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
160 H_OBJ := src/misc/modules_builtin.h
163 # Included headers which don't get noticed by Makefile.dep
165 H_DEP := videolan/vlc.h \
181 # Other lists of files
183 C_DEP := $(C_OBJ:%.o=.dep/%.d)
184 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
187 # Translate plugin names
190 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
193 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
199 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
200 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
203 # All symbols must be exported
206 ###############################################################################
208 ###############################################################################
213 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
216 @echo "**** No configuration found, please run ./configure"
219 # $(MAKE) $(MAKECMDGOALS)
224 @echo CFLAGS: $(CFLAGS)
225 @echo DCFLAGS: $(DCFLAGS)
226 @echo LDFLAGS: $(LDFLAGS)
227 @echo PCFLAGS: $(PCFLAGS)
228 @echo PLDFLAGS: $(PLDFLAGS)
229 @echo C_OBJ: $(C_OBJ)
230 @echo CPP_OBJ: $(CPP_OBJ)
231 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
232 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
237 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
238 rm -f src/*/*.o extras/*/*.o
239 rm -f lib/*.so* lib/*.a
240 rm -f plugins/*.so plugins/*.a
241 rm -rf extras/MacOSX/build
244 -cd extras/libdvdcss && $(MAKE) clean
247 -cd po && $(MAKE) clean
250 -cd extras/libdvdread && $(MAKE) clean
253 for dir in $(PLUGINS_DIR) ; do \
254 ( cd plugins/$${dir} \
255 && $(MAKE) -f ../../Makefile.modules clean ) ; done
256 rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
259 rm -f $(C_OBJ) $(CPP_OBJ)
260 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
264 -cd po && $(MAKE) maintainer-clean
265 rm -f **/*.o **/*~ *.log
267 rm -f include/defs.h include/modules_builtin.h
268 rm -f src/misc/modules_builtin.h
269 rm -f config*status config*cache config*log
270 rm -f gmon.out core build-stamp
275 # Install/uninstall rules
277 install: libdvdcss-install vlc-install plugins-install po-install
279 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
282 mkdir -p $(DESTDIR)$(bindir)
283 $(INSTALL) vlc $(DESTDIR)$(bindir)
285 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
287 mkdir -p $(DESTDIR)$(datadir)/videolan
288 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
289 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
290 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
293 rm -f $(DESTDIR)$(bindir)/vlc
295 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
297 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
298 rm -f $(DESTDIR)$(datadir)/videolan/*.png
299 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
302 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
304 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
308 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
311 -cd extras/libdvdcss && $(MAKE) install
314 -cd extras/libdvdcss && $(MAKE) uninstall
317 -cd po && $(MAKE) install
320 -cd po && $(MAKE) uninstall
323 # Package generation rules
326 # Check that tmp isn't in the way
327 @if test -e tmp; then \
328 echo "Error: please remove ./tmp, it is in the way"; false; \
330 echo "OK."; mkdir tmp; \
332 # Copy directory structure in tmp
333 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
334 do mkdir -p tmp/vlc/$$i ; \
337 find debian -mindepth 1 -maxdepth 1 -type d | \
338 while read i ; do rm -Rf tmp/vlc/$$i ; done
339 # Copy .c .h .in .cpp and .glade files
340 find include src plugins -type f -name '*.[chig]*' | while read i ; \
341 do cp $$i tmp/vlc/$$i ; done
342 # Copy plugin Makefiles
343 find plugins -type f -name Makefile | while read i ; \
344 do cp $$i tmp/vlc/$$i ; done
345 # Copy extra programs and documentation
346 cp -a extras/* tmp/vlc/extras
347 cp -a doc/* tmp/vlc/doc
348 find tmp/vlc/extras tmp/vlc/doc \
349 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
350 while read i ; do rm -Rf $$i ; done
352 cp po/*.po tmp/vlc/po
353 for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
355 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
356 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
357 configure configure.in install-sh install-win32 vlc.spec \
358 config.sub config.guess acconfig.h aclocal.m4 mkinstalldirs \
360 # Copy Debian control files
361 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
362 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
363 for file in control changelog rules ; do \
364 cp debian/$$file tmp/vlc/debian/ ; done
365 # Copy ipkg control files
366 for file in control rules ; do \
367 cp ipkg/$$file tmp/vlc/ipkg/ ; done
368 # Copy fonts and icons
369 for file in share/*png share/*xpm share/*psf ; do \
370 cp $$file tmp/vlc/share ; done
371 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
372 cp share/$$file tmp/vlc/share/ ; done
374 snapshot: snapshot-common
376 F=vlc-${VLC_QUICKVERSION}; \
377 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
378 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
379 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
383 snapshot-nocss: snapshot-common
385 rm -Rf tmp/vlc/extras/libdvdcss
386 rm -f tmp/vlc/*.libdvdcss
387 # Fix debian information
388 rm -f tmp/vlc/debian/libdvdcss*
389 rm -f tmp/vlc/debian/control
390 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
391 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
392 > tmp/vlc/debian/control
393 rm -f tmp/vlc/debian/rules
394 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
395 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
396 > tmp/vlc/debian/rules
397 chmod +x tmp/vlc/debian/rules
398 # Build css-disabled archives
399 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
400 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
401 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
402 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
407 # XXX: this rule is probably only useful to you if you have exactly
408 # the same setup as me. Contact sam@zoy.org if you need to use it.
410 # Check that tmp isn't in the way
411 @if test -e tmp; then \
412 echo "Error: please remove ./tmp, it is in the way"; false; \
414 echo "OK."; mkdir tmp; \
416 # Create installation script
417 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
418 # Copy relevant files
419 cp vlc.exe $(PLUGINS:%=plugins/%.so) tmp/
420 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
421 README README.libdvdcss FAQ TODO tmp/
422 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
423 gnu-intl.dll SDL.dll README-SDL.txt ; \
424 do cp ${DLL_PATH}/$$file tmp/ ; done
426 for file in default8x16.psf default8x9.psf ; \
427 do cp share/$$file tmp/share/ ; done
429 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
430 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
431 vlc-${VLC_QUICKVERSION}-win32-installer.exe
436 # Check that tmp isn't in the way
437 @if test -e tmp; then \
438 echo "Error: please remove ./tmp, it is in the way"; false; \
440 echo "OK."; mkdir tmp; \
444 mkdir -p tmp/vlc/share
445 # Copy relevant files
447 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
448 README README.libdvdcss FAQ TODO tmp/vlc/
449 for file in default8x16.psf default8x9.psf ; \
450 do cp share/$$file tmp/vlc/share/ ; done
452 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
453 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
454 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
455 mv tmp/vlc-${VLC_QUICKVERSION}-BeOS-x86.zip .
459 libdvdcss-snapshot: snapshot-common
460 # Remove vlc sources and icons, doc, debian directory...
461 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
462 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
463 rm -Rf tmp/vlc/debian
465 # Remove useless headers
466 rm -f tmp/vlc/include/*
467 for file in defs.h.in config.h common.h int_types.h ; \
468 do cp include/$$file tmp/vlc/include/ ; done
469 # Remove misc files (??? - maybe not really needed)
470 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
471 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
472 mv tmp/vlc/README.libdvdcss tmp/vlc/README
473 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
475 rm -f tmp/vlc/Makefile
476 sed -e 's#^install:#install-unused:#' \
477 -e 's#^uninstall:#uninstall-unused:#' \
478 -e 's#^clean:#clean-unused:#' \
479 -e 's#^all:.*#all: libdvdcss#' \
480 -e 's#^libdvdcss-install:#install:#' \
481 -e 's#^libdvdcss-uninstall:#uninstall:#' \
482 -e 's#^libdvdcss-clean:#clean:#' \
483 < Makefile > tmp/vlc/Makefile
485 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
486 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
487 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
488 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
493 dpkg-buildpackage -rfakeroot -us -uc
496 # Gtk/Gnome/* aliases and OS X application
498 gnome-vlc gvlc kvlc qvlc: vlc
499 rm -f $@ && ln -s vlc $@
502 vlc.app: Makefile.opts
503 ifneq (,$(findstring darwin,$(SYS)))
505 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
506 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
507 $(INSTALL) -d vlc.app/Contents/MacOS/share
508 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
509 $(INSTALL) vlc vlc.app/Contents/MacOS/
511 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
513 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
519 # Generic rules (see below)
521 $(H_OBJ): Makefile.opts Makefile.dep Makefile
522 # @echo "regenerating $@"
523 @rm -f $@ && cp $@.in $@
525 @for i in $(BUILTINS) ; do \
526 echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \
527 echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \
528 echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \
532 @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
533 @echo " do \\" >> $@ ;
534 @echo " { \\" >> $@ ;
536 @for i in $(BUILTINS) ; do \
537 echo " ALLOCATE_BUILTIN("$$i"); \\" >> $@ ; \
539 @echo " } while( 0 );" >> $@ ;
544 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
546 $(CPP_DEP): %.dpp: FORCE
547 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
549 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
550 $(C_OBJ): %.o: $(H_OBJ) $(H_DEP:%=include/%)
551 $(C_OBJ): %.o: .dep/%.d
553 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
555 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
556 $(CPP_OBJ): %.o: $(H_OBJ) $(H_DEP:%=include/%)
557 $(CPP_OBJ): %.o: .dep/%.dpp
558 $(CPP_OBJ): %.o: %.cpp
559 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
561 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
562 ifneq (,(findstring mingw32,$(SYS)))
563 $(RESOURCE_OBJ): %.o: %.rc
564 $(WINDRES) -i $< -o $@
568 # Main application target
570 vlc: Makefile.opts Makefile.dep Makefile $(VLC_OBJ) $(BUILTIN_OBJ)
571 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS)
573 xres -o $@ ./share/vlc_beos.rsrc
580 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
582 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
585 # Built-in modules target
587 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
588 $(BUILTIN_OBJ): FORCE
589 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
594 libdvdcss: Makefile.opts
595 @cd extras/libdvdcss && $(MAKE)
600 libdvdread: Makefile.opts
601 @cd extras/libdvdread && $(MAKE)