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 \
53 PLUGINS_TARGETS := ac3_adec/ac3_adec \
58 chroma/chroma_yv12_rgb8 \
68 filter/filter_bob422 \
69 filter/filter_invert \
99 motion/motionaltivec \
100 mpeg_system/mpeg_es \
101 mpeg_system/mpeg_ps \
102 mpeg_system/mpeg_ts \
103 mpeg_adec/mpeg_adec \
104 mpeg_vdec/mpeg_vdec \
119 INTERFACE := main interface intf_msg intf_playlist
120 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist input_clock mpeg_system
121 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
122 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
123 MISC := mtime tests modules netutils iso_lang
125 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
126 $(INPUT:%=src/input/%.o) \
127 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
128 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
129 $(MISC:%=src/misc/%.o)
134 ifeq ($(NEED_GETOPT),1)
135 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
139 CPP_OBJ := src/misc/beos_specific.o
142 ifneq (,$(findstring darwin,$(SYS)))
143 C_OBJ += src/misc/darwin_specific.o
146 ifneq (,$(findstring mingw32,$(SYS)))
147 C_OBJ += src/misc/win32_specific.o
148 RESOURCE_OBJ := share/vlc_win32_rc.o
151 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
156 H_OBJ := src/misc/modules_builtin.h
159 # Other lists of files
161 C_DEP := $(C_OBJ:%.o=.dep/%.d)
162 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
165 # Translate plugin names
168 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
171 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
177 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
178 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
181 # All symbols must be exported
184 ###############################################################################
186 ###############################################################################
191 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
194 @echo "**** No configuration found, running ./configure..."
196 $(MAKE) $(MAKECMDGOALS)
201 @echo CFLAGS: $(CFLAGS)
202 @echo DCFLAGS: $(DCFLAGS)
203 @echo LCFLAGS: $(LCFLAGS)
204 @echo PCFLAGS: $(PCFLAGS)
205 @echo PLCFLAGS: $(PLCFLAGS)
206 @echo C_OBJ: $(C_OBJ)
207 @echo CPP_OBJ: $(CPP_OBJ)
208 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
209 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
214 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
215 rm -f src/*/*.o extras/*/*.o
216 rm -f lib/*.so* lib/*.a
217 rm -f plugins/*.so plugins/*.a
218 rm -rf extras/MacOSX/build
221 -cd extras/libdvdcss && $(MAKE) clean
224 -cd po && $(MAKE) clean
227 -cd extras/libdvdread && $(MAKE) clean
230 for dir in $(PLUGINS_DIR) ; do \
231 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
232 rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
235 rm -f $(C_OBJ) $(CPP_OBJ)
236 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
240 -cd po && $(MAKE) maintainer-clean
241 rm -f **/*.o **/*~ *.log
243 rm -f include/defs.h include/config.h include/modules_builtin.h
244 rm -f src/misc/modules_builtin.h
245 rm -f config*status config*cache config*log
246 rm -f gmon.out core build-stamp
251 # Install/uninstall rules
253 install: libdvdcss-install vlc-install plugins-install po-install
255 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
258 mkdir -p $(DESTDIR)$(bindir)
259 $(INSTALL) vlc $(DESTDIR)$(bindir)
261 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
263 mkdir -p $(DESTDIR)$(datadir)/videolan
264 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
265 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
266 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
269 rm -f $(DESTDIR)$(bindir)/vlc
271 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
273 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
274 rm -f $(DESTDIR)$(datadir)/videolan/*.png
275 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
278 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
280 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
284 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
287 -cd extras/libdvdcss && $(MAKE) install
290 -cd extras/libdvdcss && $(MAKE) uninstall
293 -cd po && $(MAKE) install
296 -cd po && $(MAKE) uninstall
299 # Package generation rules
302 # Check that tmp isn't in the way
303 @if test -e tmp; then \
304 echo "Error: please remove ./tmp, it is in the way"; false; \
306 echo "OK."; mkdir tmp; \
308 # Copy directory structure in tmp
309 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
310 do mkdir -p tmp/vlc/$$i ; \
313 find debian -mindepth 1 -maxdepth 1 -type d | \
314 while read i ; do rm -Rf tmp/vlc/$$i ; done
315 # Copy .c .h .in .cpp and .glade files
316 find include src plugins -type f -name '*.[chig]*' | while read i ; \
317 do cp $$i tmp/vlc/$$i ; done
318 # Copy plugin Makefiles
319 find plugins -type f -name Makefile | while read i ; \
320 do cp $$i tmp/vlc/$$i ; done
321 # Copy extra programs and documentation
322 cp -a extras/* tmp/vlc/extras
323 cp -a doc/* tmp/vlc/doc
324 find tmp/vlc/extras tmp/vlc/doc \
325 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
326 while read i ; do rm -Rf $$i ; done
328 cp po/*.po tmp/vlc/po
329 for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
331 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
332 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
333 configure configure.in install-sh install-win32 vlc.spec \
334 config.sub config.guess acconfig.h aclocal.m4 mkinstalldirs \
336 # Copy Debian control files
337 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
338 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
339 for file in control changelog rules ; do \
340 cp debian/$$file tmp/vlc/debian/ ; done
341 # Copy ipkg control files
342 for file in control rules ; do \
343 cp ipkg/$$file tmp/vlc/ipkg/ ; done
344 # Copy fonts and icons
345 for file in share/*png share/*xpm share/*psf ; do \
346 cp $$file tmp/vlc/share ; done
347 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
348 cp share/$$file tmp/vlc/share/ ; done
350 snapshot: snapshot-common
352 F=vlc-${VLC_QUICKVERSION}; \
353 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
354 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
355 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
359 snapshot-nocss: snapshot-common
361 rm -Rf tmp/vlc/extras/libdvdcss
362 rm -f tmp/vlc/*.libdvdcss
363 # Fix debian information
364 rm -f tmp/vlc/debian/libdvdcss*
365 rm -f tmp/vlc/debian/control
366 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
367 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
368 > tmp/vlc/debian/control
369 rm -f tmp/vlc/debian/rules
370 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
371 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
372 > tmp/vlc/debian/rules
373 chmod +x tmp/vlc/debian/rules
374 # Build css-disabled archives
375 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
376 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
377 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
378 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
383 # XXX: this rule is probably only useful to you if you have exactly
384 # the same setup as me. Contact sam@zoy.org if you need to use it.
386 # Check that tmp isn't in the way
387 @if test -e tmp; then \
388 echo "Error: please remove ./tmp, it is in the way"; false; \
390 echo "OK."; mkdir tmp; \
392 # Create installation script
393 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
394 # Copy relevant files
395 cp vlc.exe plugins/directx.so plugins/gtk.so plugins/sdl.so tmp/
396 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
397 README README.libdvdcss FAQ TODO tmp/
398 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
399 gnu-intl.dll SDL.dll README-SDL.txt ; \
400 do cp ../win32-libs/$$file tmp/ ; done
402 for file in default8x16.psf default8x9.psf ; \
403 do cp share/$$file tmp/share/ ; done
405 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
406 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
407 vlc-${VLC_QUICKVERSION}-win32-installer.exe
412 # Check that tmp isn't in the way
413 @if test -e tmp; then \
414 echo "Error: please remove ./tmp, it is in the way"; false; \
416 echo "OK."; mkdir tmp; \
420 mkdir -p tmp/vlc/share
421 # Copy relevant files
423 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
424 README README.libdvdcss FAQ TODO tmp/vlc/
425 for file in default8x16.psf default8x9.psf ; \
426 do cp share/$$file tmp/vlc/share/ ; done
428 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
429 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
430 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
431 mv tmp/vlc-${VLC_QUICKVERSION}-beos.zip .
435 libdvdcss-snapshot: snapshot-common
436 # Remove vlc sources and icons, doc, debian directory...
437 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
438 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
439 rm -Rf tmp/vlc/debian
441 # Remove useless headers
442 rm -f tmp/vlc/include/*
443 for file in defs.h.in config.h.in common.h int_types.h ; \
444 do cp include/$$file tmp/vlc/include/ ; done
445 # Remove misc files (??? - maybe not really needed)
446 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
447 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
448 mv tmp/vlc/README.libdvdcss tmp/vlc/README
449 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
451 rm -f tmp/vlc/Makefile
452 sed -e 's#^install:#install-unused:#' \
453 -e 's#^uninstall:#uninstall-unused:#' \
454 -e 's#^clean:#clean-unused:#' \
455 -e 's#^all:.*#all: libdvdcss#' \
456 -e 's#^libdvdcss-install:#install:#' \
457 -e 's#^libdvdcss-uninstall:#uninstall:#' \
458 -e 's#^libdvdcss-clean:#clean:#' \
459 < Makefile > tmp/vlc/Makefile
461 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
462 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
463 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
464 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
469 dpkg-buildpackage -rfakeroot -us -uc
472 # Gtk/Gnome/* aliases and OS X application
474 gnome-vlc gvlc kvlc qvlc: vlc
475 rm -f $@ && ln -s vlc $@
478 vlc.app: Makefile.opts
479 ifneq (,$(findstring darwin,$(SYS)))
481 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
482 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
483 $(INSTALL) -d vlc.app/Contents/MacOS/share
484 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
485 $(INSTALL) vlc vlc.app/Contents/MacOS/
487 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
489 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
495 # Generic rules (see below)
498 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
500 $(CPP_DEP): %.dpp: FORCE
501 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
503 $(H_OBJ): Makefile.opts Makefile.dep Makefile
504 rm -f $@ && cp $@.in $@
506 for i in $(BUILTINS) ; do \
507 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
508 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
509 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
512 printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
513 for i in $(BUILTINS) ; do \
514 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
516 echo "} while( 0 );" >> $@ ;
520 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
521 $(C_OBJ): %.o: .dep/%.d
523 $(CC) $(CFLAGS) -c -o $@ $<
525 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
526 $(CPP_OBJ): %.o: .dep/%.dpp
527 $(CPP_OBJ): %.o: %.cpp
528 $(CC) $(CFLAGS) -c -o $@ $<
530 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
531 ifneq (,(findstring mingw32,$(SYS)))
532 $(RESOURCE_OBJ): %.o: %.rc
533 $(WINDRES) -i $< -o $@
537 # Main application target
539 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ)
540 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
542 xres -o $@ ./share/vlc_beos.rsrc
549 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
551 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
554 # Built-in modules target
556 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
557 $(BUILTIN_OBJ): FORCE
558 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
563 libdvdcss: Makefile.opts
564 @cd extras/libdvdcss && $(MAKE)
569 libdvdread: Makefile.opts
570 @cd extras/libdvdread && $(MAKE)