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 \
52 PLUGINS_TARGETS := ac3_adec/ac3_adec \
94 motion/motionaltivec \
114 INTERFACE := main interface intf_msg intf_playlist
115 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist input_clock mpeg_system
116 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
117 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
118 MISC := mtime tests modules netutils iso_lang
120 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
121 $(INPUT:%=src/input/%.o) \
122 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
123 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
124 $(MISC:%=src/misc/%.o)
129 ifeq ($(NEED_GETOPT),1)
130 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
134 CPP_OBJ := src/misc/beos_specific.o
137 ifneq (,$(findstring darwin,$(SYS)))
138 C_OBJ += src/misc/darwin_specific.o
141 ifneq (,$(findstring mingw32,$(SYS)))
142 C_OBJ += src/misc/win32_specific.o
143 RESOURCE_OBJ := share/vlc_win32_rc.o
146 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
151 H_OBJ := src/misc/modules_builtin.h
154 # Other lists of files
156 C_DEP := $(C_OBJ:%.o=.dep/%.d)
157 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
160 # Translate plugin names
163 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
166 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
172 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
173 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
176 # All symbols must be exported
179 ###############################################################################
181 ###############################################################################
186 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
189 @echo "**** No configuration found, running ./configure..."
191 $(MAKE) $(MAKECMDGOALS)
196 @echo CFLAGS: $(CFLAGS)
197 @echo DCFLAGS: $(DCFLAGS)
198 @echo LCFLAGS: $(LCFLAGS)
199 @echo PCFLAGS: $(PCFLAGS)
200 @echo PLCFLAGS: $(PLCFLAGS)
201 @echo C_OBJ: $(C_OBJ)
202 @echo CPP_OBJ: $(CPP_OBJ)
203 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
204 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
209 clean: libdvdcss-clean libdvdread-clean plugins-clean po-clean vlc-clean
210 rm -f src/*/*.o extras/*/*.o
211 rm -f lib/*.so* lib/*.a
212 rm -f plugins/*.so plugins/*.a
213 rm -rf extras/MacOSX/build
216 -cd extras/libdvdcss && $(MAKE) clean
219 -cd po && $(MAKE) clean
222 -cd extras/libdvdread && $(MAKE) clean
225 for dir in $(PLUGINS_DIR) ; do \
226 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
227 rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
230 rm -f $(C_OBJ) $(CPP_OBJ)
231 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
235 -cd po && $(MAKE) distclean
236 rm -f **/*.o **/*~ *.log
238 rm -f include/defs.h include/config.h include/modules_builtin.h
239 rm -f src/misc/modules_builtin.h
240 rm -f config*status config*cache config*log
241 rm -f gmon.out core build-stamp
246 # Install/uninstall rules
248 install: libdvdcss-install vlc-install plugins-install po-install
250 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall po-uninstall
253 mkdir -p $(DESTDIR)$(bindir)
254 $(INSTALL) vlc $(DESTDIR)$(bindir)
256 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
258 mkdir -p $(DESTDIR)$(datadir)/videolan
259 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
260 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
261 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
264 rm -f $(DESTDIR)$(bindir)/vlc
266 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
268 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
269 rm -f $(DESTDIR)$(datadir)/videolan/*.png
270 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
273 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
275 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
279 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
282 -cd extras/libdvdcss && $(MAKE) install
285 -cd extras/libdvdcss && $(MAKE) uninstall
288 -cd po && $(MAKE) install
291 -cd po && $(MAKE) uninstall
294 # Package generation rules
297 # Check that tmp isn't in the way
298 @if test -e tmp; then \
299 echo "Error: please remove ./tmp, it is in the way"; false; \
301 echo "OK."; mkdir tmp; \
303 # Copy directory structure in tmp
304 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
305 do mkdir -p tmp/vlc/$$i ; \
308 find debian -mindepth 1 -maxdepth 1 -type d | \
309 while read i ; do rm -Rf tmp/vlc/$$i ; done
310 # Copy .c .h .in .cpp and .glade files
311 find include src plugins -type f -name '*.[chig]*' | while read i ; \
312 do cp $$i tmp/vlc/$$i ; done
313 # Copy plugin Makefiles
314 find plugins -type f -name Makefile | while read i ; \
315 do cp $$i tmp/vlc/$$i ; done
316 # Copy extra programs and documentation
317 cp -a extras/* tmp/vlc/extras
318 cp -a doc/* tmp/vlc/doc
319 find tmp/vlc/extras tmp/vlc/doc \
320 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
321 while read i ; do rm -Rf $$i ; done
324 cp po/*.po tmp/vlc/po
325 for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
327 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
328 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
329 configure configure.in install-sh install-win32 vlc.spec \
330 config.sub config.guess acconfig.h aclocal.m4 mkinstalldirs \
332 # Copy Debian control files
333 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
334 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
335 for file in control changelog rules ; do \
336 cp debian/$$file tmp/vlc/debian/ ; done
337 # Copy ipkg control files
338 for file in control rules ; do \
339 cp ipkg/$$file tmp/vlc/ipkg/ ; done
340 # Copy fonts and icons
341 for file in share/*png share/*xpm share/*psf ; do \
342 cp $$file tmp/vlc/share ; done
343 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
344 cp share/$$file tmp/vlc/share/ ; done
346 snapshot: snapshot-common
348 F=vlc-${VLC_QUICKVERSION}; \
349 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
350 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
351 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
355 snapshot-nocss: snapshot-common
357 rm -Rf tmp/vlc/extras/libdvdcss
358 rm -f tmp/vlc/*.libdvdcss
359 # Fix debian information
360 rm -f tmp/vlc/debian/libdvdcss*
361 rm -f tmp/vlc/debian/control
362 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
363 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
364 > tmp/vlc/debian/control
365 rm -f tmp/vlc/debian/rules
366 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
367 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
368 > tmp/vlc/debian/rules
369 chmod +x tmp/vlc/debian/rules
370 # Build css-disabled archives
371 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
372 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
373 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
374 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
379 # XXX: this rule is probably only useful to you if you have exactly
380 # the same setup as me. Contact sam@zoy.org if you need to use it.
382 # Check that tmp isn't in the way
383 @if test -e tmp; then \
384 echo "Error: please remove ./tmp, it is in the way"; false; \
386 echo "OK."; mkdir tmp; \
388 # Create installation script
389 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
390 # Copy relevant files
391 cp vlc.exe plugins/directx.so plugins/gtk.so plugins/sdl.so tmp/
392 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
393 README README.libdvdcss FAQ TODO tmp/
394 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
395 gnu-intl.dll SDL.dll README-SDL.txt ; \
396 do cp ../win32-libs/$$file tmp/ ; done
398 for file in default8x16.psf default8x9.psf ; \
399 do cp share/$$file tmp/share/ ; done
401 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
402 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
403 vlc-${VLC_QUICKVERSION}-win32-installer.exe
408 # Check that tmp isn't in the way
409 @if test -e tmp; then \
410 echo "Error: please remove ./tmp, it is in the way"; false; \
412 echo "OK."; mkdir tmp; \
416 mkdir -p tmp/vlc/share
417 # Copy relevant files
419 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
420 README README.libdvdcss FAQ TODO tmp/vlc/
421 for file in default8x16.psf default8x9.psf ; \
422 do cp share/$$file tmp/vlc/share/ ; done
424 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
425 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
426 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
427 mv tmp/vlc-${VLC_QUICKVERSION}-beos.zip .
431 libdvdcss-snapshot: snapshot-common
432 # Remove vlc sources and icons, doc, debian directory...
433 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
434 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
435 rm -Rf tmp/vlc/debian
437 # Remove useless headers
438 rm -f tmp/vlc/include/*
439 for file in defs.h.in config.h.in common.h int_types.h ; \
440 do cp include/$$file tmp/vlc/include/ ; done
441 # Remove misc files (??? - maybe not really needed)
442 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
443 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
444 mv tmp/vlc/README.libdvdcss tmp/vlc/README
445 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
447 rm -f tmp/vlc/Makefile
448 sed -e 's#^install:#install-unused:#' \
449 -e 's#^uninstall:#uninstall-unused:#' \
450 -e 's#^clean:#clean-unused:#' \
451 -e 's#^all:.*#all: libdvdcss#' \
452 -e 's#^libdvdcss-install:#install:#' \
453 -e 's#^libdvdcss-uninstall:#uninstall:#' \
454 -e 's#^libdvdcss-clean:#clean:#' \
455 < Makefile > tmp/vlc/Makefile
457 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
458 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
459 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
460 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
465 dpkg-buildpackage -rfakeroot -us -uc
468 # Gtk/Gnome/* aliases and OS X application
470 gnome-vlc gvlc kvlc qvlc: vlc
471 rm -f $@ && ln -s vlc $@
474 vlc.app: Makefile.opts
475 ifneq (,$(findstring darwin,$(SYS)))
477 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
478 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
479 $(INSTALL) -d vlc.app/Contents/MacOS/share
480 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
481 $(INSTALL) vlc vlc.app/Contents/MacOS/
483 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
485 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
491 # Generic rules (see below)
494 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
496 $(CPP_DEP): %.dpp: FORCE
497 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
499 $(H_OBJ): Makefile.opts Makefile.dep Makefile
500 rm -f $@ && cp $@.in $@
502 for i in $(BUILTINS) ; do \
503 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
504 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
505 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
508 printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
509 for i in $(BUILTINS) ; do \
510 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
512 echo "} while( 0 );" >> $@ ;
516 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
517 $(C_OBJ): %.o: .dep/%.d
519 $(CC) $(CFLAGS) -c -o $@ $<
521 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
522 $(CPP_OBJ): %.o: .dep/%.dpp
523 $(CPP_OBJ): %.o: %.cpp
524 $(CC) $(CFLAGS) -c -o $@ $<
526 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
527 ifneq (,(findstring mingw32,$(SYS)))
528 $(RESOURCE_OBJ): %.o: %.rc
529 $(WINDRES) -i $< -o $@
533 # Main application target
535 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ)
536 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
538 xres -o $@ ./share/vlc_beos.rsrc
545 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
547 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
550 # Built-in modules target
552 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
553 $(BUILTIN_OBJ): FORCE
554 @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
559 libdvdcss: Makefile.opts
560 @cd extras/libdvdcss && $(MAKE)
565 libdvdread: Makefile.opts
566 @cd extras/libdvdread && $(MAKE)