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 \
55 PLUGINS_TARGETS := ac3_adec/ac3_adec \
60 chroma/chroma_i420_rgb \
61 chroma/chroma_i420_rgb_mmx \
62 chroma/chroma_i420_yuy2 \
63 chroma/chroma_i420_yuy2_mmx \
64 chroma/chroma_i422_yuy2 \
65 chroma/chroma_i422_yuy2_mmx \
66 chroma/chroma_i420_ymga \
67 chroma/chroma_i420_ymga_mmx \
79 filter/filter_deinterlace \
80 filter/filter_transform \
81 filter/filter_invert \
82 filter/filter_distort \
97 liba52_adec/liba52_adec \
103 memcpy/memcpymmxext \
109 motion/motionmmxext \
111 motion/motionaltivec \
112 mpeg_system/mpeg_es \
113 mpeg_system/mpeg_ps \
114 mpeg_system/mpeg_ts \
115 mpeg_adec/mpeg_adec \
116 mpeg_vdec/mpeg_vdec \
131 INTERFACE := main interface intf_msg intf_playlist intf_eject
132 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
133 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
134 AUDIO_OUTPUT := audio_output aout_common aout_ext-dec aout_spdif
135 MISC := mtime modules netutils iso_lang
137 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
138 $(INPUT:%=src/input/%.o) \
139 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
140 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
141 $(MISC:%=src/misc/%.o)
146 ifeq ($(NEED_GETOPT),1)
147 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
150 ifeq ($(NEED_SYMBOLS),1)
151 C_OBJ += src/misc/symbols.o
155 CPP_OBJ := src/misc/beos_specific.o
158 ifneq (,$(findstring darwin,$(SYS)))
159 C_OBJ += src/misc/darwin_specific.o
162 ifneq (,$(findstring mingw32,$(SYS)))
163 C_OBJ += src/misc/win32_specific.o
164 RESOURCE_OBJ := share/vlc_win32_rc.o
167 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
172 H_OBJ := src/misc/modules_builtin.h
175 # Other lists of files
177 C_DEP := $(C_OBJ:%.o=.dep/%.d)
178 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
181 # Translate plugin names
184 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
187 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
193 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
194 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
197 # All symbols must be exported
200 ###############################################################################
202 ###############################################################################
207 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
210 @echo "**** No configuration found, please run ./configure"
213 # $(MAKE) $(MAKECMDGOALS)
218 @echo CFLAGS: $(CFLAGS)
219 @echo DCFLAGS: $(DCFLAGS)
220 @echo LDFLAGS: $(LDFLAGS)
221 @echo PCFLAGS: $(PCFLAGS)
222 @echo PLDFLAGS: $(PLDFLAGS)
223 @echo C_OBJ: $(C_OBJ)
224 @echo CPP_OBJ: $(CPP_OBJ)
225 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
226 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
231 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
232 rm -f src/*/*.o extras/*/*.o
233 rm -f lib/*.so* lib/*.a
234 rm -f plugins/*.so plugins/*.a
235 rm -rf extras/MacOSX/build
238 -cd extras/libdvdcss && $(MAKE) clean
241 -cd po && $(MAKE) clean
244 -cd extras/libdvdread && $(MAKE) clean
247 for dir in $(PLUGINS_DIR) ; do \
248 ( cd plugins/$${dir} \
249 && $(MAKE) -f ../../Makefile.modules clean ) ; done
250 rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
253 rm -f $(C_OBJ) $(CPP_OBJ)
254 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
258 -cd po && $(MAKE) maintainer-clean
259 rm -f **/*.o **/*~ *.log
261 rm -f include/defs.h include/modules_builtin.h
262 rm -f src/misc/modules_builtin.h
263 rm -f config*status config*cache config*log
264 rm -f gmon.out core build-stamp
269 # Install/uninstall rules
271 install: libdvdcss-install vlc-install plugins-install po-install
273 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
276 mkdir -p $(DESTDIR)$(bindir)
277 $(INSTALL) vlc $(DESTDIR)$(bindir)
279 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
281 mkdir -p $(DESTDIR)$(datadir)/videolan
282 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
283 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
284 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
287 rm -f $(DESTDIR)$(bindir)/vlc
289 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
291 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
292 rm -f $(DESTDIR)$(datadir)/videolan/*.png
293 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
296 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
298 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
302 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
305 -cd extras/libdvdcss && $(MAKE) install
308 -cd extras/libdvdcss && $(MAKE) uninstall
311 -cd extras/libdvdread && $(MAKE) install
313 libdvdread-uninstall:
314 -cd extras/libdvdread && $(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"); \\" >> $@ ; \
540 @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)
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)
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)