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