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 \
50 PLUGINS_TARGETS := ac3_adec/ac3_adec \
87 motion/motionaltivec \
106 INTERFACE := main interface intf_msg intf_playlist intf_channels
107 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist input_clock mpeg_system
108 VIDEO_OUTPUT := video_output video_text video_spu video_yuv
109 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
110 MISC := mtime tests modules netutils iso_lang
112 C_OBJ := $(INTERFACE:%=src/interface/%.o) \
113 $(INPUT:%=src/input/%.o) \
114 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
115 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
116 $(MISC:%=src/misc/%.o)
121 ifeq ($(NEED_GETOPT),1)
122 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
126 CPP_OBJ := src/misc/beos_specific.o
129 ifneq (,$(findstring darwin,$(SYS)))
130 C_OBJ += src/misc/darwin_specific.o
133 ifneq (,$(findstring mingw32,$(SYS)))
134 C_OBJ += src/misc/win32_specific.o
135 RESOURCE_OBJ := share/vlc_win32_rc.o
138 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
143 H_OBJ := src/misc/modules_builtin.h
146 # Other lists of files
148 C_DEP := $(C_OBJ:%.o=.dep/%.d)
149 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
152 # Translate plugin names
155 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
158 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
164 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=[0-9]' configure.in | head -1 | cut -f2 -d=)
165 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=[0-9]' configure.in | head -1 | cut -f2 -d=)
168 # All symbols must be exported
171 ###############################################################################
173 ###############################################################################
178 all: Makefile.opts vlc ${ALIASES} vlc.app
181 @echo "**** No configuration found, running ./configure..."
183 $(MAKE) $(MAKECMDGOALS)
188 @echo CFLAGS: $(CFLAGS)
189 @echo DCFLAGS: $(DCFLAGS)
190 @echo LCFLAGS: $(LCFLAGS)
191 @echo PCFLAGS: $(PCFLAGS)
192 @echo PLCFLAGS: $(PLCFLAGS)
193 @echo C_OBJ: $(C_OBJ)
194 @echo CPP_OBJ: $(CPP_OBJ)
195 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
196 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
201 clean: libdvdcss-clean plugins-clean vlc-clean
202 rm -f src/*/*.o extras/*/*.o
203 rm -f lib/*.so* lib/*.a
204 rm -f plugins/*.so plugins/*.a
205 rm -rf extras/MacOSX/build
208 -cd extras/libdvdcss && $(MAKE) clean
211 for dir in $(PLUGINS_DIR) ; do \
212 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
213 rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
216 rm -f $(C_OBJ) $(CPP_OBJ)
217 rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
221 rm -f **/*.o **/*~ *.log
223 rm -f include/defs.h include/config.h include/modules_builtin.h
224 rm -f src/misc/modules_builtin.h
225 rm -f config*status config*cache config*log
226 rm -f gmon.out core build-stamp
231 # Install/uninstall rules
233 install: libdvdcss-install vlc-install plugins-install
235 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall
238 mkdir -p $(DESTDIR)$(bindir)
239 $(INSTALL) vlc $(DESTDIR)$(bindir)
241 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
243 mkdir -p $(DESTDIR)$(datadir)/videolan
244 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
245 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
246 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
249 rm -f $(DESTDIR)$(bindir)/vlc
251 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
253 rm -f $(DESTDIR)$(datadir)/videolan/*.psf
254 rm -f $(DESTDIR)$(datadir)/videolan/*.png
255 rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
258 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
260 $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
264 rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
267 -cd extras/libdvdcss && $(MAKE) install
270 -cd extras/libdvdcss && $(MAKE) uninstall
273 # Package generation rules
276 # Check that tmp isn't in the way
277 @if test -e tmp; then \
278 echo "Error: please remove ./tmp, it is in the way"; false; \
280 echo "OK."; mkdir tmp; \
282 # Copy directory structure in tmp
283 find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
284 do mkdir -p tmp/vlc/$$i ; \
287 find debian -mindepth 1 -maxdepth 1 -type d | \
288 while read i ; do rm -Rf tmp/vlc/$$i ; done
289 # Copy .c .h .in .cpp and .glade files
290 find include src plugins -type f -name '*.[chig]*' | while read i ; \
291 do cp $$i tmp/vlc/$$i ; done
292 # Copy plugin Makefiles
293 find plugins -type f -name Makefile | while read i ; \
294 do cp $$i tmp/vlc/$$i ; done
295 # Copy extra programs and documentation
296 cp -a extras/* tmp/vlc/extras
297 cp -a doc/* tmp/vlc/doc
298 find tmp/vlc/extras tmp/vlc/doc \
299 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
300 while read i ; do rm -Rf $$i ; done
302 cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
303 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
304 configure configure.in install-sh install-win32 vlc.spec \
305 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 ipkg control files
313 for file in control rules ; do \
314 cp ipkg/$$file tmp/vlc/ipkg/ ; done
315 # Copy fonts and icons
316 for file in share/*png share/*xpm share/*psf ; do \
317 cp $$file tmp/vlc/share ; done
318 for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
319 cp share/$$file tmp/vlc/share/ ; done
321 snapshot: snapshot-common
323 F=vlc-${VLC_QUICKVERSION}; \
324 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
325 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
326 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
330 snapshot-nocss: snapshot-common
332 rm -Rf tmp/vlc/extras/libdvdcss
333 rm -f tmp/vlc/*.libdvdcss
334 # Fix debian information
335 rm -f tmp/vlc/debian/libdvdcss*
336 rm -f tmp/vlc/debian/control
337 sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
338 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
339 > tmp/vlc/debian/control
340 rm -f tmp/vlc/debian/rules
341 sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
342 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
343 > tmp/vlc/debian/rules
344 chmod +x tmp/vlc/debian/rules
345 # Build css-disabled archives
346 F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
347 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
348 bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
349 gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
354 # XXX: this rule is probably only useful to you if you have exactly
355 # the same setup as me. Contact sam@zoy.org if you need to use it.
357 # Check that tmp isn't in the way
358 @if test -e tmp; then \
359 echo "Error: please remove ./tmp, it is in the way"; false; \
361 echo "OK."; mkdir tmp; \
363 # Create installation script
364 sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
365 # Copy relevant files
366 cp vlc.exe plugins/directx.so plugins/gtk.so plugins/sdl.so tmp/
367 cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
368 README README.libdvdcss FAQ TODO tmp/
369 for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
370 gnu-intl.dll SDL.dll README-SDL.txt ; \
371 do cp ../win32-libs/$$file tmp/ ; done
373 for file in default8x16.psf default8x9.psf ; \
374 do cp share/$$file tmp/share/ ; done
376 wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
377 mv tmp/vlc-${VLC_QUICKVERSION}.exe \
378 vlc-${VLC_QUICKVERSION}-win32-installer.exe
383 # Check that tmp isn't in the way
384 @if test -e tmp; then \
385 echo "Error: please remove ./tmp, it is in the way"; false; \
387 echo "OK."; mkdir tmp; \
391 mkdir -p tmp/vlc/share
392 # Copy relevant files
394 cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
395 README README.libdvdcss FAQ TODO tmp/vlc/
396 for file in default8x16.psf default8x9.psf ; \
397 do cp share/$$file tmp/vlc/share/ ; done
399 mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
400 (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
401 zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
402 mv tmp/vlc-${VLC_QUICKVERSION}-beos.zip .
406 libdvdcss-snapshot: snapshot-common
407 # Remove vlc sources and icons, doc, debian directory...
408 rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
409 rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
410 rm -Rf tmp/vlc/debian
412 # Remove useless headers
413 rm -f tmp/vlc/include/*
414 for file in defs.h.in config.h.in common.h int_types.h ; \
415 do cp include/$$file tmp/vlc/include/ ; done
416 # Remove misc files (??? - maybe not really needed)
417 rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
418 mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
419 mv tmp/vlc/README.libdvdcss tmp/vlc/README
420 mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
422 rm -f tmp/vlc/Makefile
423 sed -e 's#^install:#install-unused:#' \
424 -e 's#^uninstall:#uninstall-unused:#' \
425 -e 's#^clean:#clean-unused:#' \
426 -e 's#^all:.*#all: libdvdcss#' \
427 -e 's#^libdvdcss-install:#install:#' \
428 -e 's#^libdvdcss-uninstall:#uninstall:#' \
429 -e 's#^libdvdcss-clean:#clean:#' \
430 < Makefile > tmp/vlc/Makefile
432 F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
433 mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
434 bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
435 gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
440 dpkg-buildpackage -rfakeroot -us -uc
443 # Gtk/Gnome/* aliases and OS X application
445 gnome-vlc gvlc kvlc qvlc: vlc
446 rm -f $@ && ln -s vlc $@
449 vlc.app: Makefile.opts
450 ifneq (,$(findstring darwin,$(SYS)))
452 cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
453 cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
454 $(INSTALL) -d vlc vlc.app/Contents/MacOS/share
455 $(INSTALL) -d vlc vlc.app/Contents/MacOS/plugins
456 $(INSTALL) vlc vlc.app/Contents/MacOS/
458 $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
460 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
466 # Generic rules (see below)
469 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
471 $(CPP_DEP): %.dpp: FORCE
472 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
474 $(H_OBJ): Makefile.opts Makefile.dep Makefile
475 rm -f $@ && cp $@.in $@
477 for i in $(BUILTINS) ; do \
478 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
479 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
480 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
483 printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
484 for i in $(BUILTINS) ; do \
485 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
487 echo "} while( 0 );" >> $@ ;
491 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
492 $(C_OBJ): %.o: .dep/%.d
494 $(CC) $(CFLAGS) -c -o $@ $<
496 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
497 $(CPP_OBJ): %.o: .dep/%.dpp
498 $(CPP_OBJ): %.o: %.cpp
499 $(CC) $(CFLAGS) -c -o $@ $<
501 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
502 ifneq (,(findstring mingw32,$(SYS)))
503 $(RESOURCE_OBJ): %.o: %.rc
504 $(WINDRES) -i $< -o $@
508 # Main application target
510 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ) plugins
511 $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
513 xres -o $@ ./share/vlc_beos.rsrc
520 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
522 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
525 # Built-in modules target
527 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
528 $(BUILTIN_OBJ): FORCE
529 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
534 libdvdcss: Makefile.opts
535 cd extras/libdvdcss && $(MAKE)