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 \
59 chroma/chroma_yv12_rgb16 \
68 filter/filter_deinterlace \
69 filter/filter_transform \
70 filter/filter_invert \
71 filter/filter_distort \
101 motion/motionaltivec \
102 mpeg_system/mpeg_es \
103 mpeg_system/mpeg_ps \
104 mpeg_system/mpeg_ts \
105 mpeg_adec/mpeg_adec \
106 mpeg_vdec/mpeg_vdec \
121 INTERFACE := main interface intf_msg intf_playlist
122 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
123 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
124 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
125 MISC := mtime modules netutils iso_lang
127 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
128 $(INPUT:%=src/input/%.o) \
129 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
130 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
131 $(MISC:%=src/misc/%.o)
136 ifeq ($(NEED_GETOPT),1)
137 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
141 CPP_OBJ := src/misc/beos_specific.o
144 ifneq (,$(findstring darwin,$(SYS)))
145 C_OBJ += src/misc/darwin_specific.o
148 ifneq (,$(findstring mingw32,$(SYS)))
149 C_OBJ += src/misc/win32_specific.o
150 RESOURCE_OBJ := share/vlc_win32_rc.o
153 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
158 H_OBJ := src/misc/modules_builtin.h
161 # Other lists of files
163 C_DEP := $(C_OBJ:%.o=.dep/%.d)
164 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
167 # Translate plugin names
170 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
173 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
179 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
180 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
183 # All symbols must be exported
186 ###############################################################################
188 ###############################################################################
193 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
196 @echo "**** No configuration found, please run ./configure"
199 # $(MAKE) $(MAKECMDGOALS)
204 @echo CFLAGS: $(CFLAGS)
205 @echo DCFLAGS: $(DCFLAGS)
206 @echo LDFLAGS: $(LDFLAGS)
207 @echo PCFLAGS: $(PCFLAGS)
208 @echo PLDFLAGS: $(PLDFLAGS)
209 @echo C_OBJ: $(C_OBJ)
210 @echo CPP_OBJ: $(CPP_OBJ)
211 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
212 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
217 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
218 rm -f src/*/*.o extras/*/*.o
219 rm -f lib/*.so* lib/*.a
220 rm -f plugins/*.so plugins/*.a
221 rm -rf extras/MacOSX/build
224 -cd extras/libdvdcss && $(MAKE) clean
227 -cd po && $(MAKE) clean
230 -cd extras/libdvdread && $(MAKE) clean
233 for dir in $(PLUGINS_DIR) ; do \
234 ( cd plugins/$${dir} \
235 && $(MAKE) -f ../../Makefile.modules clean ) ; done
236 rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
239 rm -f $(C_OBJ) $(CPP_OBJ)
240 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
244 -cd po && $(MAKE) maintainer-clean
245 rm -f **/*.o **/*~ *.log
247 rm -f include/defs.h include/config.h include/modules_builtin.h
248 rm -f src/misc/modules_builtin.h
249 rm -f config*status config*cache config*log
250 rm -f gmon.out core build-stamp
255 # Install/uninstall rules
257 install: libdvdcss-install vlc-install plugins-install po-install
259 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
262 mkdir -p $(DESTDIR)$(bindir)
263 $(INSTALL) vlc $(DESTDIR)$(bindir)
265 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
267 mkdir -p $(DESTDIR)$(datadir)/videolan
268 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
269 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
270 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
273 rm -f $(DESTDIR)$(bindir)/vlc
275 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
277 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
278 rm -f $(DESTDIR)$(datadir)/videolan/*.png
279 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
282 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
284 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
288 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
291 -cd extras/libdvdcss && $(MAKE) install
294 -cd extras/libdvdcss && $(MAKE) uninstall
297 -cd po && $(MAKE) install
300 -cd po && $(MAKE) uninstall
303 # Package generation rules
306 # Check that tmp isn't in the way
307 @if test -e tmp; then \
308 echo "Error: please remove ./tmp, it is in the way"; false; \
310 echo "OK."; mkdir tmp; \
312 # Copy directory structure in tmp
313 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
314 do mkdir -p tmp/vlc/$$i ; \
317 find debian -mindepth 1 -maxdepth 1 -type d | \
318 while read i ; do rm -Rf tmp/vlc/$$i ; done
319 # Copy .c .h .in .cpp and .glade files
320 find include src plugins -type f -name '*.[chig]*' | while read i ; \
321 do cp $$i tmp/vlc/$$i ; done
322 # Copy plugin Makefiles
323 find plugins -type f -name Makefile | while read i ; \
324 do cp $$i tmp/vlc/$$i ; done
325 # Copy extra programs and documentation
326 cp -a extras/* tmp/vlc/extras
327 cp -a doc/* tmp/vlc/doc
328 find tmp/vlc/extras tmp/vlc/doc \
329 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
330 while read i ; do rm -Rf $$i ; done
332 cp po/*.po tmp/vlc/po
333 for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
335 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
336 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
337 configure configure.in install-sh install-win32 vlc.spec \
338 config.sub config.guess acconfig.h aclocal.m4 mkinstalldirs \
340 # Copy Debian control files
341 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
342 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
343 for file in control changelog rules ; do \
344 cp debian/$$file tmp/vlc/debian/ ; done
345 # Copy ipkg control files
346 for file in control rules ; do \
347 cp ipkg/$$file tmp/vlc/ipkg/ ; done
348 # Copy fonts and icons
349 for file in share/*png share/*xpm share/*psf ; do \
350 cp $$file tmp/vlc/share ; done
351 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
352 cp share/$$file tmp/vlc/share/ ; done
354 snapshot: snapshot-common
356 F=vlc-${VLC_QUICKVERSION}; \
357 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
358 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
359 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
363 snapshot-nocss: snapshot-common
365 rm -Rf tmp/vlc/extras/libdvdcss
366 rm -f tmp/vlc/*.libdvdcss
367 # Fix debian information
368 rm -f tmp/vlc/debian/libdvdcss*
369 rm -f tmp/vlc/debian/control
370 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
371 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
372 > tmp/vlc/debian/control
373 rm -f tmp/vlc/debian/rules
374 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
375 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
376 > tmp/vlc/debian/rules
377 chmod +x tmp/vlc/debian/rules
378 # Build css-disabled archives
379 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
380 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
381 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
382 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
387 # XXX: this rule is probably only useful to you if you have exactly
388 # the same setup as me. Contact sam@zoy.org if you need to use it.
390 # Check that tmp isn't in the way
391 @if test -e tmp; then \
392 echo "Error: please remove ./tmp, it is in the way"; false; \
394 echo "OK."; mkdir tmp; \
396 # Create installation script
397 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
398 # Copy relevant files
399 cp vlc.exe $(PLUGINS:%=plugins/%.so) tmp/
400 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
401 README README.libdvdcss FAQ TODO tmp/
402 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
403 gnu-intl.dll SDL.dll README-SDL.txt ; \
404 do cp ${DLL_PATH}/$$file tmp/ ; done
406 for file in default8x16.psf default8x9.psf ; \
407 do cp share/$$file tmp/share/ ; done
409 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
410 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
411 vlc-${VLC_QUICKVERSION}-win32-installer.exe
416 # Check that tmp isn't in the way
417 @if test -e tmp; then \
418 echo "Error: please remove ./tmp, it is in the way"; false; \
420 echo "OK."; mkdir tmp; \
424 mkdir -p tmp/vlc/share
425 # Copy relevant files
427 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
428 README README.libdvdcss FAQ TODO tmp/vlc/
429 for file in default8x16.psf default8x9.psf ; \
430 do cp share/$$file tmp/vlc/share/ ; done
432 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
433 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
434 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
435 mv tmp/vlc-${VLC_QUICKVERSION}-beos.zip .
439 libdvdcss-snapshot: snapshot-common
440 # Remove vlc sources and icons, doc, debian directory...
441 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
442 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
443 rm -Rf tmp/vlc/debian
445 # Remove useless headers
446 rm -f tmp/vlc/include/*
447 for file in defs.h.in config.h.in common.h int_types.h ; \
448 do cp include/$$file tmp/vlc/include/ ; done
449 # Remove misc files (??? - maybe not really needed)
450 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
451 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
452 mv tmp/vlc/README.libdvdcss tmp/vlc/README
453 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
455 rm -f tmp/vlc/Makefile
456 sed -e 's#^install:#install-unused:#' \
457 -e 's#^uninstall:#uninstall-unused:#' \
458 -e 's#^clean:#clean-unused:#' \
459 -e 's#^all:.*#all: libdvdcss#' \
460 -e 's#^libdvdcss-install:#install:#' \
461 -e 's#^libdvdcss-uninstall:#uninstall:#' \
462 -e 's#^libdvdcss-clean:#clean:#' \
463 < Makefile > tmp/vlc/Makefile
465 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
466 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
467 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
468 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
473 dpkg-buildpackage -rfakeroot -us -uc
476 # Gtk/Gnome/* aliases and OS X application
478 gnome-vlc gvlc kvlc qvlc: vlc
479 rm -f $@ && ln -s vlc $@
482 vlc.app: Makefile.opts
483 ifneq (,$(findstring darwin,$(SYS)))
485 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
486 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
487 $(INSTALL) -d vlc.app/Contents/MacOS/share
488 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
489 $(INSTALL) vlc vlc.app/Contents/MacOS/
491 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
493 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
499 # Generic rules (see below)
501 $(H_OBJ): Makefile.opts Makefile.dep Makefile
502 # @echo "regenerating $@"
503 @rm -f $@ && cp $@.in $@
505 @for i in $(BUILTINS) ; do \
506 echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \
507 echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \
508 echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \
512 @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
513 @echo " do \\" >> $@ ;
514 @echo " { \\" >> $@ ;
516 @for i in $(BUILTINS) ; do \
517 echo " ALLOCATE_BUILTIN("$$i"); \\" >> $@ ; \
519 @echo " } while( 0 );" >> $@ ;
524 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
526 $(CPP_DEP): %.dpp: FORCE
527 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
529 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile $(H_OBJ)
530 $(C_OBJ): %.o: .dep/%.d
532 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
534 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
535 $(CPP_OBJ): %.o: .dep/%.dpp
536 $(CPP_OBJ): %.o: %.cpp
537 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
539 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
540 ifneq (,(findstring mingw32,$(SYS)))
541 $(RESOURCE_OBJ): %.o: %.rc
542 $(WINDRES) -i $< -o $@
546 # Main application target
548 vlc: Makefile.opts Makefile.dep Makefile $(VLC_OBJ) $(BUILTIN_OBJ)
549 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS)
551 xres -o $@ ./share/vlc_beos.rsrc
558 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
560 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
563 # Built-in modules target
565 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
566 $(BUILTIN_OBJ): FORCE
567 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
572 libdvdcss: Makefile.opts
573 @cd extras/libdvdcss && $(MAKE)
578 libdvdread: Makefile.opts
579 @cd extras/libdvdread && $(MAKE)