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_transform \
69 filter/filter_invert \
70 filter/filter_distort \
100 motion/motionaltivec \
101 mpeg_system/mpeg_es \
102 mpeg_system/mpeg_ps \
103 mpeg_system/mpeg_ts \
104 mpeg_adec/mpeg_adec \
105 mpeg_vdec/mpeg_vdec \
120 INTERFACE := main interface intf_msg intf_playlist
121 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
122 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
123 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
124 MISC := mtime tests modules netutils iso_lang
126 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
127 $(INPUT:%=src/input/%.o) \
128 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
129 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
130 $(MISC:%=src/misc/%.o)
135 ifeq ($(NEED_GETOPT),1)
136 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
140 CPP_OBJ := src/misc/beos_specific.o
143 ifneq (,$(findstring darwin,$(SYS)))
144 C_OBJ += src/misc/darwin_specific.o
147 ifneq (,$(findstring mingw32,$(SYS)))
148 C_OBJ += src/misc/win32_specific.o
149 RESOURCE_OBJ := share/vlc_win32_rc.o
152 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
157 H_OBJ := src/misc/modules_builtin.h
160 # Other lists of files
162 C_DEP := $(C_OBJ:%.o=.dep/%.d)
163 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
166 # Translate plugin names
169 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
172 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
178 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
179 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
182 # All symbols must be exported
185 ###############################################################################
187 ###############################################################################
192 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
195 @echo "**** No configuration found, running ./configure..."
197 $(MAKE) $(MAKECMDGOALS)
202 @echo CFLAGS: $(CFLAGS)
203 @echo DCFLAGS: $(DCFLAGS)
204 @echo LCFLAGS: $(LCFLAGS)
205 @echo PCFLAGS: $(PCFLAGS)
206 @echo PLCFLAGS: $(PLCFLAGS)
207 @echo C_OBJ: $(C_OBJ)
208 @echo CPP_OBJ: $(CPP_OBJ)
209 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
210 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
215 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
216 rm -f src/*/*.o extras/*/*.o
217 rm -f lib/*.so* lib/*.a
218 rm -f plugins/*.so plugins/*.a
219 rm -rf extras/MacOSX/build
222 -cd extras/libdvdcss && $(MAKE) clean
225 -cd po && $(MAKE) clean
228 -cd extras/libdvdread && $(MAKE) clean
231 for dir in $(PLUGINS_DIR) ; do \
232 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
233 rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
236 rm -f $(C_OBJ) $(CPP_OBJ)
237 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
241 -cd po && $(MAKE) maintainer-clean
242 rm -f **/*.o **/*~ *.log
244 rm -f include/defs.h include/config.h include/modules_builtin.h
245 rm -f src/misc/modules_builtin.h
246 rm -f config*status config*cache config*log
247 rm -f gmon.out core build-stamp
252 # Install/uninstall rules
254 install: libdvdcss-install vlc-install plugins-install po-install
256 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
259 mkdir -p $(DESTDIR)$(bindir)
260 $(INSTALL) vlc $(DESTDIR)$(bindir)
262 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
264 mkdir -p $(DESTDIR)$(datadir)/videolan
265 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
266 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
267 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
270 rm -f $(DESTDIR)$(bindir)/vlc
272 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
274 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
275 rm -f $(DESTDIR)$(datadir)/videolan/*.png
276 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
279 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
281 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
285 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
288 -cd extras/libdvdcss && $(MAKE) install
291 -cd extras/libdvdcss && $(MAKE) uninstall
294 -cd po && $(MAKE) install
297 -cd po && $(MAKE) uninstall
300 # Package generation rules
303 # Check that tmp isn't in the way
304 @if test -e tmp; then \
305 echo "Error: please remove ./tmp, it is in the way"; false; \
307 echo "OK."; mkdir tmp; \
309 # Copy directory structure in tmp
310 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
311 do mkdir -p tmp/vlc/$$i ; \
314 find debian -mindepth 1 -maxdepth 1 -type d | \
315 while read i ; do rm -Rf tmp/vlc/$$i ; done
316 # Copy .c .h .in .cpp and .glade files
317 find include src plugins -type f -name '*.[chig]*' | while read i ; \
318 do cp $$i tmp/vlc/$$i ; done
319 # Copy plugin Makefiles
320 find plugins -type f -name Makefile | while read i ; \
321 do cp $$i tmp/vlc/$$i ; done
322 # Copy extra programs and documentation
323 cp -a extras/* tmp/vlc/extras
324 cp -a doc/* tmp/vlc/doc
325 find tmp/vlc/extras tmp/vlc/doc \
326 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
327 while read i ; do rm -Rf $$i ; done
329 cp po/*.po tmp/vlc/po
330 for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
332 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
333 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
334 configure configure.in install-sh install-win32 vlc.spec \
335 config.sub config.guess acconfig.h aclocal.m4 mkinstalldirs \
337 # Copy Debian control files
338 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
339 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
340 for file in control changelog rules ; do \
341 cp debian/$$file tmp/vlc/debian/ ; done
342 # Copy ipkg control files
343 for file in control rules ; do \
344 cp ipkg/$$file tmp/vlc/ipkg/ ; done
345 # Copy fonts and icons
346 for file in share/*png share/*xpm share/*psf ; do \
347 cp $$file tmp/vlc/share ; done
348 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
349 cp share/$$file tmp/vlc/share/ ; done
351 snapshot: snapshot-common
353 F=vlc-${VLC_QUICKVERSION}; \
354 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
355 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
356 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
360 snapshot-nocss: snapshot-common
362 rm -Rf tmp/vlc/extras/libdvdcss
363 rm -f tmp/vlc/*.libdvdcss
364 # Fix debian information
365 rm -f tmp/vlc/debian/libdvdcss*
366 rm -f tmp/vlc/debian/control
367 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
368 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
369 > tmp/vlc/debian/control
370 rm -f tmp/vlc/debian/rules
371 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
372 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
373 > tmp/vlc/debian/rules
374 chmod +x tmp/vlc/debian/rules
375 # Build css-disabled archives
376 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
377 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
378 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
379 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
384 # XXX: this rule is probably only useful to you if you have exactly
385 # the same setup as me. Contact sam@zoy.org if you need to use it.
387 # Check that tmp isn't in the way
388 @if test -e tmp; then \
389 echo "Error: please remove ./tmp, it is in the way"; false; \
391 echo "OK."; mkdir tmp; \
393 # Create installation script
394 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
395 # Copy relevant files
396 cp vlc.exe $(PLUGINS:%=plugins/%.so) tmp/
397 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
398 README README.libdvdcss FAQ TODO tmp/
399 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
400 gnu-intl.dll SDL.dll README-SDL.txt ; \
401 do cp ${DLL_PATH}/$$file tmp/ ; done
403 for file in default8x16.psf default8x9.psf ; \
404 do cp share/$$file tmp/share/ ; done
406 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
407 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
408 vlc-${VLC_QUICKVERSION}-win32-installer.exe
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; \
421 mkdir -p tmp/vlc/share
422 # Copy relevant files
424 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
425 README README.libdvdcss FAQ TODO tmp/vlc/
426 for file in default8x16.psf default8x9.psf ; \
427 do cp share/$$file tmp/vlc/share/ ; done
429 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
430 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
431 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
432 mv tmp/vlc-${VLC_QUICKVERSION}-beos.zip .
436 libdvdcss-snapshot: snapshot-common
437 # Remove vlc sources and icons, doc, debian directory...
438 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
439 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
440 rm -Rf tmp/vlc/debian
442 # Remove useless headers
443 rm -f tmp/vlc/include/*
444 for file in defs.h.in config.h.in common.h int_types.h ; \
445 do cp include/$$file tmp/vlc/include/ ; done
446 # Remove misc files (??? - maybe not really needed)
447 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
448 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
449 mv tmp/vlc/README.libdvdcss tmp/vlc/README
450 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
452 rm -f tmp/vlc/Makefile
453 sed -e 's#^install:#install-unused:#' \
454 -e 's#^uninstall:#uninstall-unused:#' \
455 -e 's#^clean:#clean-unused:#' \
456 -e 's#^all:.*#all: libdvdcss#' \
457 -e 's#^libdvdcss-install:#install:#' \
458 -e 's#^libdvdcss-uninstall:#uninstall:#' \
459 -e 's#^libdvdcss-clean:#clean:#' \
460 < Makefile > tmp/vlc/Makefile
462 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
463 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
464 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
465 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
470 dpkg-buildpackage -rfakeroot -us -uc
473 # Gtk/Gnome/* aliases and OS X application
475 gnome-vlc gvlc kvlc qvlc: vlc
476 rm -f $@ && ln -s vlc $@
479 vlc.app: Makefile.opts
480 ifneq (,$(findstring darwin,$(SYS)))
482 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
483 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
484 $(INSTALL) -d vlc.app/Contents/MacOS/share
485 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
486 $(INSTALL) vlc vlc.app/Contents/MacOS/
488 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
490 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
496 # Generic rules (see below)
499 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
501 $(CPP_DEP): %.dpp: FORCE
502 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
504 $(H_OBJ): Makefile.opts Makefile.dep Makefile
505 rm -f $@ && cp $@.in $@
507 for i in $(BUILTINS) ; do \
508 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
509 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
510 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
513 printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
514 for i in $(BUILTINS) ; do \
515 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
517 echo "} while( 0 );" >> $@ ;
521 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
522 $(C_OBJ): %.o: .dep/%.d
524 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
526 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
527 $(CPP_OBJ): %.o: .dep/%.dpp
528 $(CPP_OBJ): %.o: %.cpp
529 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
531 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
532 ifneq (,(findstring mingw32,$(SYS)))
533 $(RESOURCE_OBJ): %.o: %.rc
534 $(WINDRES) -i $< -o $@
538 # Main application target
540 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ)
541 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
543 xres -o $@ ./share/vlc_beos.rsrc
550 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
552 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
555 # Built-in modules target
557 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
558 $(BUILTIN_OBJ): FORCE
559 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
564 libdvdcss: Makefile.opts
565 @cd extras/libdvdcss && $(MAKE)
570 libdvdread: Makefile.opts
571 @cd extras/libdvdread && $(MAKE)