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