]> git.sesse.net Git - vlc/blob - Makefile
* ./doc/developer/decoders.xml: fixed a typo preventing compilation.
[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 :=  a52 \
17                 aa \
18                 ac3_adec \
19                 ac3_spdif \
20                 access \
21                 alsa \
22                 arts \
23                 beos \
24                 chroma \
25                 directx \
26                 downmix \
27                 dsp \
28                 dummy \
29                 dvd \
30                 dvdread \
31                 esd \
32                 fb \
33                 filter \
34                 fx \
35                 ggi \
36                 glide \
37                 gtk \
38                 idct \
39                 imdct \
40                 kde \
41                 lirc \
42                 lpcm_adec \
43                 macosx \
44                 mad \
45                 memcpy \
46                 mga \
47                 motion \
48                 mpeg_system \
49                 mpeg_adec \
50                 mpeg_vdec \
51                 network \
52                 ogg \
53                 qnx \
54                 qt \
55                 satellite \
56                 sdl \
57                 spudec \
58                 text \
59                 vcd \
60                 win32 \
61                 x11
62
63 PLUGINS_TARGETS := a52/a52 \
64                 aa/aa \
65                 ac3_adec/ac3_adec \
66                 ac3_spdif/ac3_spdif \
67                 access/file \
68                 access/udp \
69                 access/http \
70                 alsa/alsa \
71                 arts/arts \
72                 beos/beos \
73                 chroma/chroma_i420_rgb \
74                 chroma/chroma_i420_rgb_mmx \
75                 chroma/chroma_i420_yuy2 \
76                 chroma/chroma_i420_yuy2_mmx \
77                 chroma/chroma_i422_yuy2 \
78                 chroma/chroma_i422_yuy2_mmx \
79                 chroma/chroma_i420_ymga \
80                 chroma/chroma_i420_ymga_mmx \
81                 directx/directx \
82                 downmix/downmix \
83                 downmix/downmixsse \
84                 downmix/downmix3dn \
85                 dsp/dsp \
86                 dummy/dummy \
87                 dummy/null \
88                 dvd/dvd \
89                 dvdread/dvdread \
90                 esd/esd \
91                 fb/fb \
92                 filter/filter_deinterlace \
93                 filter/filter_transform \
94                 filter/filter_invert \
95                 filter/filter_distort \
96                 filter/filter_wall \
97                 fx/fx_scope \
98                 ggi/ggi \
99                 glide/glide \
100                 gtk/gnome \
101                 gtk/gtk \
102                 idct/idct \
103                 idct/idctclassic \
104                 idct/idctmmx \
105                 idct/idctmmxext \
106                 idct/idctaltivec \
107                 imdct/imdct \
108                 imdct/imdct3dn \
109                 imdct/imdctsse \
110                 kde/kde \
111                 lirc/lirc \
112                 lpcm_adec/lpcm_adec \
113                 macosx/macosx \
114                 mad/mad \
115                 memcpy/memcpy \
116                 memcpy/memcpymmx \
117                 memcpy/memcpymmxext \
118                 memcpy/memcpy3dn \
119                 memcpy/memcpyaltivec \
120                 mga/mga \
121                 mga/xmga \
122                 motion/motion \
123                 motion/motionmmx \
124                 motion/motionmmxext \
125                 motion/motion3dnow \
126                 motion/motionaltivec \
127                 mpeg_system/mpeg_es \
128                 mpeg_system/mpeg_ps \
129                 mpeg_system/mpeg_ts \
130                 mpeg_adec/mpeg_adec \
131                 mpeg_vdec/mpeg_vdec \
132                 network/ipv4 \
133                 network/ipv6 \
134                 ogg/vorbis \
135                 qnx/qnx \
136                 qt/qt \
137                 satellite/satellite \
138                 sdl/sdl \
139                 spudec/spudec \
140                 text/logger \
141                 text/ncurses \
142                 text/rc \
143                 vcd/vcd \
144                 win32/waveout \
145                 win32/intfwin \
146                 x11/x11 \
147                 x11/xvideo
148
149 #
150 # C Objects
151
152 INTERFACE := main interface intf_msg intf_playlist intf_eject
153 INPUT := input input_ext-plugins input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
154 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
155 AUDIO_OUTPUT := audio_output aout_ext-dec aout_pcm aout_spdif
156 MISC := mtime modules configuration netutils iso_lang
157
158 C_OBJ :=        $(INTERFACE:%=src/interface/%.o) \
159                 $(INPUT:%=src/input/%.o) \
160                 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
161                 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
162                 $(MISC:%=src/misc/%.o)
163
164 #
165 # Misc Objects
166
167 ifeq ($(NEED_GETOPT),1)
168 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o 
169 endif
170
171 ifeq ($(NEED_SYMBOLS),1)
172 C_OBJ += src/misc/symbols.o
173 endif
174
175 ifeq ($(SYS),beos)
176 CPP_OBJ :=      src/misc/beos_specific.o
177 endif
178
179 ifneq (,$(findstring darwin,$(SYS)))
180 C_OBJ +=        src/misc/darwin_specific.o
181 endif
182
183 ifneq (,$(findstring mingw32,$(SYS)))
184 C_OBJ +=        src/misc/win32_specific.o
185 RESOURCE_OBJ := share/vlc_win32_rc.o
186 endif
187
188 VLC_OBJ := $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
189
190 #
191 # Generated header
192 #
193 H_OBJ :=        src/misc/modules_builtin.h
194
195 #
196 # Other lists of files
197 #
198 C_DEP := $(C_OBJ:%.o=.dep/%.d)
199 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
200
201 #
202 # Translate plugin names
203 #
204 ifneq (,$(PLUGINS))
205 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.so@' -e 's@^ .*@@' ; done)
206 endif
207 ifneq (,$(BUILTINS))
208 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@plugins/\1.a@' -e 's@^ .*@@' ; done)
209 endif
210
211 #
212 # Misc variables
213 #
214 VERSION := $(shell grep '^ *VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
215
216 # All symbols must be exported
217 export
218
219 ###############################################################################
220 # Targets
221 ###############################################################################
222
223 #
224 # Virtual targets
225 #
226 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po
227
228 Makefile.opts:
229         @echo "**** No configuration found, please run ./configure"
230         @exit 1
231 #       ./configure
232 #       $(MAKE) $(MAKECMDGOALS)
233 #       exit    
234
235 show:
236         @echo CC: $(CC)
237         @echo CFLAGS: $(CFLAGS)
238         @echo LDFLAGS: $(LDFLAGS)
239         @echo plugins_CFLAGS: $(plugins_CFLAGS)
240         @echo plugins_LDFLAGS: $(plugins_LDFLAGS)
241         @echo builtins_CFLAGS: $(builtins_CFLAGS)
242         @echo builtins_LDFLAGS: $(builtins_LDFLAGS)
243         @echo C_OBJ: $(C_OBJ)
244         @echo CPP_OBJ: $(CPP_OBJ)
245         @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
246         @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
247
248 #
249 # Cleaning rules
250 #
251 clean: plugins-clean po-clean vlc-clean
252         rm -f src/*/*.o extras/*/*.o
253         rm -f lib/*.so* lib/*.a
254         rm -f plugins/*.so plugins/*.a plugins/*.lib plugins/*.tds
255         rm -rf extras/MacOSX/build
256
257 po-clean:
258         -cd po && $(MAKE) clean
259
260 plugins-clean:
261         for dir in $(PLUGINS_DIR) ; do \
262                 ( cd plugins/$${dir} \
263                         && $(MAKE) -f ../../Makefile.modules clean ) ; done
264         rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
265
266 vlc-clean:
267         rm -f $(C_OBJ) $(CPP_OBJ)
268         rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
269         rm -Rf vlc.app
270
271 distclean: clean
272         -cd po && $(MAKE) maintainer-clean
273         rm -f **/*.o **/*~ *.log
274         rm -f Makefile.opts
275         rm -f include/defs.h include/modules_builtin.h
276         rm -f src/misc/modules_builtin.h
277         rm -f config*status config*cache config*log conftest*
278         rm -f gmon.out core build-stamp
279         rm -Rf .dep
280         rm -f .gdb_history
281
282 #
283 # Install/uninstall rules
284 #
285 install: vlc-install plugins-install po-install
286
287 uninstall: vlc-uninstall plugins-uninstall po-uninstall
288
289 vlc-install:
290         mkdir -p $(DESTDIR)$(bindir)
291         $(INSTALL) vlc $(DESTDIR)$(bindir)
292 ifneq (,$(ALIASES))
293         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
294 endif
295         mkdir -p $(DESTDIR)$(datadir)/videolan
296         $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
297         $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
298         $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
299
300 vlc-uninstall:
301         rm -f $(DESTDIR)$(bindir)/vlc
302 ifneq (,$(ALIASES))
303         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
304 endif
305         rm -f $(DESTDIR)$(datadir)/videolan/*.psf
306         rm -f $(DESTDIR)$(datadir)/videolan/*.png
307         rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
308
309 plugins-install:
310         mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
311 ifneq (,$(PLUGINS))
312         $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
313 endif
314
315 plugins-uninstall:
316         rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
317
318 po-install:
319         -cd po && $(MAKE) install
320
321 po-uninstall:
322         -cd po && $(MAKE) uninstall
323
324 #
325 # Package generation rules
326 #
327 dist:
328         # Check that tmp isn't in the way
329         @if test -e tmp; then \
330                 echo "Error: please remove ./tmp, it is in the way"; false; \
331         else \
332                 echo "OK."; mkdir tmp; \
333         fi
334         # Copy directory structure in tmp
335         find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
336                 do mkdir -p tmp/vlc/$$i ; \
337         done
338         rm -Rf tmp/vlc/tmp
339         find debian -mindepth 1 -maxdepth 1 -type d | \
340                 while read i ; do rm -Rf tmp/vlc/$$i ; done
341         # Copy .c .h .in .cpp and .glade files
342         find include src plugins -type f -name '*.[bcdhigrst]*' | while read i ; \
343                 do cp $$i tmp/vlc/$$i ; done
344         # Grmbl... special case...
345         for i in API BUGS DESIGN TODO ; \
346                 do cp plugins/mad/$$i tmp/vlc/plugins/mad ; done
347         # Copy plugin Makefiles
348         find plugins -type f -name Makefile | while read i ; \
349                 do cp $$i tmp/vlc/$$i ; done
350         # Copy extra programs and documentation
351         cp -a extras/* tmp/vlc/extras
352         cp -a doc/* tmp/vlc/doc
353         find tmp/vlc/extras tmp/vlc/doc \
354                 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
355                         while read i ; do rm -Rf $$i ; done
356         # Copy gettext stuff
357         cp po/ChangeLog po/vlc.pot po/*.po tmp/vlc/po
358         for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
359         # Copy misc files
360         cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
361                 ABOUT-NLS BUGS MODULES vlc.spec \
362                 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
363                 configure configure.in install-sh install-win32 macosx-dmg \
364                 config.sub config.guess aclocal.m4 mkinstalldirs \
365                         tmp/vlc/
366         # Copy Debian control files
367         for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
368                 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
369         for file in control changelog rules ; do \
370                 cp debian/$$file tmp/vlc/debian/ ; done
371         # Copy ipkg control files
372         for file in control rules patch ; do \
373                 cp ipkg/$$file tmp/vlc/ipkg/ ; done
374         # Copy fonts and icons
375         for file in share/*vlc* share/*psf; do \
376                 cp $$file tmp/vlc/share ; done
377         # Build archives
378         F=vlc-${VERSION}; \
379         mv tmp/vlc tmp/$$F; (cd tmp ; tar czf ../$$F.tar.gz $$F); \
380         # Clean up
381         rm -Rf tmp
382
383 package-win32:
384         # XXX: this rule is probably only useful to you if you have exactly
385         # the same setup as me. Contact sam@zoy.org if you need to use it.
386         #
387         # Check that tmp isn't in the way
388         @if test -e tmp; then \
389                 echo "Error: please remove ./tmp, it is in the way"; false; \
390         else \
391                 echo "OK."; mkdir tmp; \
392         fi
393         # Create installation script
394         cp install-win32 tmp/nsi
395         # Copy relevant files
396         cp vlc.exe tmp/ 
397         $(STRIP) tmp/vlc.exe
398         cp INSTALL.win32 tmp/INSTALL.txt ; unix2dos tmp/INSTALL.txt
399         for file in AUTHORS COPYING ChangeLog README FAQ TODO ; \
400                         do cp $$file tmp/$${file}.txt ; \
401                         unix2dos tmp/$${file}.txt ; done
402         mkdir tmp/plugins
403         cp $(PLUGINS:%=plugins/%.so) tmp/plugins/ 
404         # don't include these two
405         #rm -f tmp/plugins/gtk.so tmp/plugins/sdl.so
406         $(STRIP) $(PLUGINS:%=tmp/plugins/%.so)
407         mkdir tmp/share
408         for file in default8x16.psf default8x9.psf ; \
409                 do cp share/$$file tmp/share/ ; done
410         # Create package 
411         wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe -- /DVERSION=${VERSION} /CD tmp/nsi
412         # Clean up
413         rm -Rf tmp
414
415 package-beos:
416         # Check that tmp isn't in the way
417         @if test -e tmp; then \
418                 echo "Error: please remove ./tmp, it is in the way"; false; \
419         else \
420                 echo "OK."; mkdir tmp; \
421         fi
422         
423         # Create dir
424         mkdir -p tmp/vlc/share
425         # Copy relevant files
426         cp vlc tmp/vlc/
427         strip tmp/vlc/vlc
428         cp AUTHORS COPYING ChangeLog README FAQ TODO tmp/vlc/
429         for file in default8x16.psf default8x9.psf ; \
430                 do cp share/$$file tmp/vlc/share/ ; done
431         mkdir tmp/vlc/plugins
432         cp $(PLUGINS:%=plugins/%.so) tmp/vlc/plugins/ 
433         strip $(PLUGINS:%=tmp/vlc/plugins/%.so)
434         # Create package 
435         mv tmp/vlc tmp/vlc-${VERSION}
436         (cd tmp ; find vlc-${VERSION} | \
437         zip -9 -@ vlc-${VERSION}-BeOS-x86.zip )
438         mv tmp/vlc-${VERSION}-BeOS-x86.zip .
439         # Clean up
440         rm -Rf tmp
441
442 package-macosx:
443         # Check that tmp isn't in the way
444         @if test -e tmp; then \
445                 echo "Error: please remove ./tmp, it is in the way"; false; \
446         else \
447                 echo "OK."; mkdir tmp; \
448         fi
449
450         # Copy relevant files 
451         cp -R vlc.app tmp/
452         cp AUTHORS COPYING ChangeLog README FAQ TODO tmp/
453
454         # Create disk image 
455         ./macosx-dmg 0 "vlc-${VERSION}" tmp/* 
456
457         # Clean up
458         rm -Rf tmp
459
460 #
461 # Gtk/Gnome/* aliases and OS X application
462 #
463 gnome-vlc gvlc kvlc qvlc: vlc
464         rm -f $@ && ln -s vlc $@
465
466 .PHONY: vlc.app
467 vlc.app: vlc plugins
468 ifneq (,$(findstring darwin,$(SYS)))
469         rm -Rf vlc.app
470         cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
471         cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
472         $(INSTALL) -d vlc.app/Contents/MacOS/share
473         $(INSTALL) -d vlc.app/Contents/MacOS/plugins
474         $(INSTALL) vlc vlc.app/Contents/MacOS/
475 ifneq (,$(PLUGINS))
476         $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
477 endif
478         $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
479 endif
480
481 FORCE:
482
483 #
484 # Generic rules (see below)
485 #
486 $(H_OBJ): Makefile.opts Makefile.dep Makefile
487 #       @echo "regenerating $@"
488         @rm -f $@ && cp $@.in $@
489 ifneq (,$(BUILTINS))
490         @for i in $(BUILTINS) ; do \
491                 echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \
492                 echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \
493                 echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \
494         done
495         @echo "" >> $@ ;
496 endif
497         @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
498         @echo "    do \\" >> $@ ;
499         @echo "    { \\" >> $@ ;
500 ifneq (,$(BUILTINS))
501         @for i in $(BUILTINS) ; do \
502                 echo "        ALLOCATE_BUILTIN("$$i"); \\" >> $@ ; \
503         done
504 endif
505         @echo "    } while( 0 );" >> $@ ;
506         @echo "" >> $@ ;
507
508 $(C_DEP): %.d: FORCE
509         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
510
511 $(CPP_DEP): %.dpp: FORCE
512         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
513
514 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
515 $(C_OBJ): %.o: $(H_OBJ)
516 $(C_OBJ): %.o: .dep/%.d
517 $(C_OBJ): %.o: %.c
518         $(CC) $(CFLAGS) $(vlc_CFLAGS) -c -o $@ $<
519
520 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
521 $(CPP_OBJ): %.o: $(H_OBJ)
522 $(CPP_OBJ): %.o: .dep/%.dpp
523 $(CPP_OBJ): %.o: %.cpp
524         $(CC) $(CFLAGS) $(vlc_CFLAGS) -c -o $@ $<
525
526 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
527 ifneq (,(findstring mingw32,$(SYS)))
528 $(RESOURCE_OBJ): %.o: %.rc
529         $(WINDRES) -i $< -o $@
530 endif
531
532 #
533 # Main application target
534 #
535 vlc: Makefile.opts Makefile.dep Makefile $(VLC_OBJ) $(BUILTIN_OBJ)
536         $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS) $(vlc_LDFLAGS) $(builtins_LDFLAGS)
537 ifeq ($(SYS),beos)
538         xres -o $@ ./share/vlc_beos.rsrc
539         mimeset -f $@
540 endif
541
542 #
543 # Plugins target
544 #
545 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
546 $(PLUGIN_OBJ): FORCE
547         @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
548
549 #
550 # Built-in modules target
551 #
552 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
553 $(BUILTIN_OBJ): FORCE
554         @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
555
556 #
557 # gettext target
558 #
559 po: FORCE
560         @cd po && $(MAKE)
561