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 \
93 motion/motionaltivec \
112 INTERFACE := main interface intf_msg intf_playlist intf_channels
113 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
114 VIDEO_OUTPUT := video_output video_text video_spu video_yuv
115 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
116 MISC := mtime tests modules netutils iso_lang
118 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
119 $(INPUT:%=src/input/%.o) \
120 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
121 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
122 $(MISC:%=src/misc/%.o)
127 ifeq ($(NEED_GETOPT),1)
128 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
132 CPP_OBJ := src/misc/beos_specific.o
135 ifneq (,$(findstring darwin,$(SYS)))
136 C_OBJ += src/misc/darwin_specific.o
139 ifneq (,$(findstring mingw32,$(SYS)))
140 C_OBJ += src/misc/win32_specific.o
141 RESOURCE_OBJ := share/vlc_win32_rc.o
144 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
149 H_OBJ := src/misc/modules_builtin.h
152 # Other lists of files
154 C_DEP := $(C_OBJ:%.o=.dep/%.d)
155 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
158 # Translate plugin names
161 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
164 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
170 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
171 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
174 # All symbols must be exported
177 ###############################################################################
179 ###############################################################################
184 all: Makefile.opts vlc ${ALIASES} vlc.app
187 @echo "**** No configuration found, running ./configure..."
189 $(MAKE) $(MAKECMDGOALS)
194 @echo CFLAGS: $(CFLAGS)
195 @echo DCFLAGS: $(DCFLAGS)
196 @echo LCFLAGS: $(LCFLAGS)
197 @echo PCFLAGS: $(PCFLAGS)
198 @echo PLCFLAGS: $(PLCFLAGS)
199 @echo C_OBJ: $(C_OBJ)
200 @echo CPP_OBJ: $(CPP_OBJ)
201 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
202 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
207 clean: libdvdcss-clean libdvdread-clean plugins-clean vlc-clean
208 rm -f src/*/*.o extras/*/*.o
209 rm -f lib/*.so* lib/*.a
210 rm -f plugins/*.so plugins/*.a
211 rm -rf extras/MacOSX/build
214 -cd extras/libdvdcss && $(MAKE) clean
217 -cd extras/libdvdread && $(MAKE) clean
220 for dir in $(PLUGINS_DIR) ; do \
221 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
222 rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
225 rm -f $(C_OBJ) $(CPP_OBJ)
226 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
230 rm -f **/*.o **/*~ *.log
232 rm -f include/defs.h include/config.h include/modules_builtin.h
233 rm -f src/misc/modules_builtin.h
234 rm -f config*status config*cache config*log
235 rm -f gmon.out core build-stamp
240 # Install/uninstall rules
242 install: libdvdcss-install vlc-install plugins-install
244 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall
247 mkdir -p $(DESTDIR)$(bindir)
248 $(INSTALL) vlc $(DESTDIR)$(bindir)
250 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
252 mkdir -p $(DESTDIR)$(datadir)/videolan
253 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
254 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
255 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
258 rm -f $(DESTDIR)$(bindir)/vlc
260 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
262 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
263 rm -f $(DESTDIR)$(datadir)/videolan/*.png
264 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
267 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
269 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
273 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
276 -cd extras/libdvdcss && $(MAKE) install
279 -cd extras/libdvdcss && $(MAKE) uninstall
282 # Package generation rules
285 # Check that tmp isn't in the way
286 @if test -e tmp; then \
287 echo "Error: please remove ./tmp, it is in the way"; false; \
289 echo "OK."; mkdir tmp; \
291 # Copy directory structure in tmp
292 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
293 do mkdir -p tmp/vlc/$$i ; \
296 find debian -mindepth 1 -maxdepth 1 -type d | \
297 while read i ; do rm -Rf tmp/vlc/$$i ; done
298 # Copy .c .h .in .cpp and .glade files
299 find include src plugins -type f -name '*.[chig]*' | while read i ; \
300 do cp $$i tmp/vlc/$$i ; done
301 # Copy plugin Makefiles
302 find plugins -type f -name Makefile | while read i ; \
303 do cp $$i tmp/vlc/$$i ; done
304 # Copy extra programs and documentation
305 cp -a extras/* tmp/vlc/extras
306 cp -a doc/* tmp/vlc/doc
307 find tmp/vlc/extras tmp/vlc/doc \
308 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
309 while read i ; do rm -Rf $$i ; done
311 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
312 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
313 configure configure.in install-sh install-win32 vlc.spec \
314 config.sub config.guess \
316 # Copy Debian control files
317 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
318 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
319 for file in control changelog rules ; do \
320 cp debian/$$file tmp/vlc/debian/ ; done
321 # Copy ipkg control files
322 for file in control rules ; do \
323 cp ipkg/$$file tmp/vlc/ipkg/ ; done
324 # Copy fonts and icons
325 for file in share/*png share/*xpm share/*psf ; do \
326 cp $$file tmp/vlc/share ; done
327 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
328 cp share/$$file tmp/vlc/share/ ; done
330 snapshot: snapshot-common
332 F=vlc-${VLC_QUICKVERSION}; \
333 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
334 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
335 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
339 snapshot-nocss: snapshot-common
341 rm -Rf tmp/vlc/extras/libdvdcss
342 rm -f tmp/vlc/*.libdvdcss
343 # Fix debian information
344 rm -f tmp/vlc/debian/libdvdcss*
345 rm -f tmp/vlc/debian/control
346 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
347 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
348 > tmp/vlc/debian/control
349 rm -f tmp/vlc/debian/rules
350 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
351 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
352 > tmp/vlc/debian/rules
353 chmod +x tmp/vlc/debian/rules
354 # Build css-disabled archives
355 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
356 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
357 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
358 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
363 # XXX: this rule is probably only useful to you if you have exactly
364 # the same setup as me. Contact sam@zoy.org if you need to use it.
366 # Check that tmp isn't in the way
367 @if test -e tmp; then \
368 echo "Error: please remove ./tmp, it is in the way"; false; \
370 echo "OK."; mkdir tmp; \
372 # Create installation script
373 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
374 # Copy relevant files
375 cp vlc.exe $(PLUGINS:%=plugins/%.so) tmp/
376 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
377 README README.libdvdcss FAQ TODO tmp/
378 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
379 gnu-intl.dll SDL.dll README-SDL.txt ; \
380 do cp ${DLL_PATH}/$$file tmp/ ; done
382 for file in default8x16.psf default8x9.psf ; \
383 do cp share/$$file tmp/share/ ; done
385 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
386 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
387 vlc-${VLC_QUICKVERSION}-win32-installer.exe
392 # Check that tmp isn't in the way
393 @if test -e tmp; then \
394 echo "Error: please remove ./tmp, it is in the way"; false; \
396 echo "OK."; mkdir tmp; \
400 mkdir -p tmp/vlc/share
401 # Copy relevant files
403 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
404 README README.libdvdcss FAQ TODO tmp/vlc/
405 for file in default8x16.psf default8x9.psf ; \
406 do cp share/$$file tmp/vlc/share/ ; done
408 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
409 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
410 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
411 mv tmp/vlc-${VLC_QUICKVERSION}-beos.zip .
415 libdvdcss-snapshot: snapshot-common
416 # Remove vlc sources and icons, doc, debian directory...
417 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
418 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
419 rm -Rf tmp/vlc/debian
421 # Remove useless headers
422 rm -f tmp/vlc/include/*
423 for file in defs.h.in config.h.in common.h int_types.h ; \
424 do cp include/$$file tmp/vlc/include/ ; done
425 # Remove misc files (??? - maybe not really needed)
426 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
427 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
428 mv tmp/vlc/README.libdvdcss tmp/vlc/README
429 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
431 rm -f tmp/vlc/Makefile
432 sed -e 's#^install:#install-unused:#' \
433 -e 's#^uninstall:#uninstall-unused:#' \
434 -e 's#^clean:#clean-unused:#' \
435 -e 's#^all:.*#all: libdvdcss#' \
436 -e 's#^libdvdcss-install:#install:#' \
437 -e 's#^libdvdcss-uninstall:#uninstall:#' \
438 -e 's#^libdvdcss-clean:#clean:#' \
439 < Makefile > tmp/vlc/Makefile
441 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
442 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
443 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
444 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
449 dpkg-buildpackage -rfakeroot -us -uc
452 # Gtk/Gnome/* aliases and OS X application
454 gnome-vlc gvlc kvlc qvlc: vlc
455 rm -f $@ && ln -s vlc $@
458 vlc.app: Makefile.opts
459 ifneq (,$(findstring darwin,$(SYS)))
461 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
462 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
463 $(INSTALL) -d vlc.app/Contents/MacOS/share
464 $(INSTALL) -d vlc.app/Contents/MacOS/plugins
465 $(INSTALL) vlc vlc.app/Contents/MacOS/
467 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
469 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
475 # Generic rules (see below)
478 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
480 $(CPP_DEP): %.dpp: FORCE
481 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
483 $(H_OBJ): Makefile.opts Makefile.dep Makefile
484 rm -f $@ && cp $@.in $@
486 for i in $(BUILTINS) ; do \
487 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
488 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
489 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
492 printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
493 for i in $(BUILTINS) ; do \
494 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
496 echo "} while( 0 );" >> $@ ;
500 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
501 $(C_OBJ): %.o: .dep/%.d
503 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
505 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
506 $(CPP_OBJ): %.o: .dep/%.dpp
507 $(CPP_OBJ): %.o: %.cpp
508 $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
510 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
511 ifneq (,(findstring mingw32,$(SYS)))
512 $(RESOURCE_OBJ): %.o: %.rc
513 $(WINDRES) -i $< -o $@
517 # Main application target
519 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ) plugins
520 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
522 xres -o $@ ./share/vlc_beos.rsrc
529 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
531 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
534 # Built-in modules target
536 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
537 $(BUILTIN_OBJ): FORCE
538 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
543 libdvdcss: Makefile.opts
544 cd extras/libdvdcss && $(MAKE)
549 libdvdread: Makefile.opts
550 cd extras/libdvdread && $(MAKE)