]> git.sesse.net Git - vlc/blob - Makefile
-new audio output using direct ac3 pass-through with some sound
[vlc] / Makefile
1 ###############################################################################
2 # vlc (VideoLAN Client) main Makefile - (c)1998 VideoLAN
3 ###############################################################################
4
5 -include Makefile.opts
6
7 ###############################################################################
8 # Objects and files
9 ###############################################################################
10
11
12 # All possible plugin directories, needed for make clean
13 #
14 PLUGINS_DIR :=  alsa beos darwin dsp dummy \
15                 dvd esd fb ggi glide gnome gtk \
16                 idct \
17                 macosx mga \
18                 motion \
19                 mpeg null qt sdl \
20                 text x11 yuv
21
22 #
23 # All possible plugin objects
24 #
25 PLUGINS_TARGETS := alsa/alsa beos/beos darwin/darwin dsp/dsp dummy/dummy \
26                 dvd/dvd esd/esd fb/fb ggi/ggi glide/glide gnome/gnome gtk/gtk \
27                 idct/idct idct/idctclassic idct/idctmmx idct/idctmmxext \
28                 macosx/macosx mga/mga \
29                 motion/motion motion/motionmmx motion/motionmmxext \
30                 mpeg/es mpeg/ps mpeg/ts null/null qt/qt sdl/sdl \
31                 text/ncurses text/rc x11/x11 x11/xvideo yuv/yuv yuv/yuvmmx
32
33 #
34 # C Objects
35
36 INTERFACE =     src/interface/main.o \
37                 src/interface/interface.o \
38                 src/interface/intf_msg.o \
39                 src/interface/intf_cmd.o \
40                 src/interface/intf_ctrl.o \
41                 src/interface/intf_playlist.o \
42                 src/interface/intf_channels.o \
43                 src/interface/intf_console.o \
44                 src/interface/intf_urldecode.o \
45
46 INPUT =         src/input/input_ext-dec.o \
47                 src/input/input_ext-intf.o \
48                 src/input/input_dec.o \
49                 src/input/input_programs.o \
50                 src/input/input_netlist.o \
51                 src/input/input_clock.o \
52                 src/input/input.o \
53                 src/input/mpeg_system.o
54
55 AUDIO_OUTPUT =  src/audio_output/audio_output.o \
56                 src/audio_output/aout_fifo.o \
57                 src/audio_output/aout_u8.o \
58                 src/audio_output/aout_s8.o \
59                 src/audio_output/aout_u16.o \
60                 src/audio_output/aout_s16.o \
61         src/audio_output/aout_spdif.o
62
63 VIDEO_OUTPUT =  src/video_output/video_output.o \
64                 src/video_output/video_text.o \
65                 src/video_output/video_spu.o \
66                 src/video_output/video_yuv.o
67
68 AC3_DECODER =   src/ac3_decoder/ac3_decoder_thread.o \
69                 src/ac3_decoder/ac3_decoder.o \
70                 src/ac3_decoder/ac3_parse.o \
71                 src/ac3_decoder/ac3_exponent.o \
72                 src/ac3_decoder/ac3_bit_allocate.o \
73                 src/ac3_decoder/ac3_mantissa.o \
74                 src/ac3_decoder/ac3_rematrix.o \
75                 src/ac3_decoder/ac3_imdct.o \
76                 src/ac3_decoder/ac3_downmix.o \
77                 src/ac3_decoder/ac3_downmix_c.o
78
79 AC3_SPDIF = src/ac3_spdif/ac3_spdif.o \
80         src/ac3_spdif/ac3_iec958.o
81
82 LPCM_DECODER =  src/lpcm_decoder/lpcm_decoder_thread.o \
83                 src/lpcm_decoder/lpcm_decoder.o
84
85 AUDIO_DECODER = src/audio_decoder/audio_decoder.o \
86                 src/audio_decoder/adec_generic.o \
87                 src/audio_decoder/adec_layer1.o \
88                 src/audio_decoder/adec_layer2.o \
89                 src/audio_decoder/adec_math.o
90
91 SPU_DECODER =   src/spu_decoder/spu_decoder.o
92
93 #GEN_DECODER =  src/generic_decoder/generic_decoder.o
94
95 VIDEO_PARSER =  src/video_parser/video_parser.o \
96                 src/video_parser/vpar_headers.o \
97                 src/video_parser/vpar_blocks.o \
98                 src/video_parser/vpar_synchro.o \
99                 src/video_parser/video_fifo.o
100
101 VIDEO_DECODER = src/video_decoder/video_decoder.o
102
103 MISC =          src/misc/mtime.o \
104                 src/misc/tests.o \
105                 src/misc/rsc_files.o \
106                 src/misc/modules.o \
107                 src/misc/netutils.o
108
109 C_OBJ =         $(INTERFACE) \
110                 $(INPUT) \
111                 $(VIDEO_OUTPUT) \
112                 $(AUDIO_OUTPUT) \
113                 $(AC3_DECODER) \
114         $(AC3_SPDIF) \
115                 $(LPCM_DECODER) \
116                 $(AUDIO_DECODER) \
117                 $(SPU_DECODER) \
118                 $(GEN_DECODER) \
119                 $(VIDEO_PARSER) \
120                 $(VIDEO_DECODER) \
121                 $(MISC)
122
123 #
124 # Misc Objects
125
126 ifeq ($(GETOPT),1)
127 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o 
128 endif
129
130 ifeq ($(SYS),beos)
131 CPP_OBJ =       src/misc/beos_specific.o
132 endif
133
134 ifneq (,$(findstring darwin,$(SYS)))
135 C_OBJ +=        src/misc/darwin_specific.o
136 endif
137
138 #
139 # Generated header
140 #
141 H_OBJ =         include/modules_builtin.h
142
143 #
144 # Other lists of files
145 #
146 C_DEP := $(C_OBJ:%.o=.dep/%.d)
147 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
148
149 #
150 # Translate plugin names
151 #
152 ifneq (,$(PLUGINS))
153 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@lib/\1.so@' -e 's@^ .*@@' ; done)
154 endif
155 ifneq (,$(BUILTINS))
156 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@lib/\1.a@' -e 's@^ .*@@' ; done)
157 endif
158
159 # All symbols must be exported
160 export
161
162 ###############################################################################
163 # Targets
164 ###############################################################################
165
166 #
167 # Virtual targets
168 #
169 all: vlc ${ALIASES} plugins vlc.app
170
171 clean:
172         for dir in $(PLUGINS_DIR) ; do \
173                 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
174         rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
175         rm -f $(C_OBJ) $(CPP_OBJ)
176         rm -f src/*/*.o extras/*/*.o
177         rm -f lib/*.so lib/*.a vlc gnome-vlc gvlc kvlc qvlc
178         rm -Rf vlc.app
179
180 distclean: clean
181         rm -f **/*.o **/*~ *.log
182         rm -f Makefile.opts
183         rm -f include/defs.h include/config.h include/modules_builtin.h
184         rm -f config*status config*cache config*log
185         rm -f gmon.out core build-stamp
186         rm -Rf .dep
187         rm -f .gdb_history
188
189 install:
190         mkdir -p $(DESTDIR)$(bindir)
191         $(INSTALL) vlc $(DESTDIR)$(bindir)
192 ifneq (,$(ALIASES))
193         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
194 endif
195         mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
196 ifneq (,$(PLUGINS))
197         $(INSTALL) -m 644 $(PLUGINS:%=lib/%.so) $(DESTDIR)$(libdir)/videolan/vlc
198 endif
199         mkdir -p $(DESTDIR)$(datadir)/videolan
200         $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
201         $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
202         $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
203
204 show:
205         @echo CC: $(CC)
206         @echo CFLAGS: $(CFLAGS)
207         @echo DCFLAGS: $(DCFLAGS)
208         @echo LCFLAGS: $(LCFLAGS)
209         @echo C_OBJ: $(C_OBJ)
210         @echo CPP_OBJ: $(CPP_OBJ)
211         @echo objects: $(objects)
212         @echo cppobjects: $(cppobjects)
213         @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
214         @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
215
216
217 # ugliest of all, but I have no time to do it -- sam
218 snapshot: Makefile.opts
219         rm -Rf /tmp/vlc-${PROGRAM_VERSION}* /tmp/vlc-${PROGRAM_VERSION}nocss*
220         # copy archive in /tmp
221         find -type d | grep -v CVS | grep -v '\.dep' | while read i ; \
222                 do mkdir -p /tmp/vlc-${PROGRAM_VERSION}/$$i ; \
223         done
224         find debian -mindepth 1 -maxdepth 1 -type d | \
225                 while read i ; do rm -Rf /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
226         # .c .h .in .cpp .glade
227         find include src plugins -type f -name '*.[chig]*' | while read i ; \
228                 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
229         # Makefiles
230         find . plugins -type f -name Makefile | while read i ; \
231                 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
232         # extra files
233         cp -a extras/* /tmp/vlc-${PROGRAM_VERSION}/extras
234         cp -a doc/* /tmp/vlc-${PROGRAM_VERSION}/doc
235         find /tmp/vlc-${PROGRAM_VERSION}/extras \
236                 /tmp/vlc-${PROGRAM_VERSION}/doc \
237                 -type d -name CVS | while read i ; \
238                         do rm -Rf $$i ; \
239                 done
240         # copy misc files
241         cp vlc.spec AUTHORS COPYING ChangeLog INSTALL README TODO todo.pl \
242                 Makefile.opts.in Makefile.dep Makefile.modules \
243                 configure configure.in install-sh config.sub config.guess \
244                         /tmp/vlc-${PROGRAM_VERSION}/
245         for file in control control-css vlc-gtk.menu vlc.copyright vlc.docs \
246                 changelog changelog-css rules rules-css vlc.dirs vlc.desktop \
247                 gvlc.desktop gnome-vlc.desktop vlc.menu ; do \
248                         cp debian/$$file /tmp/vlc-${PROGRAM_VERSION}/debian/ ; \
249                 done
250         for file in default8x16.psf default8x9.psf vlc_beos.rsrc vlc.icns ; do \
251                 cp share/$$file /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
252         for icon in vlc gvlc qvlc gnome-vlc kvlc ; do \
253                 cp share/$$icon.xpm share/$$icon.png \
254                         /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
255
256         # build css-enabled archives
257         (cd /tmp ; tar cf vlc-${PROGRAM_VERSION}.tar vlc-${PROGRAM_VERSION} ; \
258                 bzip2 -f -9 < vlc-${PROGRAM_VERSION}.tar \
259                         > vlc-${PROGRAM_VERSION}.tar.bz2 ; \
260                 gzip -f -9 vlc-${PROGRAM_VERSION}.tar )
261         mv /tmp/vlc-${PROGRAM_VERSION}.tar.gz \
262                 /tmp/vlc-${PROGRAM_VERSION}.tar.bz2 ..
263
264         # clean up
265         rm -Rf /tmp/vlc-${PROGRAM_VERSION}*
266
267 .PHONY: vlc.app
268 vlc.app:
269 ifneq (,$(findstring darwin,$(SYS)))
270         rm -Rf vlc.app
271         mkdir -p vlc.app/Contents/Resources
272         mkdir -p vlc.app/Contents/MacOS/lib
273         mkdir -p vlc.app/Contents/MacOS/share
274         $(INSTALL) -m 644 extras/MacOSX_app/Contents/Info.plist vlc.app/Contents/
275         $(INSTALL) -m 644 extras/MacOSX_app/Contents/PkgInfo vlc.app/Contents/
276         $(INSTALL) vlc vlc.app/Contents/MacOS/
277         $(INSTALL) share/vlc.icns vlc.app/Contents/Resources/
278 ifneq (,$(PLUGINS))
279         $(INSTALL) $(PLUGINS:%=lib/%.so) vlc.app/Contents/MacOS/lib
280 endif
281         $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
282 endif
283
284 FORCE:
285
286 #
287 # GTK/Gnome aliases - don't add too many aliases which could bloat
288 # the namespace
289 #
290 gnome-vlc gvlc kvlc qvlc: vlc
291         rm -f $@ && ln -s vlc $@
292
293 #
294 # Generic rules (see below)
295 #
296 $(C_DEP): %.d: FORCE
297         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
298
299 $(CPP_DEP): %.dpp: FORCE
300         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
301
302 $(H_OBJ): Makefile.opts Makefile.dep Makefile
303         rm -f $@ && cp $@.in $@
304 ifneq (,$(BUILTINS))
305         for i in $(BUILTINS) ; do \
306                 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
307                 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
308                 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
309         done
310 endif
311         echo "" >> $@ ;
312         printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
313 ifneq (,$(BUILTINS))
314         for i in $(BUILTINS) ; do \
315                 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
316         done
317 endif
318         echo "} while( 0 );" >> $@ ;
319         echo "" >> $@ ;
320
321 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
322 $(C_OBJ): %.o: .dep/%.d
323 $(C_OBJ): %.o: %.c
324 ifneq (,$(findstring darwin,$(SYS)))
325 #this is uglier of all
326         @if test "src/ac3_decoder/ac3_imdct.c" = "$<"; then $(CC) `echo $(CFLAGS) | sed -e 's/-O3/-O/'` -c -o $@ $<; echo "(CC) `echo $(CFLAGS) | sed -e 's/-O3/-O/'` -c -o $@ $<"; else $(CC) $(CFLAGS) -c -o $@ $<; echo "$(CC) $(CFLAGS) -c -o $@ $<"; fi
327 else
328         $(CC) $(CFLAGS) -c -o $@ $<
329 endif
330
331 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
332 $(CPP_OBJ): %.o: .dep/%.dpp
333 $(CPP_OBJ): %.o: %.cpp
334         $(CC) $(CFLAGS) -c -o $@ $<
335
336 #
337 # Main application target
338 #
339 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ)
340         $(CC) $(CFLAGS) -o $@ $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
341 ifeq ($(SYS),beos)
342         rm -f ./lib/_APP_
343         ln -s ../vlc ./lib/_APP_
344         xres -o $@ ./share/vlc_beos.rsrc
345         mimeset -f $@
346 endif
347
348 #
349 # Plugins target
350 #
351 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
352 $(PLUGIN_OBJ): FORCE
353         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
354
355 #
356 # Built-in modules target
357 #
358 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
359 $(BUILTIN_OBJ): FORCE
360         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
361         $(RANLIB) $@
362