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 C_OBJ += src/misc/win32_specific.o
137 RESOURCE_OBJ := share/vlc_win32_rc.o
140 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
145 H_OBJ := src/misc/modules_builtin.h
148 # Other lists of files
150 C_DEP := $(C_OBJ:%.o=.dep/%.d)
151 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
154 # Translate plugin names
157 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
160 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
166 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=[0-9]' configure.in | head -1 | cut -f2 -d=)
167 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=[0-9]' configure.in | head -1 | cut -f2 -d=)
170 # All symbols must be exported
173 ###############################################################################
175 ###############################################################################
180 all: Makefile.opts vlc ${ALIASES} vlc.app
183 @echo "**** No configuration found, running ./configure..."
185 $(MAKE) $(MAKECMDGOALS)
190 @echo CFLAGS: $(CFLAGS)
191 @echo DCFLAGS: $(DCFLAGS)
192 @echo LCFLAGS: $(LCFLAGS)
193 @echo PCFLAGS: $(PCFLAGS)
194 @echo PLCFLAGS: $(PLCFLAGS)
195 @echo C_OBJ: $(C_OBJ)
196 @echo CPP_OBJ: $(CPP_OBJ)
197 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
198 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
203 clean: libdvdcss-clean plugins-clean vlc-clean
204 rm -f src/*/*.o extras/*/*.o
205 rm -f lib/*.so* lib/*.a
206 rm -f plugins/*.so plugins/*.a
207 rm -rf extras/MacOSX/build
210 -cd extras/libdvdcss && $(MAKE) clean
213 for dir in $(PLUGINS_DIR) ; do \
214 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
215 rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
218 rm -f $(C_OBJ) $(CPP_OBJ)
219 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
223 rm -f **/*.o **/*~ *.log
225 rm -f include/defs.h include/config.h include/modules_builtin.h
226 rm -f src/misc/modules_builtin.h
227 rm -f config*status config*cache config*log
228 rm -f gmon.out core build-stamp
233 # Install/uninstall rules
235 install: libdvdcss-install vlc-install plugins-install
237 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall
240 mkdir -p $(DESTDIR)$(bindir)
241 $(INSTALL) vlc $(DESTDIR)$(bindir)
243 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
245 mkdir -p $(DESTDIR)$(datadir)/videolan
246 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
247 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
248 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
251 rm -f $(DESTDIR)$(bindir)/vlc
253 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
255 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
256 rm -f $(DESTDIR)$(datadir)/videolan/*.png
257 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
260 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
262 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
266 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
269 -cd extras/libdvdcss && $(MAKE) install
272 -cd extras/libdvdcss && $(MAKE) uninstall
275 # Package generation rules
278 # Check that tmp isn't in the way
279 @if test -e tmp; then \
280 echo "Error: please remove ./tmp, it is in the way"; false; \
282 echo "OK."; mkdir tmp; \
284 # Copy directory structure in tmp
285 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
286 do mkdir -p tmp/vlc/$$i ; \
289 find debian -mindepth 1 -maxdepth 1 -type d | \
290 while read i ; do rm -Rf tmp/vlc/$$i ; done
291 # Copy .c .h .in .cpp and .glade files
292 find include src plugins -type f -name '*.[chig]*' | while read i ; \
293 do cp $$i tmp/vlc/$$i ; done
294 # Copy plugin Makefiles
295 find plugins -type f -name Makefile | while read i ; \
296 do cp $$i tmp/vlc/$$i ; done
297 # Copy extra programs and documentation
298 cp -a extras/* tmp/vlc/extras
299 cp -a doc/* tmp/vlc/doc
300 find tmp/vlc/extras tmp/vlc/doc \
301 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
302 while read i ; do rm -Rf $$i ; done
304 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
305 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
306 configure configure.in install-sh install-win32 vlc.spec \
307 config.sub config.guess \
309 # Copy Debian control files
310 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
311 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
312 for file in control changelog rules ; do \
313 cp debian/$$file tmp/vlc/debian/ ; done
314 # Copy ipkg control files
315 for file in control rules ; do \
316 cp ipkg/$$file tmp/vlc/ipkg/ ; done
317 # Copy fonts and icons
318 for file in share/*png share/*xpm share/*psf ; do \
319 cp $$file tmp/vlc/share ; done
320 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
321 cp share/$$file tmp/vlc/share/ ; done
323 snapshot: snapshot-common
325 F=vlc-${VLC_QUICKVERSION}; \
326 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
327 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
328 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
332 snapshot-nocss: snapshot-common
334 rm -Rf tmp/vlc/extras/libdvdcss
335 rm -f tmp/vlc/*.libdvdcss
336 # Fix debian information
337 rm -f tmp/vlc/debian/libdvdcss*
338 rm -f tmp/vlc/debian/control
339 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
340 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
341 > tmp/vlc/debian/control
342 rm -f tmp/vlc/debian/rules
343 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
344 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
345 > tmp/vlc/debian/rules
346 chmod +x tmp/vlc/debian/rules
347 # Build css-disabled archives
348 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
349 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
350 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
351 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
356 # XXX: this rule is probably only useful to you if you have exactly
357 # the same setup as me. Contact sam@zoy.org if you need to use it.
359 # Check that tmp isn't in the way
360 @if test -e tmp; then \
361 echo "Error: please remove ./tmp, it is in the way"; false; \
363 echo "OK."; mkdir tmp; \
365 # Create installation script
366 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
367 # Copy relevant files
368 cp vlc.exe plugins/directx.so plugins/gtk.so plugins/sdl.so tmp/
369 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
370 README README.libdvdcss FAQ TODO tmp/
371 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
372 gnu-intl.dll SDL.dll README-SDL.txt ; \
373 do cp ../win32-libs/$$file tmp/ ; done
375 for file in default8x16.psf default8x9.psf ; \
376 do cp share/$$file tmp/share/ ; done
378 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
379 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
380 vlc-${VLC_QUICKVERSION}-win32-installer.exe
384 libdvdcss-snapshot: snapshot-common
385 # Remove vlc sources and icons, doc, debian directory...
386 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
387 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
388 rm -Rf tmp/vlc/debian
390 # Remove useless headers
391 rm -f tmp/vlc/include/*
392 for file in defs.h.in config.h.in common.h int_types.h ; \
393 do cp include/$$file tmp/vlc/include/ ; done
394 # Remove misc files (??? - maybe not really needed)
395 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
396 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
397 mv tmp/vlc/README.libdvdcss tmp/vlc/README
398 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
400 rm -f tmp/vlc/Makefile
401 sed -e 's#^install:#install-unused:#' \
402 -e 's#^uninstall:#uninstall-unused:#' \
403 -e 's#^clean:#clean-unused:#' \
404 -e 's#^all:.*#all: libdvdcss#' \
405 -e 's#^libdvdcss-install:#install:#' \
406 -e 's#^libdvdcss-uninstall:#uninstall:#' \
407 -e 's#^libdvdcss-clean:#clean:#' \
408 < Makefile > tmp/vlc/Makefile
410 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
411 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
412 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
413 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
418 dpkg-buildpackage -rfakeroot -us -uc
421 # Gtk/Gnome/* aliases and OS X application
423 gnome-vlc gvlc kvlc qvlc: vlc
424 rm -f $@ && ln -s vlc $@
427 vlc.app: Makefile.opts
428 ifneq (,$(findstring darwin,$(SYS)))
430 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
431 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
432 $(INSTALL) -d vlc vlc.app/Contents/MacOS/share
433 $(INSTALL) -d vlc vlc.app/Contents/MacOS/plugins
434 $(INSTALL) vlc vlc.app/Contents/MacOS/
436 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
438 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
444 # Generic rules (see below)
447 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
449 $(CPP_DEP): %.dpp: FORCE
450 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
452 $(H_OBJ): Makefile.opts Makefile.dep Makefile
453 rm -f $@ && cp $@.in $@
455 for i in $(BUILTINS) ; do \
456 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
457 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
458 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
461 printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
462 for i in $(BUILTINS) ; do \
463 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
465 echo "} while( 0 );" >> $@ ;
469 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
470 $(C_OBJ): %.o: .dep/%.d
472 $(CC) $(CFLAGS) -c -o $@ $<
474 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
475 $(CPP_OBJ): %.o: .dep/%.dpp
476 $(CPP_OBJ): %.o: %.cpp
477 $(CC) $(CFLAGS) -c -o $@ $<
479 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
480 ifneq (,(findstring mingw32,$(SYS)))
481 $(RESOURCE_OBJ): %.o: %.rc
482 $(WINDRES) -i $< -o $@
486 # Main application target
488 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ) plugins
489 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
491 xres -o $@ ./share/vlc_beos.rsrc
498 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
500 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
503 # Built-in modules target
505 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
506 $(BUILTIN_OBJ): FORCE
507 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
512 libdvdcss: Makefile.opts
513 cd extras/libdvdcss && $(MAKE)