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 \
57 PLUGINS_TARGETS := ac3_adec/ac3_adec \
62 chroma/chroma_i420_rgb \
63 chroma/chroma_i420_rgb_mmx \
64 chroma/chroma_i420_yuy2 \
65 chroma/chroma_i420_yuy2_mmx \
66 chroma/chroma_i422_yuy2 \
67 chroma/chroma_i422_yuy2_mmx \
68 chroma/chroma_i420_ymga \
69 chroma/chroma_i420_ymga_mmx \
81 filter/filter_deinterlace \
82 filter/filter_transform \
83 filter/filter_invert \
84 filter/filter_distort \
101 lpcm_adec/lpcm_adec \
106 memcpy/memcpymmxext \
112 motion/motionmmxext \
114 motion/motionaltivec \
115 mpeg_system/mpeg_es \
116 mpeg_system/mpeg_ps \
117 mpeg_system/mpeg_ts \
118 mpeg_adec/mpeg_adec \
119 mpeg_vdec/mpeg_vdec \
136 INTERFACE := main interface intf_msg intf_playlist intf_eject
137 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
138 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
139 AUDIO_OUTPUT := audio_output aout_common aout_ext-dec aout_spdif
140 MISC := mtime modules configuration netutils iso_lang
142 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
143 $(INPUT:%=src/input/%.o) \
144 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
145 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
146 $(MISC:%=src/misc/%.o)
151 ifeq ($(NEED_GETOPT),1)
152 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
155 ifeq ($(NEED_SYMBOLS),1)
156 C_OBJ += src/misc/symbols.o
160 CPP_OBJ := src/misc/beos_specific.o
163 ifneq (,$(findstring darwin,$(SYS)))
164 C_OBJ += src/misc/darwin_specific.o
167 ifneq (,$(findstring mingw32,$(SYS)))
168 C_OBJ += src/misc/win32_specific.o
169 RESOURCE_OBJ := share/vlc_win32_rc.o
172 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
177 H_OBJ := src/misc/modules_builtin.h
180 # Other lists of files
182 C_DEP := $(C_OBJ:%.o=.dep/%.d)
183 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
186 # Translate plugin names
189 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
192 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
198 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
199 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
202 # All symbols must be exported
205 ###############################################################################
207 ###############################################################################
212 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
215 @echo "**** No configuration found, please run ./configure"
218 # $(MAKE) $(MAKECMDGOALS)
223 @echo CFLAGS: $(CFLAGS)
224 @echo DCFLAGS: $(DCFLAGS)
225 @echo LDFLAGS: $(LDFLAGS)
226 @echo PCFLAGS: $(PCFLAGS)
227 @echo PLDFLAGS: $(PLDFLAGS)
228 @echo C_OBJ: $(C_OBJ)
229 @echo CPP_OBJ: $(CPP_OBJ)
230 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
231 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
236 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
237 rm -f src/*/*.o extras/*/*.o
238 rm -f lib/*.so* lib/*.a
239 rm -f plugins/*.so plugins/*.a
240 rm -rf extras/MacOSX/build
243 -cd extras/libdvdcss && $(MAKE) clean
246 -cd po && $(MAKE) clean
249 -cd extras/libdvdread && $(MAKE) clean
252 for dir in $(PLUGINS_DIR) ; do \
253 ( cd plugins/$${dir} \
254 && $(MAKE) -f ../../Makefile.modules clean ) ; done
255 rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
258 rm -f $(C_OBJ) $(CPP_OBJ)
259 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
263 -cd po && $(MAKE) maintainer-clean
264 rm -f **/*.o **/*~ *.log
266 rm -f include/defs.h include/modules_builtin.h
267 rm -f src/misc/modules_builtin.h
268 rm -f config*status config*cache config*log
269 rm -f gmon.out core build-stamp
274 # Install/uninstall rules
276 install: libdvdcss-install vlc-install plugins-install po-install
278 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
281 mkdir -p $(DESTDIR)$(bindir)
282 $(INSTALL) vlc $(DESTDIR)$(bindir)
284 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
286 mkdir -p $(DESTDIR)$(datadir)/videolan
287 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
288 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
289 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
292 rm -f $(DESTDIR)$(bindir)/vlc
294 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
296 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
297 rm -f $(DESTDIR)$(datadir)/videolan/*.png
298 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
301 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
303 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
307 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
310 -cd extras/libdvdcss && $(MAKE) install
313 -cd extras/libdvdcss && $(MAKE) uninstall
316 -cd extras/libdvdread && $(MAKE) install
318 libdvdread-uninstall:
319 -cd extras/libdvdread && $(MAKE) uninstall
322 -cd po && $(MAKE) install
325 -cd po && $(MAKE) uninstall
328 # Package generation rules
331 # Check that tmp isn't in the way
332 @if test -e tmp; then \
333 echo "Error: please remove ./tmp, it is in the way"; false; \
335 echo "OK."; mkdir tmp; \
337 # Copy directory structure in tmp
338 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
339 do mkdir -p tmp/vlc/$$i ; \
342 find debian -mindepth 1 -maxdepth 1 -type d | \
343 while read i ; do rm -Rf tmp/vlc/$$i ; done
344 # Copy .c .h .in .cpp and .glade files
345 find include src plugins -type f -name '*.[chig]*' | while read i ; \
346 do cp $$i tmp/vlc/$$i ; done
347 # Copy plugin Makefiles
348 find plugins -type f -name Makefile | while read i ; \
349 do cp $$i tmp/vlc/$$i ; done
350 # Copy extra programs and documentation
351 cp -a extras/* tmp/vlc/extras
352 cp -a doc/* tmp/vlc/doc
353 find tmp/vlc/extras tmp/vlc/doc \
354 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
355 while read i ; do rm -Rf $$i ; done
357 cp po/*.po tmp/vlc/po
358 for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
360 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
361 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
362 configure configure.in install-sh install-win32 vlc.spec \
363 config.sub config.guess acconfig.h aclocal.m4 mkinstalldirs \
365 # Copy Debian control files
366 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
367 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
368 for file in control changelog rules ; do \
369 cp debian/$$file tmp/vlc/debian/ ; done
370 # Copy ipkg control files
371 for file in control rules ; do \
372 cp ipkg/$$file tmp/vlc/ipkg/ ; done
373 # Copy fonts and icons
374 for file in share/*png share/*xpm share/*psf ; do \
375 cp $$file tmp/vlc/share ; done
376 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
377 cp share/$$file tmp/vlc/share/ ; done
379 snapshot: snapshot-common
381 F=vlc-${VLC_QUICKVERSION}; \
382 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
383 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
384 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
388 snapshot-nocss: snapshot-common
390 rm -Rf tmp/vlc/extras/libdvdcss
391 rm -f tmp/vlc/*.libdvdcss
392 # Fix debian information
393 rm -f tmp/vlc/debian/libdvdcss*
394 rm -f tmp/vlc/debian/control
395 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
396 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
397 > tmp/vlc/debian/control
398 rm -f tmp/vlc/debian/rules
399 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
400 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
401 > tmp/vlc/debian/rules
402 chmod +x tmp/vlc/debian/rules
403 # Build css-disabled archives
404 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
405 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
406 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
407 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
412 # XXX: this rule is probably only useful to you if you have exactly
413 # the same setup as me. Contact sam@zoy.org if you need to use it.
415 # Check that tmp isn't in the way
416 @if test -e tmp; then \
417 echo "Error: please remove ./tmp, it is in the way"; false; \
419 echo "OK."; mkdir tmp; \
421 # Create installation script
422 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
423 # Copy relevant files
424 cp vlc.exe $(PLUGINS:%=plugins/%.so) tmp/
425 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
426 README README.libdvdcss FAQ TODO tmp/
427 for file in iconv.dll libgmodule-1.3-12.dll libgtk-0.dll libgdk-0.dll \
428 libgobject-1.3-12.dll libintl-1.dll libglib-1.3-12.dll \
429 libgthread-1.3-12.dll SDL.dll README-SDL.txt ; \
430 do cp ${DLL_PATH}/$$file tmp/ ; done
432 for file in default8x16.psf default8x9.psf ; \
433 do cp share/$$file tmp/share/ ; done
435 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
436 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
437 vlc-${VLC_QUICKVERSION}-win32-installer.exe
442 # Check that tmp isn't in the way
443 @if test -e tmp; then \
444 echo "Error: please remove ./tmp, it is in the way"; false; \
446 echo "OK."; mkdir tmp; \
450 mkdir -p tmp/vlc/share
451 # Copy relevant files
453 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
454 README README.libdvdcss FAQ TODO tmp/vlc/
455 for file in default8x16.psf default8x9.psf ; \
456 do cp share/$$file tmp/vlc/share/ ; done
458 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
459 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
460 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
461 mv tmp/vlc-${VLC_QUICKVERSION}-BeOS-x86.zip .
466 # Check that tmp isn't in the way
467 @if test -e tmp; then \
468 echo "Error: please remove ./tmp, it is in the way"; false; \
470 echo "OK."; mkdir tmp; \
473 # Copy relevant files
475 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
476 README README.libdvdcss FAQ TODO tmp/
479 ./macosx-dmg 0 "vlc-${VLC_QUICKVERSION}" tmp/*
484 libdvdcss-snapshot: snapshot-common
485 # Remove vlc sources and icons, doc, debian directory...
486 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
487 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
488 rm -Rf tmp/vlc/debian
490 # Remove useless headers
491 rm -f tmp/vlc/include/*
492 for file in defs.h.in config.h common.h int_types.h ; \
493 do cp include/$$file tmp/vlc/include/ ; done
494 # Remove misc files (??? - maybe not really needed)
495 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
496 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
497 mv tmp/vlc/README.libdvdcss tmp/vlc/README
498 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
500 rm -f tmp/vlc/Makefile
501 sed -e 's#^install:#install-unused:#' \
502 -e 's#^uninstall:#uninstall-unused:#' \
503 -e 's#^clean:#clean-unused:#' \
504 -e 's#^all:.*#all: libdvdcss#' \
505 -e 's#^libdvdcss-install:#install:#' \
506 -e 's#^libdvdcss-uninstall:#uninstall:#' \
507 -e 's#^libdvdcss-clean:#clean:#' \
508 < Makefile > tmp/vlc/Makefile
510 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
511 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
512 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
513 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
518 dpkg-buildpackage -rfakeroot -us -uc
521 # Gtk/Gnome/* aliases and OS X application
523 gnome-vlc gvlc kvlc qvlc: vlc
524 rm -f $@ && ln -s vlc $@
527 vlc.app: Makefile.opts
528 ifneq (,$(findstring darwin,$(SYS)))
530 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
531 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
532 $(INSTALL) -d vlc.app/Contents/MacOS/share
533 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
534 $(INSTALL) vlc vlc.app/Contents/MacOS/
536 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
538 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
544 # Generic rules (see below)
546 $(H_OBJ): Makefile.opts Makefile.dep Makefile
547 # @echo "regenerating $@"
548 @rm -f $@ && cp $@.in $@
550 @for i in $(BUILTINS) ; do \
551 echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \
552 echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \
553 echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \
557 @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
558 @echo " do \\" >> $@ ;
559 @echo " { \\" >> $@ ;
561 @for i in $(BUILTINS) ; do \
562 echo " ALLOCATE_BUILTIN("$$i"); \\" >> $@ ; \
565 @echo " } while( 0 );" >> $@ ;
569 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
571 $(CPP_DEP): %.dpp: FORCE
572 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
574 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
575 $(C_OBJ): %.o: $(H_OBJ)
576 $(C_OBJ): %.o: .dep/%.d
578 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
580 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
581 $(CPP_OBJ): %.o: $(H_OBJ)
582 $(CPP_OBJ): %.o: .dep/%.dpp
583 $(CPP_OBJ): %.o: %.cpp
584 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
586 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
587 ifneq (,(findstring mingw32,$(SYS)))
588 $(RESOURCE_OBJ): %.o: %.rc
589 $(WINDRES) -i $< -o $@
593 # Main application target
595 vlc: Makefile.opts Makefile.dep Makefile $(VLC_OBJ) $(BUILTIN_OBJ)
596 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS)
598 xres -o $@ ./share/vlc_beos.rsrc
605 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
607 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
610 # Built-in modules target
612 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
613 $(BUILTIN_OBJ): FORCE
614 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
619 libdvdcss: Makefile.opts
620 @cd extras/libdvdcss && $(MAKE)
625 libdvdread: Makefile.opts
626 @cd extras/libdvdread && $(MAKE)