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 \
49 PLUGINS_TARGETS := ac3_adec/ac3_adec \
85 motion/motionaltivec \
104 INTERFACE := main interface intf_msg intf_playlist intf_channels
105 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist input_clock mpeg_system
106 VIDEO_OUTPUT := video_output video_text video_spu video_yuv
107 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
108 MISC := mtime tests modules netutils iso_lang
110 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
111 $(INPUT:%=src/input/%.o) \
112 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
113 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
114 $(MISC:%=src/misc/%.o)
119 ifeq ($(NEED_GETOPT),1)
120 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
124 CPP_OBJ := src/misc/beos_specific.o
127 ifneq (,$(findstring darwin,$(SYS)))
128 C_OBJ += src/misc/darwin_specific.o
131 ifneq (,$(findstring mingw32,$(SYS)))
132 C_OBJ += src/misc/win32_specific.o
133 RESOURCE_OBJ := share/vlc_win32_rc.o
136 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
141 H_OBJ := src/misc/modules_builtin.h
144 # Other lists of files
146 C_DEP := $(C_OBJ:%.o=.dep/%.d)
147 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
150 # Translate plugin names
153 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
156 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
162 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=[0-9]' configure.in | head -1 | cut -f2 -d=)
163 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=[0-9]' configure.in | head -1 | cut -f2 -d=)
166 # All symbols must be exported
169 ###############################################################################
171 ###############################################################################
176 all: Makefile.opts vlc ${ALIASES} vlc.app
179 @echo "**** No configuration found, running ./configure..."
181 $(MAKE) $(MAKECMDGOALS)
186 @echo CFLAGS: $(CFLAGS)
187 @echo DCFLAGS: $(DCFLAGS)
188 @echo LCFLAGS: $(LCFLAGS)
189 @echo PCFLAGS: $(PCFLAGS)
190 @echo PLCFLAGS: $(PLCFLAGS)
191 @echo C_OBJ: $(C_OBJ)
192 @echo CPP_OBJ: $(CPP_OBJ)
193 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
194 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
199 clean: libdvdcss-clean plugins-clean vlc-clean
200 rm -f src/*/*.o extras/*/*.o
201 rm -f lib/*.so* lib/*.a
202 rm -f plugins/*.so plugins/*.a
203 rm -rf extras/MacOSX/build
206 -cd extras/libdvdcss && $(MAKE) clean
209 for dir in $(PLUGINS_DIR) ; do \
210 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
211 rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
214 rm -f $(C_OBJ) $(CPP_OBJ)
215 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
219 rm -f **/*.o **/*~ *.log
221 rm -f include/defs.h include/config.h include/modules_builtin.h
222 rm -f src/misc/modules_builtin.h
223 rm -f config*status config*cache config*log
224 rm -f gmon.out core build-stamp
229 # Install/uninstall rules
231 install: libdvdcss-install vlc-install plugins-install
233 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall
236 mkdir -p $(DESTDIR)$(bindir)
237 $(INSTALL) vlc $(DESTDIR)$(bindir)
239 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
241 mkdir -p $(DESTDIR)$(datadir)/videolan
242 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
243 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
244 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
247 rm -f $(DESTDIR)$(bindir)/vlc
249 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
251 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
252 rm -f $(DESTDIR)$(datadir)/videolan/*.png
253 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
256 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
258 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
262 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
265 -cd extras/libdvdcss && $(MAKE) install
268 -cd extras/libdvdcss && $(MAKE) uninstall
271 # Package generation rules
274 # Check that tmp isn't in the way
275 @if test -e tmp; then \
276 echo "Error: please remove ./tmp, it is in the way"; false; \
278 echo "OK."; mkdir tmp; \
280 # Copy directory structure in tmp
281 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
282 do mkdir -p tmp/vlc/$$i ; \
285 find debian -mindepth 1 -maxdepth 1 -type d | \
286 while read i ; do rm -Rf tmp/vlc/$$i ; done
287 # Copy .c .h .in .cpp and .glade files
288 find include src plugins -type f -name '*.[chig]*' | while read i ; \
289 do cp $$i tmp/vlc/$$i ; done
290 # Copy plugin Makefiles
291 find plugins -type f -name Makefile | while read i ; \
292 do cp $$i tmp/vlc/$$i ; done
293 # Copy extra programs and documentation
294 cp -a extras/* tmp/vlc/extras
295 cp -a doc/* tmp/vlc/doc
296 find tmp/vlc/extras tmp/vlc/doc \
297 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
298 while read i ; do rm -Rf $$i ; done
300 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
301 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
302 configure configure.in install-sh install-win32 vlc.spec \
303 config.sub config.guess \
305 # Copy Debian control files
306 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
307 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
308 for file in control changelog rules ; do \
309 cp debian/$$file tmp/vlc/debian/ ; done
310 # Copy ipkg control files
311 for file in control rules ; do \
312 cp ipkg/$$file tmp/vlc/ipkg/ ; done
313 # Copy fonts and icons
314 for file in share/*png share/*xpm share/*psf ; do \
315 cp $$file tmp/vlc/share ; done
316 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
317 cp share/$$file tmp/vlc/share/ ; done
319 snapshot: snapshot-common
321 F=vlc-${VLC_QUICKVERSION}; \
322 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
323 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
324 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
328 snapshot-nocss: snapshot-common
330 rm -Rf tmp/vlc/extras/libdvdcss
331 rm -f tmp/vlc/*.libdvdcss
332 # Fix debian information
333 rm -f tmp/vlc/debian/libdvdcss*
334 rm -f tmp/vlc/debian/control
335 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
336 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
337 > tmp/vlc/debian/control
338 rm -f tmp/vlc/debian/rules
339 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
340 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
341 > tmp/vlc/debian/rules
342 chmod +x tmp/vlc/debian/rules
343 # Build css-disabled archives
344 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
345 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
346 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
347 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
352 # XXX: this rule is probably only useful to you if you have exactly
353 # the same setup as me. Contact sam@zoy.org if you need to use it.
355 # Check that tmp isn't in the way
356 @if test -e tmp; then \
357 echo "Error: please remove ./tmp, it is in the way"; false; \
359 echo "OK."; mkdir tmp; \
361 # Create installation script
362 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
363 # Copy relevant files
364 cp vlc.exe plugins/directx.so plugins/gtk.so plugins/sdl.so tmp/
365 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
366 README README.libdvdcss FAQ TODO tmp/
367 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
368 gnu-intl.dll SDL.dll README-SDL.txt ; \
369 do cp ../win32-libs/$$file tmp/ ; done
371 for file in default8x16.psf default8x9.psf ; \
372 do cp share/$$file tmp/share/ ; done
374 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
375 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
376 vlc-${VLC_QUICKVERSION}-win32-installer.exe
381 # Check that tmp isn't in the way
382 @if test -e tmp; then \
383 echo "Error: please remove ./tmp, it is in the way"; false; \
385 echo "OK."; mkdir tmp; \
389 mkdir -p tmp/vlc/share
390 # Copy relevant files
392 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
393 README README.libdvdcss FAQ TODO tmp/vlc/
394 for file in default8x16.psf default8x9.psf ; \
395 do cp share/$$file tmp/vlc/share/ ; done
397 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
398 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
399 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
400 mv tmp/vlc-${VLC_QUICKVERSION}-beos.zip .
404 libdvdcss-snapshot: snapshot-common
405 # Remove vlc sources and icons, doc, debian directory...
406 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
407 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
408 rm -Rf tmp/vlc/debian
410 # Remove useless headers
411 rm -f tmp/vlc/include/*
412 for file in defs.h.in config.h.in common.h int_types.h ; \
413 do cp include/$$file tmp/vlc/include/ ; done
414 # Remove misc files (??? - maybe not really needed)
415 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
416 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
417 mv tmp/vlc/README.libdvdcss tmp/vlc/README
418 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
420 rm -f tmp/vlc/Makefile
421 sed -e 's#^install:#install-unused:#' \
422 -e 's#^uninstall:#uninstall-unused:#' \
423 -e 's#^clean:#clean-unused:#' \
424 -e 's#^all:.*#all: libdvdcss#' \
425 -e 's#^libdvdcss-install:#install:#' \
426 -e 's#^libdvdcss-uninstall:#uninstall:#' \
427 -e 's#^libdvdcss-clean:#clean:#' \
428 < Makefile > tmp/vlc/Makefile
430 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
431 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
432 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
433 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
438 dpkg-buildpackage -rfakeroot -us -uc
441 # Gtk/Gnome/* aliases and OS X application
443 gnome-vlc gvlc kvlc qvlc: vlc
444 rm -f $@ && ln -s vlc $@
447 vlc.app: Makefile.opts
448 ifneq (,$(findstring darwin,$(SYS)))
450 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
451 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
452 $(INSTALL) -d vlc vlc.app/Contents/MacOS/share
453 $(INSTALL) -d vlc vlc.app/Contents/MacOS/plugins
454 $(INSTALL) vlc vlc.app/Contents/MacOS/
456 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
458 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
464 # Generic rules (see below)
467 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
469 $(CPP_DEP): %.dpp: FORCE
470 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
472 $(H_OBJ): Makefile.opts Makefile.dep Makefile
473 rm -f $@ && cp $@.in $@
475 for i in $(BUILTINS) ; do \
476 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
477 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
478 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
481 printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
482 for i in $(BUILTINS) ; do \
483 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
485 echo "} while( 0 );" >> $@ ;
489 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
490 $(C_OBJ): %.o: .dep/%.d
492 $(CC) $(CFLAGS) -c -o $@ $<
494 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
495 $(CPP_OBJ): %.o: .dep/%.dpp
496 $(CPP_OBJ): %.o: %.cpp
497 $(CC) $(CFLAGS) -c -o $@ $<
499 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
500 ifneq (,(findstring mingw32,$(SYS)))
501 $(RESOURCE_OBJ): %.o: %.rc
502 $(WINDRES) -i $< -o $@
506 # Main application target
508 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ) plugins
509 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
511 xres -o $@ ./share/vlc_beos.rsrc
518 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
520 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
523 # Built-in modules target
525 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
526 $(BUILTIN_OBJ): FORCE
527 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
532 libdvdcss: Makefile.opts
533 cd extras/libdvdcss && $(MAKE)