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