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