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 \
56 PLUGINS_TARGETS := ac3_adec/ac3_adec \
61 chroma/chroma_i420_rgb \
62 chroma/chroma_i420_rgb_mmx \
63 chroma/chroma_i420_yuy2 \
64 chroma/chroma_i420_yuy2_mmx \
65 chroma/chroma_i422_yuy2 \
66 chroma/chroma_i422_yuy2_mmx \
67 chroma/chroma_i420_ymga \
68 chroma/chroma_i420_ymga_mmx \
80 filter/filter_deinterlace \
81 filter/filter_transform \
82 filter/filter_invert \
83 filter/filter_distort \
100 lpcm_adec/lpcm_adec \
105 memcpy/memcpymmxext \
111 motion/motionmmxext \
113 motion/motionaltivec \
114 mpeg_system/mpeg_es \
115 mpeg_system/mpeg_ps \
116 mpeg_system/mpeg_ts \
117 mpeg_adec/mpeg_adec \
118 mpeg_vdec/mpeg_vdec \
134 INTERFACE := main interface intf_msg intf_playlist intf_eject
135 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
136 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
137 AUDIO_OUTPUT := audio_output aout_common aout_ext-dec aout_spdif
138 MISC := mtime modules netutils iso_lang
140 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
141 $(INPUT:%=src/input/%.o) \
142 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
143 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
144 $(MISC:%=src/misc/%.o)
149 ifeq ($(NEED_GETOPT),1)
150 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
153 ifeq ($(NEED_SYMBOLS),1)
154 C_OBJ += src/misc/symbols.o
158 CPP_OBJ := src/misc/beos_specific.o
161 ifneq (,$(findstring darwin,$(SYS)))
162 C_OBJ += src/misc/darwin_specific.o
165 ifneq (,$(findstring mingw32,$(SYS)))
166 C_OBJ += src/misc/win32_specific.o
167 RESOURCE_OBJ := share/vlc_win32_rc.o
170 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
175 H_OBJ := src/misc/modules_builtin.h
178 # Other lists of files
180 C_DEP := $(C_OBJ:%.o=.dep/%.d)
181 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
184 # Translate plugin names
187 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
190 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
196 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
197 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
200 # All symbols must be exported
203 ###############################################################################
205 ###############################################################################
210 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
213 @echo "**** No configuration found, please run ./configure"
216 # $(MAKE) $(MAKECMDGOALS)
221 @echo CFLAGS: $(CFLAGS)
222 @echo DCFLAGS: $(DCFLAGS)
223 @echo LDFLAGS: $(LDFLAGS)
224 @echo PCFLAGS: $(PCFLAGS)
225 @echo PLDFLAGS: $(PLDFLAGS)
226 @echo C_OBJ: $(C_OBJ)
227 @echo CPP_OBJ: $(CPP_OBJ)
228 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
229 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
234 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
235 rm -f src/*/*.o extras/*/*.o
236 rm -f lib/*.so* lib/*.a
237 rm -f plugins/*.so plugins/*.a
238 rm -rf extras/MacOSX/build
241 -cd extras/libdvdcss && $(MAKE) clean
244 -cd po && $(MAKE) clean
247 -cd extras/libdvdread && $(MAKE) clean
250 for dir in $(PLUGINS_DIR) ; do \
251 ( cd plugins/$${dir} \
252 && $(MAKE) -f ../../Makefile.modules clean ) ; done
253 rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
256 rm -f $(C_OBJ) $(CPP_OBJ)
257 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
261 -cd po && $(MAKE) maintainer-clean
262 rm -f **/*.o **/*~ *.log
264 rm -f include/defs.h include/modules_builtin.h
265 rm -f src/misc/modules_builtin.h
266 rm -f config*status config*cache config*log
267 rm -f gmon.out core build-stamp
272 # Install/uninstall rules
274 install: libdvdcss-install vlc-install plugins-install po-install
276 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
279 mkdir -p $(DESTDIR)$(bindir)
280 $(INSTALL) vlc $(DESTDIR)$(bindir)
282 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
284 mkdir -p $(DESTDIR)$(datadir)/videolan
285 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
286 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
287 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
290 rm -f $(DESTDIR)$(bindir)/vlc
292 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
294 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
295 rm -f $(DESTDIR)$(datadir)/videolan/*.png
296 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
299 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
301 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
305 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
308 -cd extras/libdvdcss && $(MAKE) install
311 -cd extras/libdvdcss && $(MAKE) uninstall
314 -cd extras/libdvdread && $(MAKE) install
316 libdvdread-uninstall:
317 -cd extras/libdvdread && $(MAKE) uninstall
320 -cd po && $(MAKE) install
323 -cd po && $(MAKE) uninstall
326 # Package generation rules
329 # Check that tmp isn't in the way
330 @if test -e tmp; then \
331 echo "Error: please remove ./tmp, it is in the way"; false; \
333 echo "OK."; mkdir tmp; \
335 # Copy directory structure in tmp
336 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
337 do mkdir -p tmp/vlc/$$i ; \
340 find debian -mindepth 1 -maxdepth 1 -type d | \
341 while read i ; do rm -Rf tmp/vlc/$$i ; done
342 # Copy .c .h .in .cpp and .glade files
343 find include src plugins -type f -name '*.[chig]*' | while read i ; \
344 do cp $$i tmp/vlc/$$i ; done
345 # Copy plugin Makefiles
346 find plugins -type f -name Makefile | while read i ; \
347 do cp $$i tmp/vlc/$$i ; done
348 # Copy extra programs and documentation
349 cp -a extras/* tmp/vlc/extras
350 cp -a doc/* tmp/vlc/doc
351 find tmp/vlc/extras tmp/vlc/doc \
352 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
353 while read i ; do rm -Rf $$i ; done
355 cp po/*.po tmp/vlc/po
356 for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
358 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
359 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
360 configure configure.in install-sh install-win32 vlc.spec \
361 config.sub config.guess acconfig.h aclocal.m4 mkinstalldirs \
363 # Copy Debian control files
364 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
365 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
366 for file in control changelog rules ; do \
367 cp debian/$$file tmp/vlc/debian/ ; done
368 # Copy ipkg control files
369 for file in control rules ; do \
370 cp ipkg/$$file tmp/vlc/ipkg/ ; done
371 # Copy fonts and icons
372 for file in share/*png share/*xpm share/*psf ; do \
373 cp $$file tmp/vlc/share ; done
374 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
375 cp share/$$file tmp/vlc/share/ ; done
377 snapshot: snapshot-common
379 F=vlc-${VLC_QUICKVERSION}; \
380 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
381 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
382 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
386 snapshot-nocss: snapshot-common
388 rm -Rf tmp/vlc/extras/libdvdcss
389 rm -f tmp/vlc/*.libdvdcss
390 # Fix debian information
391 rm -f tmp/vlc/debian/libdvdcss*
392 rm -f tmp/vlc/debian/control
393 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
394 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
395 > tmp/vlc/debian/control
396 rm -f tmp/vlc/debian/rules
397 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
398 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
399 > tmp/vlc/debian/rules
400 chmod +x tmp/vlc/debian/rules
401 # Build css-disabled archives
402 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
403 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
404 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
405 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
410 # XXX: this rule is probably only useful to you if you have exactly
411 # the same setup as me. Contact sam@zoy.org if you need to use it.
413 # Check that tmp isn't in the way
414 @if test -e tmp; then \
415 echo "Error: please remove ./tmp, it is in the way"; false; \
417 echo "OK."; mkdir tmp; \
419 # Create installation script
420 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
421 # Copy relevant files
422 cp vlc.exe $(PLUGINS:%=plugins/%.so) tmp/
423 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
424 README README.libdvdcss FAQ TODO tmp/
425 for file in iconv.dll libgmodule-1.3-12.dll libgtk-0.dll libgdk-0.dll \
426 libgobject-1.3-12.dll libintl-1.dll libglib-1.3-12.dll \
427 libgthread-1.3-12.dll SDL.dll README-SDL.txt ; \
428 do cp ${DLL_PATH}/$$file tmp/ ; done
430 for file in default8x16.psf default8x9.psf ; \
431 do cp share/$$file tmp/share/ ; done
433 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
434 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
435 vlc-${VLC_QUICKVERSION}-win32-installer.exe
440 # Check that tmp isn't in the way
441 @if test -e tmp; then \
442 echo "Error: please remove ./tmp, it is in the way"; false; \
444 echo "OK."; mkdir tmp; \
448 mkdir -p tmp/vlc/share
449 # Copy relevant files
451 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
452 README README.libdvdcss FAQ TODO tmp/vlc/
453 for file in default8x16.psf default8x9.psf ; \
454 do cp share/$$file tmp/vlc/share/ ; done
456 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
457 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
458 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
459 mv tmp/vlc-${VLC_QUICKVERSION}-BeOS-x86.zip .
464 # Check that tmp isn't in the way
465 @if test -e tmp; then \
466 echo "Error: please remove ./tmp, it is in the way"; false; \
468 echo "OK."; mkdir tmp; \
471 # Copy relevant files
473 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
474 README README.libdvdcss FAQ TODO tmp/
477 ./macosx-dmg 0 "vlc-${VLC_QUICKVERSION}" tmp/*
482 libdvdcss-snapshot: snapshot-common
483 # Remove vlc sources and icons, doc, debian directory...
484 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
485 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
486 rm -Rf tmp/vlc/debian
488 # Remove useless headers
489 rm -f tmp/vlc/include/*
490 for file in defs.h.in config.h common.h int_types.h ; \
491 do cp include/$$file tmp/vlc/include/ ; done
492 # Remove misc files (??? - maybe not really needed)
493 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
494 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
495 mv tmp/vlc/README.libdvdcss tmp/vlc/README
496 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
498 rm -f tmp/vlc/Makefile
499 sed -e 's#^install:#install-unused:#' \
500 -e 's#^uninstall:#uninstall-unused:#' \
501 -e 's#^clean:#clean-unused:#' \
502 -e 's#^all:.*#all: libdvdcss#' \
503 -e 's#^libdvdcss-install:#install:#' \
504 -e 's#^libdvdcss-uninstall:#uninstall:#' \
505 -e 's#^libdvdcss-clean:#clean:#' \
506 < Makefile > tmp/vlc/Makefile
508 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
509 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
510 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
511 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
516 dpkg-buildpackage -rfakeroot -us -uc
519 # Gtk/Gnome/* aliases and OS X application
521 gnome-vlc gvlc kvlc qvlc: vlc
522 rm -f $@ && ln -s vlc $@
525 vlc.app: Makefile.opts
526 ifneq (,$(findstring darwin,$(SYS)))
528 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
529 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
530 $(INSTALL) -d vlc.app/Contents/MacOS/share
531 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
532 $(INSTALL) vlc vlc.app/Contents/MacOS/
534 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
536 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
542 # Generic rules (see below)
544 $(H_OBJ): Makefile.opts Makefile.dep Makefile
545 # @echo "regenerating $@"
546 @rm -f $@ && cp $@.in $@
548 @for i in $(BUILTINS) ; do \
549 echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \
550 echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \
551 echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \
555 @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
556 @echo " do \\" >> $@ ;
557 @echo " { \\" >> $@ ;
559 @for i in $(BUILTINS) ; do \
560 echo " ALLOCATE_BUILTIN("$$i"); \\" >> $@ ; \
563 @echo " } while( 0 );" >> $@ ;
567 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
569 $(CPP_DEP): %.dpp: FORCE
570 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
572 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
573 $(C_OBJ): %.o: $(H_OBJ)
574 $(C_OBJ): %.o: .dep/%.d
576 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
578 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
579 $(CPP_OBJ): %.o: $(H_OBJ)
580 $(CPP_OBJ): %.o: .dep/%.dpp
581 $(CPP_OBJ): %.o: %.cpp
582 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
584 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
585 ifneq (,(findstring mingw32,$(SYS)))
586 $(RESOURCE_OBJ): %.o: %.rc
587 $(WINDRES) -i $< -o $@
591 # Main application target
593 vlc: Makefile.opts Makefile.dep Makefile $(VLC_OBJ) $(BUILTIN_OBJ)
594 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS)
596 xres -o $@ ./share/vlc_beos.rsrc
603 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
605 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
608 # Built-in modules target
610 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
611 $(BUILTIN_OBJ): FORCE
612 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
617 libdvdcss: Makefile.opts
618 @cd extras/libdvdcss && $(MAKE)
623 libdvdread: Makefile.opts
624 @cd extras/libdvdread && $(MAKE)