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 \
51 PLUGINS_TARGETS := ac3_adec/ac3_adec \
91 motion/motionaltivec \
110 INTERFACE := main interface intf_msg intf_playlist intf_channels
111 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist input_clock mpeg_system
112 VIDEO_OUTPUT := video_output video_text video_spu video_yuv
113 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
114 MISC := mtime tests modules netutils iso_lang
116 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
117 $(INPUT:%=src/input/%.o) \
118 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
119 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
120 $(MISC:%=src/misc/%.o)
125 ifeq ($(NEED_GETOPT),1)
126 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
130 CPP_OBJ := src/misc/beos_specific.o
133 ifneq (,$(findstring darwin,$(SYS)))
134 C_OBJ += src/misc/darwin_specific.o
137 ifneq (,$(findstring mingw32,$(SYS)))
138 C_OBJ += src/misc/win32_specific.o
139 RESOURCE_OBJ := share/vlc_win32_rc.o
142 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
147 H_OBJ := src/misc/modules_builtin.h
150 # Other lists of files
152 C_DEP := $(C_OBJ:%.o=.dep/%.d)
153 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
156 # Translate plugin names
159 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
162 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
168 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | cut -f2 -d=)
169 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | cut -f2 -d=)
172 # All symbols must be exported
175 ###############################################################################
177 ###############################################################################
182 all: Makefile.opts vlc ${ALIASES} vlc.app
185 @echo "**** No configuration found, running ./configure..."
187 $(MAKE) $(MAKECMDGOALS)
192 @echo CFLAGS: $(CFLAGS)
193 @echo DCFLAGS: $(DCFLAGS)
194 @echo LCFLAGS: $(LCFLAGS)
195 @echo PCFLAGS: $(PCFLAGS)
196 @echo PLCFLAGS: $(PLCFLAGS)
197 @echo C_OBJ: $(C_OBJ)
198 @echo CPP_OBJ: $(CPP_OBJ)
199 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
200 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
205 clean: libdvdcss-clean libdvdread-clean plugins-clean vlc-clean
206 rm -f src/*/*.o extras/*/*.o
207 rm -f lib/*.so* lib/*.a
208 rm -f plugins/*.so plugins/*.a
209 rm -rf extras/MacOSX/build
212 -cd extras/libdvdcss && $(MAKE) clean
215 -cd extras/libdvdread && $(MAKE) clean
218 for dir in $(PLUGINS_DIR) ; do \
219 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
220 rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
223 rm -f $(C_OBJ) $(CPP_OBJ)
224 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
228 rm -f **/*.o **/*~ *.log
230 rm -f include/defs.h include/config.h include/modules_builtin.h
231 rm -f src/misc/modules_builtin.h
232 rm -f config*status config*cache config*log
233 rm -f gmon.out core build-stamp
238 # Install/uninstall rules
240 install: libdvdcss-install vlc-install plugins-install
242 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall
245 mkdir -p $(DESTDIR)$(bindir)
246 $(INSTALL) vlc $(DESTDIR)$(bindir)
248 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
250 mkdir -p $(DESTDIR)$(datadir)/videolan
251 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
252 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
253 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
256 rm -f $(DESTDIR)$(bindir)/vlc
258 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
260 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
261 rm -f $(DESTDIR)$(datadir)/videolan/*.png
262 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
265 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
267 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
271 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
274 -cd extras/libdvdcss && $(MAKE) install
277 -cd extras/libdvdcss && $(MAKE) uninstall
280 # Package generation rules
283 # Check that tmp isn't in the way
284 @if test -e tmp; then \
285 echo "Error: please remove ./tmp, it is in the way"; false; \
287 echo "OK."; mkdir tmp; \
289 # Copy directory structure in tmp
290 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
291 do mkdir -p tmp/vlc/$$i ; \
294 find debian -mindepth 1 -maxdepth 1 -type d | \
295 while read i ; do rm -Rf tmp/vlc/$$i ; done
296 # Copy .c .h .in .cpp and .glade files
297 find include src plugins -type f -name '*.[chig]*' | while read i ; \
298 do cp $$i tmp/vlc/$$i ; done
299 # Copy plugin Makefiles
300 find plugins -type f -name Makefile | while read i ; \
301 do cp $$i tmp/vlc/$$i ; done
302 # Copy extra programs and documentation
303 cp -a extras/* tmp/vlc/extras
304 cp -a doc/* tmp/vlc/doc
305 find tmp/vlc/extras tmp/vlc/doc \
306 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
307 while read i ; do rm -Rf $$i ; done
309 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
310 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
311 configure configure.in install-sh install-win32 vlc.spec \
312 config.sub config.guess \
314 # Copy Debian control files
315 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
316 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
317 for file in control changelog rules ; do \
318 cp debian/$$file tmp/vlc/debian/ ; done
319 # Copy ipkg control files
320 for file in control rules ; do \
321 cp ipkg/$$file tmp/vlc/ipkg/ ; done
322 # Copy fonts and icons
323 for file in share/*png share/*xpm share/*psf ; do \
324 cp $$file tmp/vlc/share ; done
325 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
326 cp share/$$file tmp/vlc/share/ ; done
328 snapshot: snapshot-common
330 F=vlc-${VLC_QUICKVERSION}; \
331 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
332 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
333 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
337 snapshot-nocss: snapshot-common
339 rm -Rf tmp/vlc/extras/libdvdcss
340 rm -f tmp/vlc/*.libdvdcss
341 # Fix debian information
342 rm -f tmp/vlc/debian/libdvdcss*
343 rm -f tmp/vlc/debian/control
344 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
345 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
346 > tmp/vlc/debian/control
347 rm -f tmp/vlc/debian/rules
348 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
349 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
350 > tmp/vlc/debian/rules
351 chmod +x tmp/vlc/debian/rules
352 # Build css-disabled archives
353 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
354 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
355 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
356 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
361 # XXX: this rule is probably only useful to you if you have exactly
362 # the same setup as me. Contact sam@zoy.org if you need to use it.
364 # Check that tmp isn't in the way
365 @if test -e tmp; then \
366 echo "Error: please remove ./tmp, it is in the way"; false; \
368 echo "OK."; mkdir tmp; \
370 # Create installation script
371 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
372 # Copy relevant files
373 cp vlc.exe plugins/directx.so plugins/gtk.so plugins/sdl.so tmp/
374 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
375 README README.libdvdcss FAQ TODO tmp/
376 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
377 gnu-intl.dll SDL.dll README-SDL.txt ; \
378 do cp ../win32-libs/$$file tmp/ ; done
380 for file in default8x16.psf default8x9.psf ; \
381 do cp share/$$file tmp/share/ ; done
383 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
384 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
385 vlc-${VLC_QUICKVERSION}-win32-installer.exe
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; \
398 mkdir -p tmp/vlc/share
399 # Copy relevant files
401 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
402 README README.libdvdcss FAQ TODO tmp/vlc/
403 for file in default8x16.psf default8x9.psf ; \
404 do cp share/$$file tmp/vlc/share/ ; done
406 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
407 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
408 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
409 mv tmp/vlc-${VLC_QUICKVERSION}-beos.zip .
413 libdvdcss-snapshot: snapshot-common
414 # Remove vlc sources and icons, doc, debian directory...
415 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
416 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
417 rm -Rf tmp/vlc/debian
419 # Remove useless headers
420 rm -f tmp/vlc/include/*
421 for file in defs.h.in config.h.in common.h int_types.h ; \
422 do cp include/$$file tmp/vlc/include/ ; done
423 # Remove misc files (??? - maybe not really needed)
424 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
425 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
426 mv tmp/vlc/README.libdvdcss tmp/vlc/README
427 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
429 rm -f tmp/vlc/Makefile
430 sed -e 's#^install:#install-unused:#' \
431 -e 's#^uninstall:#uninstall-unused:#' \
432 -e 's#^clean:#clean-unused:#' \
433 -e 's#^all:.*#all: libdvdcss#' \
434 -e 's#^libdvdcss-install:#install:#' \
435 -e 's#^libdvdcss-uninstall:#uninstall:#' \
436 -e 's#^libdvdcss-clean:#clean:#' \
437 < Makefile > tmp/vlc/Makefile
439 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
440 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
441 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
442 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
447 dpkg-buildpackage -rfakeroot -us -uc
450 # Gtk/Gnome/* aliases and OS X application
452 gnome-vlc gvlc kvlc qvlc: vlc
453 rm -f $@ && ln -s vlc $@
456 vlc.app: Makefile.opts
457 ifneq (,$(findstring darwin,$(SYS)))
459 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
460 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
461 $(INSTALL) -d vlc.app/Contents/MacOS/share
462 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
463 $(INSTALL) vlc vlc.app/Contents/MacOS/
465 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
467 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
473 # Generic rules (see below)
476 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
478 $(CPP_DEP): %.dpp: FORCE
479 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
481 $(H_OBJ): Makefile.opts Makefile.dep Makefile
482 rm -f $@ && cp $@.in $@
484 for i in $(BUILTINS) ; do \
485 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
486 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
487 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
490 printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
491 for i in $(BUILTINS) ; do \
492 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
494 echo "} while( 0 );" >> $@ ;
498 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
499 $(C_OBJ): %.o: .dep/%.d
501 $(CC) $(CFLAGS) -c -o $@ $<
503 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
504 $(CPP_OBJ): %.o: .dep/%.dpp
505 $(CPP_OBJ): %.o: %.cpp
506 $(CC) $(CFLAGS) -c -o $@ $<
508 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
509 ifneq (,(findstring mingw32,$(SYS)))
510 $(RESOURCE_OBJ): %.o: %.rc
511 $(WINDRES) -i $< -o $@
515 # Main application target
517 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ) plugins
518 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
520 xres -o $@ ./share/vlc_beos.rsrc
527 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
529 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
532 # Built-in modules target
534 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
535 $(BUILTIN_OBJ): FORCE
536 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
541 libdvdcss: Makefile.opts
542 cd extras/libdvdcss && $(MAKE)
547 libdvdread: Makefile.opts
548 cd extras/libdvdread && $(MAKE)