]> git.sesse.net Git - vlc/blob - Makefile
Documentation updates.
[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                 darwin \
22                 directx \
23                 dsp \
24                 dummy \
25                 dvd \
26                 dvdread \
27                 esd \
28                 fb \
29                 ggi \
30                 glide \
31                 gtk \
32                 downmix \
33                 idct \
34                 imdct \
35                 kde \
36                 lpcm_adec \
37                 macosx \
38                 mga \
39                 motion \
40                 mpeg \
41                 mpeg_adec \
42                 mpeg_vdec \
43                 qt \
44                 sdl \
45                 spu_dec \
46                 text \
47                 vcd \
48                 x11 \
49                 yuv
50
51 PLUGINS_TARGETS := ac3_adec/ac3_adec \
52                 ac3_spdif/ac3_spdif \
53                 alsa/alsa \
54                 arts/arts \
55                 beos/beos \
56                 darwin/darwin \
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                 macosx/macosx_qt \
84                 mga/mga \
85                 motion/motion \
86                 motion/motionmmx \
87                 motion/motionmmxext \
88                 motion/motion3dnow \
89                 motion/motionaltivec \
90                 mpeg_adec/mpeg_adec \
91                 mpeg_vdec/mpeg_vdec \
92                 mpeg/es \
93                 mpeg/ps \
94                 mpeg/ts \
95                 qt/qt \
96                 sdl/sdl \
97                 spu_dec/spu_dec \
98                 text/ncurses \
99                 text/rc \
100                 vcd/vcd \
101                 x11/x11 \
102                 x11/xvideo \
103                 yuv/yuv \
104                 yuv/yuvmmx
105 #
106 # C Objects
107
108 INTERFACE := main interface intf_msg intf_playlist intf_channels
109 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist input_clock mpeg_system
110 VIDEO_OUTPUT := video_output video_text video_spu video_yuv
111 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
112 MISC := mtime tests modules netutils iso_lang
113
114 C_OBJ :=        $(INTERFACE:%=src/interface/%.o) \
115                 $(INPUT:%=src/input/%.o) \
116                 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
117                 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
118                 $(MISC:%=src/misc/%.o)
119
120 #
121 # Misc Objects
122
123 ifeq ($(NEED_GETOPT),1)
124 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o 
125 endif
126
127 ifeq ($(SYS),beos)
128 CPP_OBJ :=      src/misc/beos_specific.o
129 endif
130
131 ifneq (,$(findstring darwin,$(SYS)))
132 C_OBJ +=        src/misc/darwin_specific.o
133 endif
134
135 ifneq (,$(findstring mingw32,$(SYS)))
136 C_OBJ +=        src/misc/win32_specific.o
137 RESOURCE_OBJ := share/vlc_win32_rc.o
138 endif
139
140 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
141
142 #
143 # Generated header
144 #
145 H_OBJ :=        src/misc/modules_builtin.h
146
147 #
148 # Other lists of files
149 #
150 C_DEP := $(C_OBJ:%.o=.dep/%.d)
151 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
152
153 #
154 # Translate plugin names
155 #
156 ifneq (,$(PLUGINS))
157 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
158 endif
159 ifneq (,$(BUILTINS))
160 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
161 endif
162
163 #
164 # Misc variables
165 #
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=)
168
169
170 # All symbols must be exported
171 export
172
173 ###############################################################################
174 # Targets
175 ###############################################################################
176
177 #
178 # Virtual targets
179 #
180 all: Makefile.opts vlc ${ALIASES} vlc.app
181
182 Makefile.opts:
183         @echo "**** No configuration found, running ./configure..."
184         ./configure
185         $(MAKE) $(MAKECMDGOALS)
186         exit
187
188 show:
189         @echo CC: $(CC)
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)
199
200 #
201 # Cleaning rules
202 #
203 clean: libdvdcss-clean libdvdread-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
208
209 libdvdcss-clean:
210         -cd extras/libdvdcss && $(MAKE) clean
211
212 libdvdread-clean:
213         -cd extras/libdvdread && $(MAKE) clean
214
215 plugins-clean:
216         for dir in $(PLUGINS_DIR) ; do \
217                 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
218         rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
219
220 vlc-clean:
221         rm -f $(C_OBJ) $(CPP_OBJ)
222         rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
223         rm -Rf vlc.app
224
225 distclean: clean
226         rm -f **/*.o **/*~ *.log
227         rm -f Makefile.opts
228         rm -f include/defs.h include/config.h include/modules_builtin.h
229         rm -f src/misc/modules_builtin.h
230         rm -f config*status config*cache config*log
231         rm -f gmon.out core build-stamp
232         rm -Rf .dep
233         rm -f .gdb_history
234
235 #
236 # Install/uninstall rules
237 #
238 install: libdvdcss-install vlc-install plugins-install
239
240 uninstall: libdvdcss-uninstall vlc-uninstall plugins-uninstall
241
242 vlc-install:
243         mkdir -p $(DESTDIR)$(bindir)
244         $(INSTALL) vlc $(DESTDIR)$(bindir)
245 ifneq (,$(ALIASES))
246         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
247 endif
248         mkdir -p $(DESTDIR)$(datadir)/videolan
249         $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
250         $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
251         $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
252
253 vlc-uninstall:
254         rm -f $(DESTDIR)$(bindir)/vlc
255 ifneq (,$(ALIASES))
256         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
257 endif
258         rm -f $(DESTDIR)$(datadir)/videolan/*.psf
259         rm -f $(DESTDIR)$(datadir)/videolan/*.png
260         rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
261
262 plugins-install:
263         mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
264 ifneq (,$(PLUGINS))
265         $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
266 endif
267
268 plugins-uninstall:
269         rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
270
271 libdvdcss-install:
272         -cd extras/libdvdcss && $(MAKE) install
273
274 libdvdcss-uninstall:
275         -cd extras/libdvdcss && $(MAKE) uninstall
276
277 #
278 # Package generation rules
279 #
280 snapshot-common:
281         # Check that tmp isn't in the way
282         @if test -e tmp; then \
283                 echo "Error: please remove ./tmp, it is in the way"; false; \
284         else \
285                 echo "OK."; mkdir tmp; \
286         fi
287         # Copy directory structure in tmp
288         find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
289                 do mkdir -p tmp/vlc/$$i ; \
290         done
291         rm -Rf tmp/vlc/tmp
292         find debian -mindepth 1 -maxdepth 1 -type d | \
293                 while read i ; do rm -Rf tmp/vlc/$$i ; done
294         # Copy .c .h .in .cpp and .glade files
295         find include src plugins -type f -name '*.[chig]*' | while read i ; \
296                 do cp $$i tmp/vlc/$$i ; done
297         # Copy plugin Makefiles
298         find plugins -type f -name Makefile | while read i ; \
299                 do cp $$i tmp/vlc/$$i ; done
300         # Copy extra programs and documentation
301         cp -a extras/* tmp/vlc/extras
302         cp -a doc/* tmp/vlc/doc
303         find tmp/vlc/extras tmp/vlc/doc \
304                 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
305                         while read i ; do rm -Rf $$i ; done
306         # Copy misc files
307         cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
308                 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
309                 configure configure.in install-sh install-win32 vlc.spec \
310                 config.sub config.guess \
311                         tmp/vlc/
312         # Copy Debian control files
313         for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
314                 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
315         for file in control changelog rules ; do \
316                 cp debian/$$file tmp/vlc/debian/ ; done
317         # Copy ipkg control files
318         for file in control rules ; do \
319                 cp ipkg/$$file tmp/vlc/ipkg/ ; done
320         # Copy fonts and icons
321         for file in share/*png share/*xpm share/*psf ; do \
322                 cp $$file tmp/vlc/share ; done
323         for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
324                         cp share/$$file tmp/vlc/share/ ; done
325
326 snapshot: snapshot-common
327         # Build archives
328         F=vlc-${VLC_QUICKVERSION}; \
329         mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
330         bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
331         gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
332         # Clean up
333         rm -Rf tmp
334
335 snapshot-nocss: snapshot-common
336         # Remove libdvdcss
337         rm -Rf tmp/vlc/extras/libdvdcss
338         rm -f tmp/vlc/*.libdvdcss
339         # Fix debian information
340         rm -f tmp/vlc/debian/libdvdcss*
341         rm -f tmp/vlc/debian/control
342         sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
343                 | awk '{if(gsub("Package: libdvdcss",$$0))a=1;if(a==0)print $$0;if(a==1&&$$0=="")a=0}' \
344                 > tmp/vlc/debian/control
345         rm -f tmp/vlc/debian/rules
346         sed -e 's#^\(export LIBDVDCSS_FLAGS=\).*#\1"--without-dvdcss"#' < debian/rules \
347                 | awk '{if($$0=="# libdvdcss start")a=1;if(a==0)print $$0;if($$0=="# libdvdcss stop")a=0}' \
348                 > tmp/vlc/debian/rules
349         chmod +x tmp/vlc/debian/rules
350         # Build css-disabled archives
351         F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
352         mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
353         bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
354         gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
355         # Clean up
356         rm -Rf tmp
357
358 package-win32:
359         # XXX: this rule is probably only useful to you if you have exactly
360         # the same setup as me. Contact sam@zoy.org if you need to use it.
361         #
362         # Check that tmp isn't in the way
363         @if test -e tmp; then \
364                 echo "Error: please remove ./tmp, it is in the way"; false; \
365         else \
366                 echo "OK."; mkdir tmp; \
367         fi
368         # Create installation script
369         sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
370         # Copy relevant files
371         cp vlc.exe plugins/directx.so plugins/gtk.so plugins/sdl.so tmp/ 
372         cp INSTALL-win32.txt AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
373                 README README.libdvdcss FAQ TODO tmp/
374         for file in gtk-1.3.dll gdk-1.3.dll glib-1.3.dll gmodule-1.3.dll \
375                 gnu-intl.dll SDL.dll README-SDL.txt ; \
376                         do cp ../win32-libs/$$file tmp/ ; done
377         mkdir tmp/share
378         for file in default8x16.psf default8x9.psf ; \
379                 do cp share/$$file tmp/share/ ; done
380         # Create package 
381         wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
382         mv tmp/vlc-${VLC_QUICKVERSION}.exe \
383                 vlc-${VLC_QUICKVERSION}-win32-installer.exe
384         # Clean up
385         rm -Rf tmp
386
387 package-beos:
388         # Check that tmp isn't in the way
389         @if test -e tmp; then \
390                 echo "Error: please remove ./tmp, it is in the way"; false; \
391         else \
392                 echo "OK."; mkdir tmp; \
393         fi
394         
395         # Create dir
396         mkdir -p tmp/vlc/share
397         # Copy relevant files
398         cp vlc tmp/vlc/
399         cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
400                 README README.libdvdcss FAQ TODO tmp/vlc/
401         for file in default8x16.psf default8x9.psf ; \
402                 do cp share/$$file tmp/vlc/share/ ; done
403         # Create package 
404         mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
405         (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
406         zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
407         mv tmp/vlc-${VLC_QUICKVERSION}-beos.zip .
408         # Clean up
409         rm -Rf tmp
410
411 libdvdcss-snapshot: snapshot-common
412         # Remove vlc sources and icons, doc, debian directory...
413         rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
414         rm -Rf tmp/vlc/extras/GNUgetopt tmp/vlc/extras/MacOSX
415         rm -Rf tmp/vlc/debian
416         rm -Rf tmp/vlc/ipkg
417         # Remove useless headers
418         rm -f tmp/vlc/include/*
419         for file in defs.h.in config.h.in common.h int_types.h ; \
420                 do cp include/$$file tmp/vlc/include/ ; done
421         # Remove misc files (??? - maybe not really needed)
422         rm -f tmp/vlc/vlc.spec tmp/vlc/INSTALL-win32.txt
423         mv tmp/vlc/INSTALL.libdvdcss tmp/vlc/INSTALL
424         mv tmp/vlc/README.libdvdcss tmp/vlc/README
425         mv tmp/vlc/ChangeLog.libdvdcss tmp/vlc/ChangeLog
426         # Fix Makefile
427         rm -f tmp/vlc/Makefile
428         sed -e 's#^install:#install-unused:#' \
429                 -e 's#^uninstall:#uninstall-unused:#' \
430                 -e 's#^clean:#clean-unused:#' \
431                 -e 's#^all:.*#all: libdvdcss#' \
432                 -e 's#^libdvdcss-install:#install:#' \
433                 -e 's#^libdvdcss-uninstall:#uninstall:#' \
434                 -e 's#^libdvdcss-clean:#clean:#' \
435                 < Makefile > tmp/vlc/Makefile
436         # Build archives
437         F=libdvdcss-${LIBDVDCSS_QUICKVERSION}; \
438         mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
439         bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
440         gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
441         # Clean up
442         rm -Rf tmp
443
444 deb:
445         dpkg-buildpackage -rfakeroot -us -uc
446
447 #
448 # Gtk/Gnome/* aliases and OS X application
449 #
450 gnome-vlc gvlc kvlc qvlc: vlc
451         rm -f $@ && ln -s vlc $@
452
453 .PHONY: vlc.app
454 vlc.app: Makefile.opts
455 ifneq (,$(findstring darwin,$(SYS)))
456         rm -Rf vlc.app
457         cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
458         cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
459         $(INSTALL) -d vlc vlc.app/Contents/MacOS/share
460         $(INSTALL) -d vlc vlc.app/Contents/MacOS/plugins
461         $(INSTALL) vlc vlc.app/Contents/MacOS/
462 ifneq (,$(PLUGINS))
463         $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
464 endif
465         $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
466 endif
467
468 FORCE:
469
470 #
471 # Generic rules (see below)
472 #
473 $(C_DEP): %.d: FORCE
474         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
475
476 $(CPP_DEP): %.dpp: FORCE
477         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
478
479 $(H_OBJ): Makefile.opts Makefile.dep Makefile
480         rm -f $@ && cp $@.in $@
481 ifneq (,$(BUILTINS))
482         for i in $(BUILTINS) ; do \
483                 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
484                 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
485                 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
486         done
487         echo "" >> $@ ;
488         printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
489         for i in $(BUILTINS) ; do \
490                 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
491         done
492         echo "} while( 0 );" >> $@ ;
493         echo "" >> $@ ;
494 endif
495
496 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
497 $(C_OBJ): %.o: .dep/%.d
498 $(C_OBJ): %.o: %.c
499         $(CC) $(CFLAGS) -c -o $@ $<
500
501 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
502 $(CPP_OBJ): %.o: .dep/%.dpp
503 $(CPP_OBJ): %.o: %.cpp
504         $(CC) $(CFLAGS) -c -o $@ $<
505
506 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
507 ifneq (,(findstring mingw32,$(SYS)))
508 $(RESOURCE_OBJ): %.o: %.rc
509         $(WINDRES) -i $< -o $@
510 endif
511
512 #
513 # Main application target
514 #
515 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(VLC_OBJ) $(BUILTIN_OBJ) plugins
516         $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
517 ifeq ($(SYS),beos)
518         xres -o $@ ./share/vlc_beos.rsrc
519         mimeset -f $@
520 endif
521
522 #
523 # Plugins target
524 #
525 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
526 $(PLUGIN_OBJ): FORCE
527         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
528
529 #
530 # Built-in modules target
531 #
532 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
533 $(BUILTIN_OBJ): FORCE
534         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:plugins/%=../%)
535
536 #
537 # libdvdcss target
538 #
539 libdvdcss: Makefile.opts
540         cd extras/libdvdcss && $(MAKE)
541
542 #
543 # libdvdread target
544 #
545 libdvdread: Makefile.opts
546         cd extras/libdvdread && $(MAKE)
547