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