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
44 # All possible plugin objects
46 PLUGINS_TARGETS := alsa/alsa \
79 motion/motionaltivec \
96 INTERFACE := main interface intf_msg intf_playlist intf_channels
97 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist input_clock mpeg_system
98 VIDEO_OUTPUT := video_output video_text video_spu video_yuv
99 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
100 AC3_DECODER := ac3_decoder_thread ac3_decoder ac3_parse ac3_exponent ac3_bit_allocate ac3_mantissa ac3_rematrix ac3_imdct
101 AC3_SPDIF := ac3_spdif ac3_iec958
102 LPCM_DECODER := lpcm_decoder_thread
103 AUDIO_DECODER := audio_decoder adec_generic adec_layer1 adec_layer2 adec_math
104 SPU_DECODER := spu_decoder
105 VIDEO_DECODER := video_parser vpar_headers vpar_blocks vpar_synchro vpar_pool video_decoder
106 MISC := mtime tests modules netutils iso_lang
108 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
109 $(INPUT:%=src/input/%.o) \
110 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
111 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
112 $(AC3_DECODER:%=src/ac3_decoder/%.o) \
113 $(AC3_SPDIF:%=src/ac3_spdif/%.o) \
114 $(LPCM_DECODER:%=src/lpcm_decoder/%.o) \
115 $(AUDIO_DECODER:%=src/audio_decoder/%.o) \
116 $(SPU_DECODER:%=src/spu_decoder/%.o) \
117 $(VIDEO_DECODER:%=src/video_decoder/%.o) \
118 $(MISC:%=src/misc/%.o)
123 ifeq ($(NEED_GETOPT),1)
124 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
128 CPP_OBJ := src/misc/beos_specific.o
131 ifneq (,$(findstring darwin,$(SYS)))
132 C_OBJ += src/misc/darwin_specific.o
135 ifneq (,$(findstring mingw32,$(SYS)))
136 RESOURCE_OBJ := share/vlc_win32_rc.o
139 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
144 H_OBJ := src/misc/modules_builtin.h
147 # Other lists of files
149 C_DEP := $(C_OBJ:%.o=.dep/%.d)
150 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
153 # Translate plugin names
156 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
159 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
165 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | cut -f2 -d=)
166 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | cut -f2 -d=)
169 # All symbols must be exported
172 ###############################################################################
174 ###############################################################################
179 all: Makefile.opts vlc ${ALIASES} vlc.app
182 @echo "**** No configuration found, running ./configure..."
184 $(MAKE) $(MAKECMDGOALS)
189 @echo CFLAGS: $(CFLAGS)
190 @echo DCFLAGS: $(DCFLAGS)
191 @echo LCFLAGS: $(LCFLAGS)
192 @echo PCFLAGS: $(PCFLAGS)
193 @echo PLCFLAGS: $(PLCFLAGS)
194 @echo C_OBJ: $(C_OBJ)
195 @echo CPP_OBJ: $(CPP_OBJ)
196 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
197 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
202 clean: libdvdcss-clean plugins-clean vlc-clean
203 rm -f src/*/*.o extras/*/*.o
204 rm -f lib/*.so* lib/*.a
205 rm -f plugins/*.so plugins/*.a
206 rm -rf extras/MacOSX/build
209 -cd extras/libdvdcss && $(MAKE) clean
212 for dir in $(PLUGINS_DIR) ; do \
213 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
214 rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
217 rm -f $(C_OBJ) $(CPP_OBJ)
218 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
222 rm -f **/*.o **/*~ *.log
224 rm -f include/defs.h include/config.h include/modules_builtin.h
225 rm -f src/misc/modules_builtin.h
226 rm -f config*status config*cache config*log
227 rm -f gmon.out core build-stamp
232 # Install/uninstall rules
234 install: libdvdcss-install vlc-install plugins-install
236 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall
239 mkdir -p $(DESTDIR)$(bindir)
240 $(INSTALL) vlc $(DESTDIR)$(bindir)
242 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
244 mkdir -p $(DESTDIR)$(datadir)/videolan
245 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
246 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
247 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
250 rm -f $(DESTDIR)$(bindir)/vlc
252 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
254 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
255 rm -f $(DESTDIR)$(datadir)/videolan/*.png
256 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
259 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
261 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
265 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
268 -cd extras/libdvdcss && $(MAKE) install
271 -cd extras/libdvdcss && $(MAKE) uninstall
274 # Package generation rules
277 # Check that tmp isn't in the way
278 @if test -e tmp; then \
279 echo "Error: please remove ./tmp, it is in the way"; false; \
281 echo "OK."; mkdir tmp; \
283 # Copy directory structure in tmp
284 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
285 do mkdir -p tmp/vlc/$$i ; \
288 find debian -mindepth 1 -maxdepth 1 -type d | \
289 while read i ; do rm -Rf tmp/vlc/$$i ; done
290 # Copy .c .h .in .cpp and .glade files
291 find include src plugins -type f -name '*.[chig]*' | while read i ; \
292 do cp $$i tmp/vlc/$$i ; done
293 # Copy plugin Makefiles
294 find plugins -type f -name Makefile | while read i ; \
295 do cp $$i tmp/vlc/$$i ; done
296 # Copy extra programs and documentation
297 cp -a extras/* tmp/vlc/extras
298 cp -a doc/* tmp/vlc/doc
299 find tmp/vlc/extras tmp/vlc/doc \
300 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
301 while read i ; do rm -Rf $$i ; done
303 cp vlc.spec AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
304 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
305 configure configure.in install-sh config.sub config.guess \
307 # Copy Debian control files
308 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
309 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
310 for file in control changelog rules ; do \
311 cp debian/$$file tmp/vlc/debian/ ; done
312 # Copy fonts and icons
313 for file in share/*png share/*xpm share/*psf ; do \
314 cp $$file tmp/vlc/share ; done
315 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
316 cp share/$$file tmp/vlc/share/ ; done
318 snapshot: snapshot-common
320 F=vlc-${VLC_QUICKVERSION}; \
321 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
322 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
323 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
327 snapshot-nocss: snapshot-common
329 rm -Rf tmp/vlc/extras/libdvdcss
330 rm -f tmp/vlc/*.libdvdcss
331 # Fix debian information
332 rm -f tmp/vlc/debian/libdvdcss*
333 rm -f tmp/vlc/debian/control
334 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
335 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
336 > tmp/vlc/debian/control
337 rm -f tmp/vlc/debian/rules
338 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
339 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
340 > tmp/vlc/debian/rules
341 chmod +x tmp/vlc/debian/rules
342 # Build css-disabled archives
343 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
344 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
345 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
346 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
351 # XXX: this rule is probably only useful to you if you have exactly
352 # the same setup as me. Contact sam@zoy.org if you need to use it.
354 # Check that tmp isn't in the way
355 @if test -e tmp; then \
356 echo "Error: please remove ./tmp, it is in the way"; false; \
358 echo "OK."; mkdir tmp; \
360 # Create installation script
361 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
362 # Copy relevant files
363 cp vlc.exe plugins/directx.so plugins/gtk.so plugins/sdl.so tmp/
364 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
365 README README.libdvdcss FAQ TODO tmp/
366 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
367 gnu-intl.dll SDL.dll README-SDL.txt ; \
368 do cp ../vlc-win32/$$file tmp/ ; done
370 for file in default8x16.psf default8x9.psf ; \
371 do cp share/$$file tmp/share/ ; done
373 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
374 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
375 vlc-${VLC_QUICKVERSION}-win32-installer.exe
379 libdvdcss-snapshot: snapshot-common
380 # Remove vlc sources and icons, doc, debian directory...
381 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
382 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
383 rm -Rf tmp/vlc/debian
384 # Remove useless headers
385 rm -f tmp/vlc/include/*
386 for file in defs.h.in config.h.in common.h int_types.h ; \
387 do cp include/$$file tmp/vlc/include/ ; done
388 # Remove misc files (??? - maybe not really needed)
389 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
390 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
391 mv tmp/vlc/README.libdvdcss tmp/vlc/README
392 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
394 rm -f tmp/vlc/Makefile
395 sed -e 's#^install:#install-unused:#' \
396 -e 's#^uninstall:#uninstall-unused:#' \
397 -e 's#^clean:#clean-unused:#' \
398 -e 's#^all:.*#all: libdvdcss#' \
399 -e 's#^libdvdcss-install:#install:#' \
400 -e 's#^libdvdcss-uninstall:#uninstall:#' \
401 -e 's#^libdvdcss-clean:#clean:#' \
402 < Makefile > tmp/vlc/Makefile
404 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
405 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
406 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
407 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
412 dpkg-buildpackage -rfakeroot -us -uc
415 # Gtk/Gnome/* aliases and OS X application
417 gnome-vlc gvlc kvlc qvlc: vlc
418 rm -f $@ && ln -s vlc $@
421 vlc.app: Makefile.opts
422 ifneq (,$(findstring darwin,$(SYS)))
424 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
425 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
426 $(INSTALL) -d vlc vlc.app/Contents/MacOS/share
427 $(INSTALL) -d vlc vlc.app/Contents/MacOS/plugins
428 $(INSTALL) vlc vlc.app/Contents/MacOS/
430 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
432 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
438 # Generic rules (see below)
441 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
443 $(CPP_DEP): %.dpp: FORCE
444 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
446 $(H_OBJ): Makefile.opts Makefile.dep Makefile
447 rm -f $@ && cp $@.in $@
449 for i in $(BUILTINS) ; do \
450 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
451 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
452 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
455 printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
456 for i in $(BUILTINS) ; do \
457 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
459 echo "} while( 0 );" >> $@ ;
463 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
464 $(C_OBJ): %.o: .dep/%.d
466 $(CC) $(CFLAGS) -c -o $@ $<
468 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
469 $(CPP_OBJ): %.o: .dep/%.dpp
470 $(CPP_OBJ): %.o: %.cpp
471 $(CC) $(CFLAGS) -c -o $@ $<
473 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
474 ifneq (,(findstring mingw32,$(SYS)))
475 $(RESOURCE_OBJ): %.o: %.rc
476 $(WINDRES) -i $< -o $@
480 # Main application target
482 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ) plugins
483 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
485 xres -o $@ ./share/vlc_beos.rsrc
492 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
494 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
497 # Built-in modules target
499 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
500 $(BUILTIN_OBJ): FORCE
501 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
506 libdvdcss: Makefile.opts
507 cd extras/libdvdcss && $(MAKE)