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 \
144 INTERFACE := main interface intf_msg intf_playlist intf_eject
145 INPUT := input input_ext-plugins input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
146 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
147 AUDIO_OUTPUT := audio_output aout_ext-dec aout_pcm aout_spdif
148 MISC := mtime modules configuration netutils iso_lang
150 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
151 $(INPUT:%=src/input/%.o) \
152 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
153 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
154 $(MISC:%=src/misc/%.o)
159 ifeq ($(NEED_GETOPT),1)
160 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
163 ifeq ($(NEED_SYMBOLS),1)
164 C_OBJ += src/misc/symbols.o
168 CPP_OBJ := src/misc/beos_specific.o
171 ifneq (,$(findstring darwin,$(SYS)))
172 C_OBJ += src/misc/darwin_specific.o
175 ifneq (,$(findstring mingw32,$(SYS)))
176 C_OBJ += src/misc/win32_specific.o
177 RESOURCE_OBJ := share/vlc_win32_rc.o
180 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
185 H_OBJ := src/misc/modules_builtin.h
188 # Other lists of files
190 C_DEP := $(C_OBJ:%.o=.dep/%.d)
191 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
194 # Translate plugin names
197 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
200 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
206 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
207 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
210 # All symbols must be exported
213 ###############################################################################
215 ###############################################################################
220 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
223 @echo "**** No configuration found, please run ./configure"
226 # $(MAKE) $(MAKECMDGOALS)
231 @echo CFLAGS: $(CFLAGS)
232 @echo DCFLAGS: $(DCFLAGS)
233 @echo LDFLAGS: $(LDFLAGS)
234 @echo PCFLAGS: $(PCFLAGS)
235 @echo PLDFLAGS: $(PLDFLAGS)
236 @echo C_OBJ: $(C_OBJ)
237 @echo CPP_OBJ: $(CPP_OBJ)
238 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
239 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
244 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
245 rm -f src/*/*.o extras/*/*.o
246 rm -f lib/*.so* lib/*.a
247 rm -f plugins/*.so plugins/*.a
248 rm -rf extras/MacOSX/build
251 -cd extras/libdvdcss && $(MAKE) clean
254 -cd po && $(MAKE) clean
257 -cd extras/libdvdread && $(MAKE) clean
260 for dir in $(PLUGINS_DIR) ; do \
261 ( cd plugins/$${dir} \
262 && $(MAKE) -f ../../Makefile.modules clean ) ; done
263 rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
266 rm -f $(C_OBJ) $(CPP_OBJ)
267 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
271 -cd po && $(MAKE) maintainer-clean
272 rm -f **/*.o **/*~ *.log
274 rm -f include/defs.h include/modules_builtin.h
275 rm -f src/misc/modules_builtin.h
276 rm -f config*status config*cache config*log
277 rm -f gmon.out core build-stamp
282 # Install/uninstall rules
284 install: libdvdcss-install vlc-install plugins-install po-install
286 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
289 mkdir -p $(DESTDIR)$(bindir)
290 $(INSTALL) vlc $(DESTDIR)$(bindir)
292 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
294 mkdir -p $(DESTDIR)$(datadir)/videolan
295 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
296 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
297 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
300 rm -f $(DESTDIR)$(bindir)/vlc
302 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
304 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
305 rm -f $(DESTDIR)$(datadir)/videolan/*.png
306 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
309 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
311 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
315 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
318 -cd extras/libdvdcss && $(MAKE) install
321 -cd extras/libdvdcss && $(MAKE) uninstall
324 -cd extras/libdvdread && $(MAKE) install
326 libdvdread-uninstall:
327 -cd extras/libdvdread && $(MAKE) uninstall
330 -cd po && $(MAKE) install
333 -cd po && $(MAKE) uninstall
336 # Package generation rules
339 # Check that tmp isn't in the way
340 @if test -e tmp; then \
341 echo "Error: please remove ./tmp, it is in the way"; false; \
343 echo "OK."; mkdir tmp; \
345 # Copy directory structure in tmp
346 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
347 do mkdir -p tmp/vlc/$$i ; \
350 find debian -mindepth 1 -maxdepth 1 -type d | \
351 while read i ; do rm -Rf tmp/vlc/$$i ; done
352 # Copy .c .h .in .cpp and .glade files
353 find include src plugins -type f -name '*.[chig]*' | while read i ; \
354 do cp $$i tmp/vlc/$$i ; done
355 # Copy plugin Makefiles
356 find plugins -type f -name Makefile | while read i ; \
357 do cp $$i tmp/vlc/$$i ; done
358 # Copy extra programs and documentation
359 cp -a extras/* tmp/vlc/extras
360 cp -a doc/* tmp/vlc/doc
361 find tmp/vlc/extras tmp/vlc/doc \
362 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
363 while read i ; do rm -Rf $$i ; done
365 cp po/*.po tmp/vlc/po
366 for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
368 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
369 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
370 configure configure.in install-sh install-win32 vlc.spec \
371 config.sub config.guess acconfig.h aclocal.m4 mkinstalldirs \
373 # Copy Debian control files
374 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
375 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
376 for file in control changelog rules ; do \
377 cp debian/$$file tmp/vlc/debian/ ; done
378 # Copy ipkg control files
379 for file in control rules ; do \
380 cp ipkg/$$file tmp/vlc/ipkg/ ; done
381 # Copy fonts and icons
382 for file in share/*png share/*xpm share/*psf ; do \
383 cp $$file tmp/vlc/share ; done
384 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
385 cp share/$$file tmp/vlc/share/ ; done
387 snapshot: snapshot-common
389 F=vlc-${VLC_QUICKVERSION}; \
390 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
391 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
392 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
396 snapshot-nocss: snapshot-common
398 rm -Rf tmp/vlc/extras/libdvdcss
399 rm -f tmp/vlc/*.libdvdcss
400 # Fix debian information
401 rm -f tmp/vlc/debian/libdvdcss*
402 rm -f tmp/vlc/debian/control
403 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
404 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
405 > tmp/vlc/debian/control
406 rm -f tmp/vlc/debian/rules
407 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
408 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
409 > tmp/vlc/debian/rules
410 chmod +x tmp/vlc/debian/rules
411 # Build css-disabled archives
412 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
413 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
414 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
415 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
420 # XXX: this rule is probably only useful to you if you have exactly
421 # the same setup as me. Contact sam@zoy.org if you need to use it.
423 # Check that tmp isn't in the way
424 @if test -e tmp; then \
425 echo "Error: please remove ./tmp, it is in the way"; false; \
427 echo "OK."; mkdir tmp; \
429 # Create installation script
430 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
431 # Copy relevant files
432 cp vlc.exe $(PLUGINS:%=plugins/%.so) tmp/
433 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
434 README README.libdvdcss FAQ TODO tmp/
435 for file in iconv.dll libgmodule-1.3-12.dll libgtk-0.dll libgdk-0.dll \
436 libgobject-1.3-12.dll libintl-1.dll libglib-1.3-12.dll \
437 libgthread-1.3-12.dll SDL.dll README-SDL.txt ; \
438 do cp ${DLL_PATH}/$$file tmp/ ; done
440 for file in default8x16.psf default8x9.psf ; \
441 do cp share/$$file tmp/share/ ; done
443 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
444 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
445 vlc-${VLC_QUICKVERSION}-win32-installer.exe
450 # Check that tmp isn't in the way
451 @if test -e tmp; then \
452 echo "Error: please remove ./tmp, it is in the way"; false; \
454 echo "OK."; mkdir tmp; \
458 mkdir -p tmp/vlc/share
459 # Copy relevant files
461 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
462 README README.libdvdcss FAQ TODO tmp/vlc/
463 for file in default8x16.psf default8x9.psf ; \
464 do cp share/$$file tmp/vlc/share/ ; done
466 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
467 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
468 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
469 mv tmp/vlc-${VLC_QUICKVERSION}-BeOS-x86.zip .
474 # Check that tmp isn't in the way
475 @if test -e tmp; then \
476 echo "Error: please remove ./tmp, it is in the way"; false; \
478 echo "OK."; mkdir tmp; \
481 # Copy relevant files
483 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
484 README README.libdvdcss FAQ TODO tmp/
487 ./macosx-dmg 0 "vlc-${VLC_QUICKVERSION}" tmp/*
492 libdvdcss-snapshot: snapshot-common
493 # Remove vlc sources and icons, doc, debian directory...
494 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
495 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
496 rm -Rf tmp/vlc/debian
498 # Remove useless headers
499 rm -f tmp/vlc/include/*
500 for file in defs.h.in config.h common.h int_types.h ; \
501 do cp include/$$file tmp/vlc/include/ ; done
502 # Remove misc files (??? - maybe not really needed)
503 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
504 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
505 mv tmp/vlc/README.libdvdcss tmp/vlc/README
506 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
508 rm -f tmp/vlc/Makefile
509 sed -e 's#^install:#install-unused:#' \
510 -e 's#^uninstall:#uninstall-unused:#' \
511 -e 's#^clean:#clean-unused:#' \
512 -e 's#^all:.*#all: libdvdcss#' \
513 -e 's#^libdvdcss-install:#install:#' \
514 -e 's#^libdvdcss-uninstall:#uninstall:#' \
515 -e 's#^libdvdcss-clean:#clean:#' \
516 < Makefile > tmp/vlc/Makefile
518 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
519 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
520 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
521 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
526 dpkg-buildpackage -rfakeroot -us -uc
529 # Gtk/Gnome/* aliases and OS X application
531 gnome-vlc gvlc kvlc qvlc: vlc
532 rm -f $@ && ln -s vlc $@
535 vlc.app: Makefile.opts
536 ifneq (,$(findstring darwin,$(SYS)))
538 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
539 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
540 $(INSTALL) -d vlc.app/Contents/MacOS/share
541 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
542 $(INSTALL) vlc vlc.app/Contents/MacOS/
544 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
546 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
552 # Generic rules (see below)
554 $(H_OBJ): Makefile.opts Makefile.dep Makefile
555 # @echo "regenerating $@"
556 @rm -f $@ && cp $@.in $@
558 @for i in $(BUILTINS) ; do \
559 echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \
560 echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \
561 echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \
565 @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
566 @echo " do \\" >> $@ ;
567 @echo " { \\" >> $@ ;
569 @for i in $(BUILTINS) ; do \
570 echo " ALLOCATE_BUILTIN("$$i"); \\" >> $@ ; \
573 @echo " } while( 0 );" >> $@ ;
577 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
579 $(CPP_DEP): %.dpp: FORCE
580 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
582 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
583 $(C_OBJ): %.o: $(H_OBJ)
584 $(C_OBJ): %.o: .dep/%.d
586 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
588 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
589 $(CPP_OBJ): %.o: $(H_OBJ)
590 $(CPP_OBJ): %.o: .dep/%.dpp
591 $(CPP_OBJ): %.o: %.cpp
592 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
594 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
595 ifneq (,(findstring mingw32,$(SYS)))
596 $(RESOURCE_OBJ): %.o: %.rc
597 $(WINDRES) -i $< -o $@
601 # Main application target
603 vlc: Makefile.opts Makefile.dep Makefile $(VLC_OBJ) $(BUILTIN_OBJ)
604 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS)
606 xres -o $@ ./share/vlc_beos.rsrc
613 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
615 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
618 # Built-in modules target
620 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
621 $(BUILTIN_OBJ): FORCE
622 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
627 libdvdcss: Makefile.opts
628 @cd extras/libdvdcss && $(MAKE)
633 libdvdread: Makefile.opts
634 @cd extras/libdvdread && $(MAKE)