]> git.sesse.net Git - vlc/blob - Makefile
* ./plugins/ogg/*: added preliminary files for an Ogg/Vorbis decoder a
[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/win32 \
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 VLC_QUICKVERSION := $(shell grep '^ *VLC_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 DCFLAGS: $(DCFLAGS)
239         @echo LDFLAGS: $(LDFLAGS)
240         @echo PCFLAGS: $(PCFLAGS)
241         @echo PLDFLAGS: $(PLDFLAGS)
242         @echo C_OBJ: $(C_OBJ)
243         @echo CPP_OBJ: $(CPP_OBJ)
244         @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
245         @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
246
247 #
248 # Cleaning rules
249 #
250 clean: plugins-clean po-clean vlc-clean
251         rm -f src/*/*.o extras/*/*.o
252         rm -f lib/*.so* lib/*.a
253         rm -f plugins/*.so plugins/*.a
254         rm -rf extras/MacOSX/build
255
256 po-clean:
257         -cd po && $(MAKE) clean
258
259 plugins-clean:
260         for dir in $(PLUGINS_DIR) ; do \
261                 ( cd plugins/$${dir} \
262                         && $(MAKE) -f ../../Makefile.modules clean ) ; done
263         rm -f plugins/*/*.o plugins/*/*.lo plugins/*/*.moc plugins/*/*.bak
264
265 vlc-clean:
266         rm -f $(C_OBJ) $(CPP_OBJ)
267         rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
268         rm -Rf vlc.app
269
270 distclean: clean
271         -cd po && $(MAKE) maintainer-clean
272         rm -f **/*.o **/*~ *.log
273         rm -f Makefile.opts
274         rm -f include/defs.h include/modules_builtin.h
275         rm -f src/misc/modules_builtin.h
276         rm -f config*status config*cache config*log
277         rm -f gmon.out core build-stamp
278         rm -Rf .dep
279         rm -f .gdb_history
280
281 #
282 # Install/uninstall rules
283 #
284 install: vlc-install plugins-install po-install
285
286 uninstall: vlc-uninstall plugins-uninstall po-uninstall
287
288 vlc-install:
289         mkdir -p $(DESTDIR)$(bindir)
290         $(INSTALL) vlc $(DESTDIR)$(bindir)
291 ifneq (,$(ALIASES))
292         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
293 endif
294         mkdir -p $(DESTDIR)$(datadir)/videolan
295         $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
296         $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
297         $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
298
299 vlc-uninstall:
300         rm -f $(DESTDIR)$(bindir)/vlc
301 ifneq (,$(ALIASES))
302         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
303 endif
304         rm -f $(DESTDIR)$(datadir)/videolan/*.psf
305         rm -f $(DESTDIR)$(datadir)/videolan/*.png
306         rm -f $(DESTDIR)$(datadir)/videolan/*.xpm
307
308 plugins-install:
309         mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
310 ifneq (,$(PLUGINS))
311         $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
312 endif
313
314 plugins-uninstall:
315         rm -f $(DESTDIR)$(libdir)/videolan/vlc/*.so
316
317 po-install:
318         -cd po && $(MAKE) install
319
320 po-uninstall:
321         -cd po && $(MAKE) uninstall
322
323 #
324 # Package generation rules
325 #
326 snapshot-common:
327         # Check that tmp isn't in the way
328         @if test -e tmp; then \
329                 echo "Error: please remove ./tmp, it is in the way"; false; \
330         else \
331                 echo "OK."; mkdir tmp; \
332         fi
333         # Copy directory structure in tmp
334         find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
335                 do mkdir -p tmp/vlc/$$i ; \
336         done
337         rm -Rf tmp/vlc/tmp
338         find debian -mindepth 1 -maxdepth 1 -type d | \
339                 while read i ; do rm -Rf tmp/vlc/$$i ; done
340         # Copy .c .h .in .cpp and .glade files
341         find include src plugins -type f -name '*.[chig]*' | while read i ; \
342                 do cp $$i tmp/vlc/$$i ; done
343         # Copy plugin Makefiles
344         find plugins -type f -name Makefile | while read i ; \
345                 do cp $$i tmp/vlc/$$i ; done
346         # Copy extra programs and documentation
347         cp -a extras/* tmp/vlc/extras
348         cp -a doc/* tmp/vlc/doc
349         find tmp/vlc/extras tmp/vlc/doc \
350                 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
351                         while read i ; do rm -Rf $$i ; done
352         # Copy gettext stuff
353         cp po/*.po tmp/vlc/po
354         for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
355         # Copy misc files
356         cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
357                 Makefile Makefile.opts.in Makefile.dep Makefile.modules \
358                 configure configure.in install-sh install-win32 vlc.spec \
359                 config.sub config.guess aclocal.m4 mkinstalldirs \
360                         tmp/vlc/
361         # Copy Debian control files
362         for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
363                 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
364         for file in control changelog rules ; do \
365                 cp debian/$$file tmp/vlc/debian/ ; done
366         # Copy ipkg control files
367         for file in control rules ; do \
368                 cp ipkg/$$file tmp/vlc/ipkg/ ; done
369         # Copy fonts and icons
370         for file in share/*png share/*xpm share/*psf ; do \
371                 cp $$file tmp/vlc/share ; done
372         for file in vlc_beos.rsrc vlc.icns gvlc_win32.ico vlc_win32_rc.rc ; do \
373                         cp share/$$file tmp/vlc/share/ ; done
374
375 snapshot: snapshot-common
376         # Build archives
377         F=vlc-${VLC_QUICKVERSION}; \
378         mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$F.tar $$F); \
379         bzip2 -f -9 < tmp/$$F.tar > $$F.tar.bz2; \
380         gzip -f -9 tmp/$$F.tar ; mv tmp/$$F.tar.gz .
381         # Clean up
382         rm -Rf tmp
383
384 snapshot-nocss: snapshot-common
385         # Fix debian information
386         rm -f tmp/vlc/debian/control
387         sed -e 's#^ DVDs# unencrypted DVDs#' < debian/control \
388                 > tmp/vlc/debian/control
389         rm -f tmp/vlc/debian/rules
390         sed -e 's#^\(export DVDCSS_FLAGS=\).*#\1"--enable-dvd --without-dvdcss"#' < debian/rules \
391                 > tmp/vlc/debian/rules
392         chmod +x tmp/vlc/debian/rules
393         # Build css-disabled archives
394         F=vlc-${VLC_QUICKVERSION}; G=vlc-${VLC_QUICKVERSION}-nocss; \
395         mv tmp/vlc tmp/$$F; (cd tmp ; tar cf $$G.tar $$F); \
396         bzip2 -f -9 < tmp/$$G.tar > $$G.tar.bz2; \
397         gzip -f -9 tmp/$$G.tar ; mv tmp/$$G.tar.gz .
398         # Clean up
399         rm -Rf tmp
400
401 package-win32:
402         # XXX: this rule is probably only useful to you if you have exactly
403         # the same setup as me. Contact sam@zoy.org if you need to use it.
404         #
405         # Check that tmp isn't in the way
406         @if test -e tmp; then \
407                 echo "Error: please remove ./tmp, it is in the way"; false; \
408         else \
409                 echo "OK."; mkdir tmp; \
410         fi
411         # Create installation script
412         sed -e 's#@VERSION@#'${VLC_QUICKVERSION}'#' < install-win32 > tmp/nsi
413         # Copy relevant files
414         cp vlc.exe $(PLUGINS:%=plugins/%.so) tmp/ 
415         cp INSTALL.win32 tmp/INSTALL.txt ; unix2dos tmp/INSTALL.txt
416         for file in AUTHORS COPYING ChangeLog README FAQ TODO ; \
417                         do cp $$file tmp/$${file}.txt ; \
418                         unix2dos tmp/$${file}.txt ; done
419         for file in iconv.dll libgmodule-1.3-12.dll libgtk-0.dll libgdk-0.dll \
420                 libgobject-1.3-12.dll libintl-1.dll libglib-1.3-12.dll \
421                 libgthread-1.3-12.dll SDL.dll README-SDL.txt ; \
422                         do cp ${DLL_PATH}/$$file tmp/ ; done
423         mkdir tmp/share
424         for file in default8x16.psf default8x9.psf ; \
425                 do cp share/$$file tmp/share/ ; done
426         # Create package 
427         wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe /CD tmp/nsi
428         mv tmp/vlc-${VLC_QUICKVERSION}.exe \
429                 vlc-${VLC_QUICKVERSION}-win32-installer.exe
430         # Clean up
431         rm -Rf tmp
432
433 package-beos:
434         # Check that tmp isn't in the way
435         @if test -e tmp; then \
436                 echo "Error: please remove ./tmp, it is in the way"; false; \
437         else \
438                 echo "OK."; mkdir tmp; \
439         fi
440         
441         # Create dir
442         mkdir -p tmp/vlc/share
443         # Copy relevant files
444         cp vlc tmp/vlc/
445         cp AUTHORS COPYING ChangeLog README FAQ TODO tmp/vlc/
446         for file in default8x16.psf default8x9.psf ; \
447                 do cp share/$$file tmp/vlc/share/ ; done
448         # Create package 
449         mv tmp/vlc tmp/vlc-${VLC_QUICKVERSION}
450         (cd tmp ; find vlc-${VLC_QUICKVERSION} | \
451         zip -9 -@ vlc-${VLC_QUICKVERSION}-beos.zip )
452         mv tmp/vlc-${VLC_QUICKVERSION}-BeOS-x86.zip .
453         # Clean up
454         rm -Rf tmp
455
456 package-macosx:
457         # Check that tmp isn't in the way
458         @if test -e tmp; then \
459                 echo "Error: please remove ./tmp, it is in the way"; false; \
460         else \
461                 echo "OK."; mkdir tmp; \
462         fi
463
464         # Copy relevant files 
465         cp -R vlc.app tmp/
466         cp AUTHORS COPYING ChangeLog README FAQ TODO tmp/
467
468         # Create disk image 
469         ./macosx-dmg 0 "vlc-${VLC_QUICKVERSION}" tmp/* 
470
471         # Clean up
472         rm -Rf tmp
473
474 deb:
475         dpkg-buildpackage -rfakeroot -us -uc
476
477 #
478 # Gtk/Gnome/* aliases and OS X application
479 #
480 gnome-vlc gvlc kvlc qvlc: vlc
481         rm -f $@ && ln -s vlc $@
482
483 .PHONY: vlc.app
484 vlc.app: vlc plugins
485 ifneq (,$(findstring darwin,$(SYS)))
486         rm -Rf vlc.app
487         cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t'
488         cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
489         $(INSTALL) -d vlc.app/Contents/MacOS/share
490         $(INSTALL) -d vlc.app/Contents/MacOS/plugins
491         $(INSTALL) vlc vlc.app/Contents/MacOS/
492 ifneq (,$(PLUGINS))
493         $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
494 endif
495         $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
496 endif
497
498 FORCE:
499
500 #
501 # Generic rules (see below)
502 #
503 $(H_OBJ): Makefile.opts Makefile.dep Makefile
504 #       @echo "regenerating $@"
505         @rm -f $@ && cp $@.in $@
506 ifneq (,$(BUILTINS))
507         @for i in $(BUILTINS) ; do \
508                 echo "int InitModule__MODULE_"$$i"( module_t* );" >>$@; \
509                 echo "int ActivateModule__MODULE_"$$i"( module_t* );" >>$@; \
510                 echo "int DeactivateModule__MODULE_"$$i"( module_t* );" >>$@; \
511         done
512         @echo "" >> $@ ;
513 endif
514         @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
515         @echo "    do \\" >> $@ ;
516         @echo "    { \\" >> $@ ;
517 ifneq (,$(BUILTINS))
518         @for i in $(BUILTINS) ; do \
519                 echo "        ALLOCATE_BUILTIN("$$i"); \\" >> $@ ; \
520         done
521 endif
522         @echo "    } while( 0 );" >> $@ ;
523         @echo "" >> $@ ;
524
525 $(C_DEP): %.d: FORCE
526         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
527
528 $(CPP_DEP): %.dpp: FORCE
529         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
530
531 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
532 $(C_OBJ): %.o: $(H_OBJ)
533 $(C_OBJ): %.o: .dep/%.d
534 $(C_OBJ): %.o: %.c
535         $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
536
537 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
538 $(CPP_OBJ): %.o: $(H_OBJ)
539 $(CPP_OBJ): %.o: .dep/%.dpp
540 $(CPP_OBJ): %.o: %.cpp
541         $(CC) $(CFLAGS) $(CFLAGS_VLC) -c -o $@ $<
542
543 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
544 ifneq (,(findstring mingw32,$(SYS)))
545 $(RESOURCE_OBJ): %.o: %.rc
546         $(WINDRES) -i $< -o $@
547 endif
548
549 #
550 # Main application target
551 #
552 vlc: Makefile.opts Makefile.dep Makefile $(VLC_OBJ) $(BUILTIN_OBJ)
553         $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) $(BUILTIN_OBJ) $(LDFLAGS) $(LIB_VLC) $(LIB_BUILTINS) $(LIB_COMMON)
554 ifeq ($(SYS),beos)
555         xres -o $@ ./share/vlc_beos.rsrc
556         mimeset -f $@
557 endif
558
559 #
560 # Plugins target
561 #
562 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
563 $(PLUGIN_OBJ): FORCE
564         @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
565
566 #
567 # Built-in modules target
568 #
569 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
570 $(BUILTIN_OBJ): FORCE
571         @cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) -f ../../Makefile.modules $(@:plugins/%=../%)
572
573 #
574 # gettext target
575 #
576 po: FORCE
577         @cd po && $(MAKE)
578