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=[0-9]' configure.in | head -1 | cut -f2 -d=)
166 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=[0-9]' configure.in | head -1 | 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 FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
304 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
305 configure configure.in install-sh install-win32 vlc.spec \
306 config.sub config.guess \
308 # Copy Debian control files
309 for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
310 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
311 for file in control changelog rules ; do \
312 cp debian/$$file tmp/vlc/debian/ ; done
313 # Copy ipkg control files
314 for file in control rules ; do \
315 cp ipkg/$$file tmp/vlc/ipkg/ ; done
316 # Copy fonts and icons
317 for file in share/*png share/*xpm share/*psf ; do \
318 cp $$file tmp/vlc/share ; done
319 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
320 cp share/$$file tmp/vlc/share/ ; done
322 snapshot: snapshot-common
324 F=vlc-${VLC_QUICKVERSION}; \
325 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
326 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
327 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
331 snapshot-nocss: snapshot-common
333 rm -Rf tmp/vlc/extras/libdvdcss
334 rm -f tmp/vlc/*.libdvdcss
335 # Fix debian information
336 rm -f tmp/vlc/debian/libdvdcss*
337 rm -f tmp/vlc/debian/control
338 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
339 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
340 > tmp/vlc/debian/control
341 rm -f tmp/vlc/debian/rules
342 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
343 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
344 > tmp/vlc/debian/rules
345 chmod +x tmp/vlc/debian/rules
346 # Build css-disabled archives
347 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
348 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
349 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
350 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
355 # XXX: this rule is probably only useful to you if you have exactly
356 # the same setup as me. Contact sam@zoy.org if you need to use it.
358 # Check that tmp isn't in the way
359 @if test -e tmp; then \
360 echo "Error: please remove ./tmp, it is in the way"; false; \
362 echo "OK."; mkdir tmp; \
364 # Create installation script
365 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
366 # Copy relevant files
367 cp vlc.exe plugins/directx.so plugins/gtk.so plugins/sdl.so tmp/
368 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
369 README README.libdvdcss FAQ TODO tmp/
370 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
371 gnu-intl.dll SDL.dll README-SDL.txt ; \
372 do cp ../win32-libs/$$file tmp/ ; done
374 for file in default8x16.psf default8x9.psf ; \
375 do cp share/$$file tmp/share/ ; done
377 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
378 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
379 vlc-${VLC_QUICKVERSION}-win32-installer.exe
383 libdvdcss-snapshot: snapshot-common
384 # Remove vlc sources and icons, doc, debian directory...
385 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
386 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
387 rm -Rf tmp/vlc/debian
389 # Remove useless headers
390 rm -f tmp/vlc/include/*
391 for file in defs.h.in config.h.in common.h int_types.h ; \
392 do cp include/$$file tmp/vlc/include/ ; done
393 # Remove misc files (??? - maybe not really needed)
394 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
395 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
396 mv tmp/vlc/README.libdvdcss tmp/vlc/README
397 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
399 rm -f tmp/vlc/Makefile
400 sed -e 's#^install:#install-unused:#' \
401 -e 's#^uninstall:#uninstall-unused:#' \
402 -e 's#^clean:#clean-unused:#' \
403 -e 's#^all:.*#all: libdvdcss#' \
404 -e 's#^libdvdcss-install:#install:#' \
405 -e 's#^libdvdcss-uninstall:#uninstall:#' \
406 -e 's#^libdvdcss-clean:#clean:#' \
407 < Makefile > tmp/vlc/Makefile
409 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
410 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
411 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
412 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
417 dpkg-buildpackage -rfakeroot -us -uc
420 # Gtk/Gnome/* aliases and OS X application
422 gnome-vlc gvlc kvlc qvlc: vlc
423 rm -f $@ && ln -s vlc $@
426 vlc.app: Makefile.opts
427 ifneq (,$(findstring darwin,$(SYS)))
429 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
430 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
431 $(INSTALL) -d vlc vlc.app/Contents/MacOS/share
432 $(INSTALL) -d vlc vlc.app/Contents/MacOS/plugins
433 $(INSTALL) vlc vlc.app/Contents/MacOS/
435 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
437 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
443 # Generic rules (see below)
446 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
448 $(CPP_DEP): %.dpp: FORCE
449 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
451 $(H_OBJ): Makefile.opts Makefile.dep Makefile
452 rm -f $@ && cp $@.in $@
454 for i in $(BUILTINS) ; do \
455 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
456 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
457 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
460 printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
461 for i in $(BUILTINS) ; do \
462 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
464 echo "} while( 0 );" >> $@ ;
468 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
469 $(C_OBJ): %.o: .dep/%.d
471 $(CC) $(CFLAGS) -c -o $@ $<
473 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
474 $(CPP_OBJ): %.o: .dep/%.dpp
475 $(CPP_OBJ): %.o: %.cpp
476 $(CC) $(CFLAGS) -c -o $@ $<
478 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
479 ifneq (,(findstring mingw32,$(SYS)))
480 $(RESOURCE_OBJ): %.o: %.rc
481 $(WINDRES) -i $< -o $@
485 # Main application target
487 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ) plugins
488 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
490 xres -o $@ ./share/vlc_beos.rsrc
497 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
499 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
502 # Built-in modules target
504 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
505 $(BUILTIN_OBJ): FORCE
506 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
511 libdvdcss: Makefile.opts
512 cd extras/libdvdcss && $(MAKE)