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 \
50 PLUGINS_TARGETS := ac3_adec/ac3_adec \
87 motion/motionaltivec \
106 INTERFACE := main interface intf_msg intf_playlist intf_channels
107 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist input_clock mpeg_system
108 VIDEO_OUTPUT := video_output video_text video_spu video_yuv
109 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
110 MISC := mtime tests modules netutils iso_lang
112 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
113 $(INPUT:%=src/input/%.o) \
114 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
115 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
116 $(MISC:%=src/misc/%.o)
121 ifeq ($(NEED_GETOPT),1)
122 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
126 CPP_OBJ := src/misc/beos_specific.o
129 ifneq (,$(findstring darwin,$(SYS)))
130 C_OBJ += src/misc/darwin_specific.o
133 ifneq (,$(findstring mingw32,$(SYS)))
134 C_OBJ += src/misc/win32_specific.o
135 RESOURCE_OBJ := share/vlc_win32_rc.o
138 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
143 H_OBJ := src/misc/modules_builtin.h
146 # Other lists of files
148 C_DEP := $(C_OBJ:%.o=.dep/%.d)
149 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
152 # Translate plugin names
155 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
158 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
164 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=[0-9]' configure.in | head -1 | cut -f2 -d=)
165 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=[0-9]' configure.in | head -1 | cut -f2 -d=)
168 # All symbols must be exported
171 ###############################################################################
173 ###############################################################################
178 all: Makefile.opts vlc ${ALIASES} vlc.app
181 @echo "**** No configuration found, running ./configure..."
183 $(MAKE) $(MAKECMDGOALS)
188 @echo CFLAGS: $(CFLAGS)
189 @echo DCFLAGS: $(DCFLAGS)
190 @echo LCFLAGS: $(LCFLAGS)
191 @echo PCFLAGS: $(PCFLAGS)
192 @echo PLCFLAGS: $(PLCFLAGS)
193 @echo C_OBJ: $(C_OBJ)
194 @echo CPP_OBJ: $(CPP_OBJ)
195 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
196 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
201 clean: libdvdcss-clean libdvdread-clean plugins-clean vlc-clean
202 rm -f src/*/*.o extras/*/*.o
203 rm -f lib/*.so* lib/*.a
204 rm -f plugins/*.so plugins/*.a
205 rm -rf extras/MacOSX/build
208 -cd extras/libdvdcss && $(MAKE) clean
211 -cd extras/libdvdread && $(MAKE) clean
214 for dir in $(PLUGINS_DIR) ; do \
215 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
216 rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
219 rm -f $(C_OBJ) $(CPP_OBJ)
220 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
224 rm -f **/*.o **/*~ *.log
226 rm -f include/defs.h include/config.h include/modules_builtin.h
227 rm -f src/misc/modules_builtin.h
228 rm -f config*status config*cache config*log
229 rm -f gmon.out core build-stamp
234 # Install/uninstall rules
236 install: libdvdcss-install vlc-install plugins-install
238 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall
241 mkdir -p $(DESTDIR)$(bindir)
242 $(INSTALL) vlc $(DESTDIR)$(bindir)
244 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
246 mkdir -p $(DESTDIR)$(datadir)/videolan
247 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
248 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
249 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
252 rm -f $(DESTDIR)$(bindir)/vlc
254 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
256 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
257 rm -f $(DESTDIR)$(datadir)/videolan/*.png
258 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
261 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
263 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
267 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
270 -cd extras/libdvdcss && $(MAKE) install
273 -cd extras/libdvdcss && $(MAKE) uninstall
276 # Package generation rules
279 # Check that tmp isn't in the way
280 @if test -e tmp; then \
281 echo "Error: please remove ./tmp, it is in the way"; false; \
283 echo "OK."; mkdir tmp; \
285 # Copy directory structure in tmp
286 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
287 do mkdir -p tmp/vlc/$$i ; \
290 find debian -mindepth 1 -maxdepth 1 -type d | \
291 while read i ; do rm -Rf tmp/vlc/$$i ; done
292 # Copy .c .h .in .cpp and .glade files
293 find include src plugins -type f -name '*.[chig]*' | while read i ; \
294 do cp $$i tmp/vlc/$$i ; done
295 # Copy plugin Makefiles
296 find plugins -type f -name Makefile | while read i ; \
297 do cp $$i tmp/vlc/$$i ; done
298 # Copy extra programs and documentation
299 cp -a extras/* tmp/vlc/extras
300 cp -a doc/* tmp/vlc/doc
301 find tmp/vlc/extras tmp/vlc/doc \
302 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
303 while read i ; do rm -Rf $$i ; done
305 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
306 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
307 configure configure.in install-sh install-win32 vlc.spec \
308 config.sub config.guess \
310 # Copy Debian control files
311 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
312 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
313 for file in control changelog rules ; do \
314 cp debian/$$file tmp/vlc/debian/ ; done
315 # Copy ipkg control files
316 for file in control rules ; do \
317 cp ipkg/$$file tmp/vlc/ipkg/ ; done
318 # Copy fonts and icons
319 for file in share/*png share/*xpm share/*psf ; do \
320 cp $$file tmp/vlc/share ; done
321 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
322 cp share/$$file tmp/vlc/share/ ; done
324 snapshot: snapshot-common
326 F=vlc-${VLC_QUICKVERSION}; \
327 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
328 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
329 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
333 snapshot-nocss: snapshot-common
335 rm -Rf tmp/vlc/extras/libdvdcss
336 rm -f tmp/vlc/*.libdvdcss
337 # Fix debian information
338 rm -f tmp/vlc/debian/libdvdcss*
339 rm -f tmp/vlc/debian/control
340 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
341 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
342 > tmp/vlc/debian/control
343 rm -f tmp/vlc/debian/rules
344 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
345 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
346 > tmp/vlc/debian/rules
347 chmod +x tmp/vlc/debian/rules
348 # Build css-disabled archives
349 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
350 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
351 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
352 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
357 # XXX: this rule is probably only useful to you if you have exactly
358 # the same setup as me. Contact sam@zoy.org if you need to use it.
360 # Check that tmp isn't in the way
361 @if test -e tmp; then \
362 echo "Error: please remove ./tmp, it is in the way"; false; \
364 echo "OK."; mkdir tmp; \
366 # Create installation script
367 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
368 # Copy relevant files
369 cp vlc.exe plugins/directx.so plugins/gtk.so plugins/sdl.so tmp/
370 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
371 README README.libdvdcss FAQ TODO tmp/
372 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
373 gnu-intl.dll SDL.dll README-SDL.txt ; \
374 do cp ../win32-libs/$$file tmp/ ; done
376 for file in default8x16.psf default8x9.psf ; \
377 do cp share/$$file tmp/share/ ; done
379 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
380 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
381 vlc-${VLC_QUICKVERSION}-win32-installer.exe
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; \
394 mkdir -p tmp/vlc/share
395 # Copy relevant files
397 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
398 README README.libdvdcss FAQ TODO tmp/vlc/
399 for file in default8x16.psf default8x9.psf ; \
400 do cp share/$$file tmp/vlc/share/ ; done
402 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
403 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
404 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
405 mv tmp/vlc-${VLC_QUICKVERSION}-beos.zip .
409 libdvdcss-snapshot: snapshot-common
410 # Remove vlc sources and icons, doc, debian directory...
411 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
412 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
413 rm -Rf tmp/vlc/debian
415 # Remove useless headers
416 rm -f tmp/vlc/include/*
417 for file in defs.h.in config.h.in common.h int_types.h ; \
418 do cp include/$$file tmp/vlc/include/ ; done
419 # Remove misc files (??? - maybe not really needed)
420 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
421 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
422 mv tmp/vlc/README.libdvdcss tmp/vlc/README
423 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
425 rm -f tmp/vlc/Makefile
426 sed -e 's#^install:#install-unused:#' \
427 -e 's#^uninstall:#uninstall-unused:#' \
428 -e 's#^clean:#clean-unused:#' \
429 -e 's#^all:.*#all: libdvdcss#' \
430 -e 's#^libdvdcss-install:#install:#' \
431 -e 's#^libdvdcss-uninstall:#uninstall:#' \
432 -e 's#^libdvdcss-clean:#clean:#' \
433 < Makefile > tmp/vlc/Makefile
435 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
436 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
437 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
438 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
443 dpkg-buildpackage -rfakeroot -us -uc
446 # Gtk/Gnome/* aliases and OS X application
448 gnome-vlc gvlc kvlc qvlc: vlc
449 rm -f $@ && ln -s vlc $@
452 vlc.app: Makefile.opts
453 ifneq (,$(findstring darwin,$(SYS)))
455 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
456 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
457 $(INSTALL) -d vlc vlc.app/Contents/MacOS/share
458 $(INSTALL) -d vlc vlc.app/Contents/MacOS/plugins
459 $(INSTALL) vlc vlc.app/Contents/MacOS/
461 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
463 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
469 # Generic rules (see below)
472 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
474 $(CPP_DEP): %.dpp: FORCE
475 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
477 $(H_OBJ): Makefile.opts Makefile.dep Makefile
478 rm -f $@ && cp $@.in $@
480 for i in $(BUILTINS) ; do \
481 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
482 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
483 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
486 printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
487 for i in $(BUILTINS) ; do \
488 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
490 echo "} while( 0 );" >> $@ ;
494 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
495 $(C_OBJ): %.o: .dep/%.d
497 $(CC) $(CFLAGS) -c -o $@ $<
499 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
500 $(CPP_OBJ): %.o: .dep/%.dpp
501 $(CPP_OBJ): %.o: %.cpp
502 $(CC) $(CFLAGS) -c -o $@ $<
504 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
505 ifneq (,(findstring mingw32,$(SYS)))
506 $(RESOURCE_OBJ): %.o: %.rc
507 $(WINDRES) -i $< -o $@
511 # Main application target
513 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ) plugins
514 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
516 xres -o $@ ./share/vlc_beos.rsrc
523 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
525 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
528 # Built-in modules target
530 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
531 $(BUILTIN_OBJ): FORCE
532 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
537 libdvdcss: Makefile.opts
538 cd extras/libdvdcss && $(MAKE)
543 libdvdread: Makefile.opts
544 cd extras/libdvdread && $(MAKE)