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