]> git.sesse.net Git - vlc/blob - Makefile
Bumped up revision number to 0.2.92-pre1 and 1.0.1-pre1. Ready for 0.2.92
[vlc] / Makefile
1 ###############################################################################
2 # vlc (VideoLAN Client) main Makefile - (c)1998 VideoLAN
3 ###############################################################################
4
5 ifeq ($(shell [ ! -r Makefile.opts ] && echo 1),)
6     include Makefile.opts
7 endif
8
9 ###############################################################################
10 # Objects and files
11 ###############################################################################
12
13
14 # All possible plugin directories, needed for make clean
15 #
16 PLUGINS_DIR :=  ac3_adec \
17                 ac3_spdif \
18                 alsa \
19                 arts \
20                 beos \
21                 directx \
22                 dsp \
23                 dummy \
24                 dvd \
25                 dvdread \
26                 esd \
27                 fb \
28                 ggi \
29                 glide \
30                 gtk \
31                 downmix \
32                 idct \
33                 imdct \
34                 kde \
35                 lpcm_adec \
36                 macosx \
37                 mad_adec \
38                 memcpy \
39                 mga \
40                 motion \
41                 mpeg \
42                 mpeg_adec \
43                 mpeg_vdec \
44                 qt \
45                 sdl \
46                 spu_dec \
47                 text \
48                 vcd \
49                 x11 \
50                 yuv
51
52 PLUGINS_TARGETS := ac3_adec/ac3_adec \
53                 ac3_spdif/ac3_spdif \
54                 alsa/alsa \
55                 arts/arts \
56                 beos/beos \
57                 directx/directx \
58                 dsp/dsp \
59                 dummy/dummy \
60                 dummy/null \
61                 dvd/dvd \
62                 dvdread/dvdread \
63                 esd/esd \
64                 fb/fb \
65                 ggi/ggi \
66                 glide/glide \
67                 gtk/gnome \
68                 gtk/gtk \
69                 downmix/downmix \
70                 downmix/downmixsse \
71                 downmix/downmix3dn \
72                 idct/idct \
73                 idct/idctclassic \
74                 idct/idctmmx \
75                 idct/idctmmxext \
76                 idct/idctaltivec \
77                 imdct/imdct \
78                 imdct/imdct3dn \
79                 imdct/imdctsse \
80                 kde/kde \
81                 lpcm_adec/lpcm_adec \
82                 macosx/macosx \
83                 mad_adec/mad_adec \
84                 memcpy/memcpy \
85                 memcpy/memcpymmx \
86                 memcpy/memcpymmxext \
87                 memcpy/memcpy3dn \
88                 mga/mga \
89                 motion/motion \
90                 motion/motionmmx \
91                 motion/motionmmxext \
92                 motion/motion3dnow \
93                 motion/motionaltivec \
94                 mpeg_adec/mpeg_adec \
95                 mpeg_vdec/mpeg_vdec \
96                 mpeg/es \
97                 mpeg/ps \
98                 mpeg/ts \
99                 qt/qt \
100                 sdl/sdl \
101                 spu_dec/spu_dec \
102                 text/ncurses \
103                 text/rc \
104                 vcd/vcd \
105                 x11/x11 \
106                 x11/xvideo \
107                 yuv/yuv \
108                 yuv/yuvmmx
109 #
110 # C Objects
111
112 INTERFACE := main interface intf_msg intf_playlist intf_channels
113 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist 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
117
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)
123
124 #
125 # Misc Objects
126
127 ifeq ($(NEED_GETOPT),1)
128 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o 
129 endif
130
131 ifeq ($(SYS),beos)
132 CPP_OBJ :=      src/misc/beos_specific.o
133 endif
134
135 ifneq (,$(findstring darwin,$(SYS)))
136 C_OBJ +=        src/misc/darwin_specific.o
137 endif
138
139 ifneq (,$(findstring mingw32,$(SYS)))
140 C_OBJ +=        src/misc/win32_specific.o
141 RESOURCE_OBJ := share/vlc_win32_rc.o
142 endif
143
144 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
145
146 #
147 # Generated header
148 #
149 H_OBJ :=        src/misc/modules_builtin.h
150
151 #
152 # Other lists of files
153 #
154 C_DEP := $(C_OBJ:%.o=.dep/%.d)
155 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
156
157 #
158 # Translate plugin names
159 #
160 ifneq (,$(PLUGINS))
161 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
162 endif
163 ifneq (,$(BUILTINS))
164 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
165 endif
166
167 #
168 # Misc variables
169 #
170 VLC_QUICKVERSION := $(shell grep '^ *VLC_VERSION=' configure.in | head -1 | cut -f2 -d=)
171 LIBDVDCSS_QUICKVERSION := $(shell grep '^ *LIBDVDCSS_VERSION=' configure.in | head -1 | cut -f2 -d=)
172
173
174 # All symbols must be exported
175 export
176
177 ###############################################################################
178 # Targets
179 ###############################################################################
180
181 #
182 # Virtual targets
183 #
184 all: Makefile.opts vlc ${ALIASES} vlc.app
185
186 Makefile.opts:
187         @echo "**** No configuration found, running ./configure..."
188         ./configure
189         $(MAKE) $(MAKECMDGOALS)
190         exit
191
192 show:
193         @echo CC: $(CC)
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)
203
204 #
205 # Cleaning rules
206 #
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
212
213 libdvdcss-clean:
214         -cd extras/libdvdcss && $(MAKE) clean
215
216 libdvdread-clean:
217         -cd extras/libdvdread && $(MAKE) clean
218
219 plugins-clean:
220         for dir in $(PLUGINS_DIR) ; do \
221                 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
222         rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
223
224 vlc-clean:
225         rm -f $(C_OBJ) $(CPP_OBJ)
226         rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
227         rm -Rf vlc.app
228
229 distclean: clean
230         rm -f **/*.o **/*~ *.log
231         rm -f Makefile.opts
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
236         rm -Rf .dep
237         rm -f .gdb_history
238
239 #
240 # Install/uninstall rules
241 #
242 install: libdvdcss-install vlc-install plugins-install
243
244 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall
245
246 vlc-install:
247         mkdir -p $(DESTDIR)$(bindir)
248         $(INSTALL) vlc $(DESTDIR)$(bindir)
249 ifneq (,$(ALIASES))
250         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
251 endif
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
256
257 vlc-uninstall:
258         rm -f $(DESTDIR)$(bindir)/vlc
259 ifneq (,$(ALIASES))
260         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
261 endif
262         rm -f $(DESTDIR)$(datadir)/videolan/*.psf
263         rm -f $(DESTDIR)$(datadir)/videolan/*.png
264         rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
265
266 plugins-install:
267         mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
268 ifneq (,$(PLUGINS))
269         $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
270 endif
271
272 plugins-uninstall:
273         rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
274
275 libdvdcss-install:
276         -cd extras/libdvdcss && $(MAKE) install
277
278 libdvdcss-uninstall:
279         -cd extras/libdvdcss && $(MAKE) uninstall
280
281 #
282 # Package generation rules
283 #
284 snapshot-common:
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; \
288         else \
289                 echo "OK."; mkdir tmp; \
290         fi
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 ; \
294         done
295         rm -Rf tmp/vlc/tmp
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
310         # Copy misc files
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 \
315                         tmp/vlc/
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
329
330 snapshot: snapshot-common
331         # Build archives
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 .
336         # Clean up
337         rm -Rf tmp
338
339 snapshot-nocss: snapshot-common
340         # Remove libdvdcss
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 .
359         # Clean up
360         rm -Rf tmp
361
362 package-win32:
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.
365         #
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; \
369         else \
370                 echo "OK."; mkdir tmp; \
371         fi
372         # Create installation script
373         sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
374         # Copy relevant files
375         cp vlc.exe plugins/directx.so plugins/gtk.so plugins/sdl.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 ../win32-libs/$$file tmp/ ; done
381         mkdir tmp/share
382         for file in default8x16.psf default8x9.psf ; \
383                 do cp share/$$file tmp/share/ ; done
384         # Create package 
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
388         # Clean up
389         rm -Rf tmp
390
391 package-beos:
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; \
395         else \
396                 echo "OK."; mkdir tmp; \
397         fi
398         
399         # Create dir
400         mkdir -p tmp/vlc/share
401         # Copy relevant files
402         cp vlc tmp/vlc/
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
407         # Create package 
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 .
412         # Clean up
413         rm -Rf tmp
414
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
420         rm -Rf tmp/vlc/ipkg
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
430         # Fix Makefile
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
440         # Build archives
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 .
445         # Clean up
446         rm -Rf tmp
447
448 deb:
449         dpkg-buildpackage -rfakeroot -us -uc
450
451 #
452 # Gtk/Gnome/* aliases and OS X application
453 #
454 gnome-vlc gvlc kvlc qvlc: vlc
455         rm -f $@ && ln -s vlc $@
456
457 .PHONY: vlc.app
458 vlc.app: Makefile.opts
459 ifneq (,$(findstring darwin,$(SYS)))
460         rm -Rf vlc.app
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/
466 ifneq (,$(PLUGINS))
467         $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
468 endif
469         $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
470 endif
471
472 FORCE:
473
474 #
475 # Generic rules (see below)
476 #
477 $(C_DEP): %.d: FORCE
478         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
479
480 $(CPP_DEP): %.dpp: FORCE
481         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
482
483 $(H_OBJ): Makefile.opts Makefile.dep Makefile
484         rm -f $@ && cp $@.in $@
485 ifneq (,$(BUILTINS))
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* );" >> $@ ; \
490         done
491         echo "" >> $@ ;
492         printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
493         for i in $(BUILTINS) ; do \
494                 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
495         done
496         echo "} while( 0 );" >> $@ ;
497         echo "" >> $@ ;
498 endif
499
500 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
501 $(C_OBJ): %.o: .dep/%.d
502 $(C_OBJ): %.o: %.c
503         $(CC) $(CFLAGS) -c -o $@ $<
504
505 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
506 $(CPP_OBJ): %.o: .dep/%.dpp
507 $(CPP_OBJ): %.o: %.cpp
508         $(CC) $(CFLAGS) -c -o $@ $<
509
510 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
511 ifneq (,(findstring mingw32,$(SYS)))
512 $(RESOURCE_OBJ): %.o: %.rc
513         $(WINDRES) -i $< -o $@
514 endif
515
516 #
517 # Main application target
518 #
519 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ) plugins
520         $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
521 ifeq ($(SYS),beos)
522         xres -o $@ ./share/vlc_beos.rsrc
523         mimeset -f $@
524 endif
525
526 #
527 # Plugins target
528 #
529 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
530 $(PLUGIN_OBJ): FORCE
531         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
532
533 #
534 # Built-in modules target
535 #
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/%=../%)
539
540 #
541 # libdvdcss target
542 #
543 libdvdcss: Makefile.opts
544         cd extras/libdvdcss && $(MAKE)
545
546 #
547 # libdvdread target
548 #
549 libdvdread: Makefile.opts
550         cd extras/libdvdread && $(MAKE)
551