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 \
60 PLUGINS_TARGETS := ac3_adec/ac3_adec \
68 chroma/chroma_i420_rgb \
69 chroma/chroma_i420_rgb_mmx \
70 chroma/chroma_i420_yuy2 \
71 chroma/chroma_i420_yuy2_mmx \
72 chroma/chroma_i422_yuy2 \
73 chroma/chroma_i422_yuy2_mmx \
74 chroma/chroma_i420_ymga \
75 chroma/chroma_i420_ymga_mmx \
87 filter/filter_deinterlace \
88 filter/filter_transform \
89 filter/filter_invert \
90 filter/filter_distort \
108 lpcm_adec/lpcm_adec \
113 memcpy/memcpymmxext \
119 motion/motionmmxext \
121 motion/motionaltivec \
122 mpeg_system/mpeg_es \
123 mpeg_system/mpeg_ps \
124 mpeg_system/mpeg_ts \
125 mpeg_adec/mpeg_adec \
126 mpeg_vdec/mpeg_vdec \
145 INTERFACE := main interface intf_msg intf_playlist intf_eject
146 INPUT := input input_ext-plugins input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
147 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
148 AUDIO_OUTPUT := audio_output aout_ext-dec aout_pcm aout_spdif
149 MISC := mtime modules configuration netutils iso_lang
151 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
152 $(INPUT:%=src/input/%.o) \
153 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
154 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
155 $(MISC:%=src/misc/%.o)
160 ifeq ($(NEED_GETOPT),1)
161 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
164 ifeq ($(NEED_SYMBOLS),1)
165 C_OBJ += src/misc/symbols.o
169 CPP_OBJ := src/misc/beos_specific.o
172 ifneq (,$(findstring darwin,$(SYS)))
173 C_OBJ += src/misc/darwin_specific.o
176 ifneq (,$(findstring mingw32,$(SYS)))
177 C_OBJ += src/misc/win32_specific.o
178 RESOURCE_OBJ := share/vlc_win32_rc.o
181 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
186 H_OBJ := src/misc/modules_builtin.h
189 # Other lists of files
191 C_DEP := $(C_OBJ:%.o=.dep/%.d)
192 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
195 # Translate plugin names
198 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
201 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
207 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
208 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
211 # All symbols must be exported
214 ###############################################################################
216 ###############################################################################
221 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
224 @echo "**** No configuration found, please run ./configure"
227 # $(MAKE) $(MAKECMDGOALS)
232 @echo CFLAGS: $(CFLAGS)
233 @echo DCFLAGS: $(DCFLAGS)
234 @echo LDFLAGS: $(LDFLAGS)
235 @echo PCFLAGS: $(PCFLAGS)
236 @echo PLDFLAGS: $(PLDFLAGS)
237 @echo C_OBJ: $(C_OBJ)
238 @echo CPP_OBJ: $(CPP_OBJ)
239 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
240 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
245 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
246 rm -f src/*/*.o extras/*/*.o
247 rm -f lib/*.so* lib/*.a
248 rm -f plugins/*.so plugins/*.a
249 rm -rf extras/MacOSX/build
252 -cd extras/libdvdcss && $(MAKE) clean
255 -cd po && $(MAKE) clean
258 -cd extras/libdvdread && $(MAKE) clean
261 for dir in $(PLUGINS_DIR) ; do \
262 ( cd plugins/$${dir} \
263 && $(MAKE) -f ../../Makefile.modules clean ) ; done
264 rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
267 rm -f $(C_OBJ) $(CPP_OBJ)
268 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
272 -cd po && $(MAKE) maintainer-clean
273 rm -f **/*.o **/*~ *.log
275 rm -f include/defs.h include/modules_builtin.h
276 rm -f src/misc/modules_builtin.h
277 rm -f config*status config*cache config*log
278 rm -f gmon.out core build-stamp
283 # Install/uninstall rules
285 install: libdvdcss-install vlc-install plugins-install po-install
287 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
290 mkdir -p $(DESTDIR)$(bindir)
291 $(INSTALL) vlc $(DESTDIR)$(bindir)
293 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
295 mkdir -p $(DESTDIR)$(datadir)/videolan
296 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
297 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
298 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
301 rm -f $(DESTDIR)$(bindir)/vlc
303 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
305 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
306 rm -f $(DESTDIR)$(datadir)/videolan/*.png
307 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
310 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
312 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
316 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
319 -cd extras/libdvdcss && $(MAKE) install
322 -cd extras/libdvdcss && $(MAKE) uninstall
325 -cd extras/libdvdread && $(MAKE) install
327 libdvdread-uninstall:
328 -cd extras/libdvdread && $(MAKE) uninstall
331 -cd po && $(MAKE) install
334 -cd po && $(MAKE) uninstall
337 # Package generation rules
340 # Check that tmp isn't in the way
341 @if test -e tmp; then \
342 echo "Error: please remove ./tmp, it is in the way"; false; \
344 echo "OK."; mkdir tmp; \
346 # Copy directory structure in tmp
347 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
348 do mkdir -p tmp/vlc/$$i ; \
351 find debian -mindepth 1 -maxdepth 1 -type d | \
352 while read i ; do rm -Rf tmp/vlc/$$i ; done
353 # Copy .c .h .in .cpp and .glade files
354 find include src plugins -type f -name '*.[chig]*' | while read i ; \
355 do cp $$i tmp/vlc/$$i ; done
356 # Copy plugin Makefiles
357 find plugins -type f -name Makefile | while read i ; \
358 do cp $$i tmp/vlc/$$i ; done
359 # Copy extra programs and documentation
360 cp -a extras/* tmp/vlc/extras
361 cp -a doc/* tmp/vlc/doc
362 find tmp/vlc/extras tmp/vlc/doc \
363 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
364 while read i ; do rm -Rf $$i ; done
366 cp po/*.po tmp/vlc/po
367 for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
369 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
370 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
371 configure configure.in install-sh install-win32 vlc.spec \
372 config.sub config.guess acconfig.h aclocal.m4 mkinstalldirs \
374 # Copy Debian control files
375 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
376 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
377 for file in control changelog rules ; do \
378 cp debian/$$file tmp/vlc/debian/ ; done
379 # Copy ipkg control files
380 for file in control rules ; do \
381 cp ipkg/$$file tmp/vlc/ipkg/ ; done
382 # Copy fonts and icons
383 for file in share/*png share/*xpm share/*psf ; do \
384 cp $$file tmp/vlc/share ; done
385 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
386 cp share/$$file tmp/vlc/share/ ; done
388 snapshot: snapshot-common
390 F=vlc-${VLC_QUICKVERSION}; \
391 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
392 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
393 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
397 snapshot-nocss: snapshot-common
399 rm -Rf tmp/vlc/extras/libdvdcss
400 rm -f tmp/vlc/*.libdvdcss
401 # Fix debian information
402 rm -f tmp/vlc/debian/libdvdcss*
403 rm -f tmp/vlc/debian/control
404 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
405 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
406 > tmp/vlc/debian/control
407 rm -f tmp/vlc/debian/rules
408 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
409 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
410 > tmp/vlc/debian/rules
411 chmod +x tmp/vlc/debian/rules
412 # Build css-disabled archives
413 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
414 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
415 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
416 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
421 # XXX: this rule is probably only useful to you if you have exactly
422 # the same setup as me. Contact sam@zoy.org if you need to use it.
424 # Check that tmp isn't in the way
425 @if test -e tmp; then \
426 echo "Error: please remove ./tmp, it is in the way"; false; \
428 echo "OK."; mkdir tmp; \
430 # Create installation script
431 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
432 # Copy relevant files
433 cp vlc.exe $(PLUGINS:%=plugins/%.so) tmp/
434 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
435 README README.libdvdcss FAQ TODO tmp/
436 for file in iconv.dll libgmodule-1.3-12.dll libgtk-0.dll libgdk-0.dll \
437 libgobject-1.3-12.dll libintl-1.dll libglib-1.3-12.dll \
438 libgthread-1.3-12.dll SDL.dll README-SDL.txt ; \
439 do cp ${DLL_PATH}/$$file tmp/ ; done
441 for file in default8x16.psf default8x9.psf ; \
442 do cp share/$$file tmp/share/ ; done
444 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
445 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
446 vlc-${VLC_QUICKVERSION}-win32-installer.exe
451 # Check that tmp isn't in the way
452 @if test -e tmp; then \
453 echo "Error: please remove ./tmp, it is in the way"; false; \
455 echo "OK."; mkdir tmp; \
459 mkdir -p tmp/vlc/share
460 # Copy relevant files
462 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
463 README README.libdvdcss FAQ TODO tmp/vlc/
464 for file in default8x16.psf default8x9.psf ; \
465 do cp share/$$file tmp/vlc/share/ ; done
467 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
468 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
469 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
470 mv tmp/vlc-${VLC_QUICKVERSION}-BeOS-x86.zip .
475 # Check that tmp isn't in the way
476 @if test -e tmp; then \
477 echo "Error: please remove ./tmp, it is in the way"; false; \
479 echo "OK."; mkdir tmp; \
482 # Copy relevant files
484 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
485 README README.libdvdcss FAQ TODO tmp/
488 ./macosx-dmg 0 "vlc-${VLC_QUICKVERSION}" tmp/*
493 libdvdcss-snapshot: snapshot-common
494 # Remove vlc sources and icons, doc, debian directory...
495 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
496 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
497 rm -Rf tmp/vlc/debian
499 # Remove useless headers
500 rm -f tmp/vlc/include/*
501 for file in defs.h.in config.h common.h int_types.h ; \
502 do cp include/$$file tmp/vlc/include/ ; done
503 # Remove misc files (??? - maybe not really needed)
504 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
505 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
506 mv tmp/vlc/README.libdvdcss tmp/vlc/README
507 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
509 rm -f tmp/vlc/Makefile
510 sed -e 's#^install:#install-unused:#' \
511 -e 's#^uninstall:#uninstall-unused:#' \
512 -e 's#^clean:#clean-unused:#' \
513 -e 's#^all:.*#all: libdvdcss#' \
514 -e 's#^libdvdcss-install:#install:#' \
515 -e 's#^libdvdcss-uninstall:#uninstall:#' \
516 -e 's#^libdvdcss-clean:#clean:#' \
517 < Makefile > tmp/vlc/Makefile
519 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
520 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
521 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
522 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
527 dpkg-buildpackage -rfakeroot -us -uc
530 # Gtk/Gnome/* aliases and OS X application
532 gnome-vlc gvlc kvlc qvlc: vlc
533 rm -f $@ && ln -s vlc $@
536 vlc.app: Makefile.opts
537 ifneq (,$(findstring darwin,$(SYS)))
539 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
540 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
541 $(INSTALL) -d vlc.app/Contents/MacOS/share
542 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
543 $(INSTALL) vlc vlc.app/Contents/MacOS/
545 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
547 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
553 # Generic rules (see below)
555 $(H_OBJ): Makefile.opts Makefile.dep Makefile
556 # @echo "regenerating $@"
557 @rm -f $@ && cp $@.in $@
559 @for i in $(BUILTINS) ; do \
560 echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \
561 echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \
562 echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \
566 @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
567 @echo " do \\" >> $@ ;
568 @echo " { \\" >> $@ ;
570 @for i in $(BUILTINS) ; do \
571 echo " ALLOCATE_BUILTIN("$$i"); \\" >> $@ ; \
574 @echo " } while( 0 );" >> $@ ;
578 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
580 $(CPP_DEP): %.dpp: FORCE
581 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
583 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
584 $(C_OBJ): %.o: $(H_OBJ)
585 $(C_OBJ): %.o: .dep/%.d
587 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
589 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
590 $(CPP_OBJ): %.o: $(H_OBJ)
591 $(CPP_OBJ): %.o: .dep/%.dpp
592 $(CPP_OBJ): %.o: %.cpp
593 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
595 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
596 ifneq (,(findstring mingw32,$(SYS)))
597 $(RESOURCE_OBJ): %.o: %.rc
598 $(WINDRES) -i $< -o $@
602 # Main application target
604 vlc: Makefile.opts Makefile.dep Makefile $(VLC_OBJ) $(BUILTIN_OBJ)
605 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS)
607 xres -o $@ ./share/vlc_beos.rsrc
614 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
616 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
619 # Built-in modules target
621 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
622 $(BUILTIN_OBJ): FORCE
623 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
628 libdvdcss: Makefile.opts
629 @cd extras/libdvdcss && $(MAKE)
634 libdvdread: Makefile.opts
635 @cd extras/libdvdread && $(MAKE)