* Fixed the continuous 'seeking position' bug in network mode.
[vlc.git] / Makefile
blobf79a6b9aa57bbd25ab6c9b5acfc1d63bf499a665
1 ###############################################################################
2 # vlc (VideoLAN Client) main Makefile - (c)1998 VideoLAN
3 ###############################################################################
5 -include Makefile.opts
7 ###############################################################################
8 # Objects and files
9 ###############################################################################
12 # All possible plugin directories, needed for make clean
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
23 # All possible plugin objects
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
34 # C Objects
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 \
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
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
62 VIDEO_OUTPUT = src/video_output/video_output.o \
63 src/video_output/video_text.o \
64 src/video_output/video_spu.o \
65 src/video_output/video_yuv.o
67 AC3_DECODER = src/ac3_decoder/ac3_decoder_thread.o \
68 src/ac3_decoder/ac3_decoder.o \
69 src/ac3_decoder/ac3_parse.o \
70 src/ac3_decoder/ac3_exponent.o \
71 src/ac3_decoder/ac3_bit_allocate.o \
72 src/ac3_decoder/ac3_mantissa.o \
73 src/ac3_decoder/ac3_rematrix.o \
74 src/ac3_decoder/ac3_imdct.o \
75 src/ac3_decoder/ac3_downmix.o \
76 src/ac3_decoder/ac3_downmix_c.o
78 LPCM_DECODER = src/lpcm_decoder/lpcm_decoder_thread.o \
79 src/lpcm_decoder/lpcm_decoder.o
81 AUDIO_DECODER = src/audio_decoder/audio_decoder.o \
82 src/audio_decoder/adec_generic.o \
83 src/audio_decoder/adec_layer1.o \
84 src/audio_decoder/adec_layer2.o \
85 src/audio_decoder/adec_math.o
87 SPU_DECODER = src/spu_decoder/spu_decoder.o
89 #GEN_DECODER = src/generic_decoder/generic_decoder.o
91 VIDEO_PARSER = src/video_parser/video_parser.o \
92 src/video_parser/vpar_headers.o \
93 src/video_parser/vpar_blocks.o \
94 src/video_parser/vpar_synchro.o \
95 src/video_parser/video_fifo.o
97 VIDEO_DECODER = src/video_decoder/video_decoder.o
99 MISC = src/misc/mtime.o \
100 src/misc/tests.o \
101 src/misc/rsc_files.o \
102 src/misc/modules.o \
103 src/misc/netutils.o
105 C_OBJ = $(INTERFACE) \
106 $(INPUT) \
107 $(VIDEO_OUTPUT) \
108 $(AUDIO_OUTPUT) \
109 $(AC3_DECODER) \
110 $(LPCM_DECODER) \
111 $(AUDIO_DECODER) \
112 $(SPU_DECODER) \
113 $(GEN_DECODER) \
114 $(VIDEO_PARSER) \
115 $(VIDEO_DECODER) \
116 $(MISC)
119 # Misc Objects
121 ifeq ($(GETOPT),1)
122 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o
123 endif
125 ifeq ($(SYS),beos)
126 CPP_OBJ = src/misc/beos_specific.o
127 endif
129 ifneq (,$(findstring darwin,$(SYS)))
130 C_OBJ += src/misc/darwin_specific.o
131 endif
134 # Generated header
136 H_OBJ = include/modules_builtin.h
139 # Other lists of files
141 C_DEP := $(C_OBJ:%.o=.dep/%.d)
142 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
145 # Translate plugin names
147 ifneq (,$(PLUGINS))
148 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@lib/\1.so@' -e 's@^ .*@@' ; done)
149 endif
150 ifneq (,$(BUILTINS))
151 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@lib/\1.a@' -e 's@^ .*@@' ; done)
152 endif
154 # All symbols must be exported
155 export
157 ###############################################################################
158 # Targets
159 ###############################################################################
162 # Virtual targets
164 all: vlc ${ALIASES} plugins vlc.app
166 clean:
167 for dir in $(PLUGINS_DIR) ; do \
168 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
169 rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
170 rm -f $(C_OBJ) $(CPP_OBJ)
171 rm -f src/*/*.o extras/*/*.o
172 rm -f lib/*.so lib/*.a vlc gnome-vlc gvlc kvlc qvlc
173 rm -Rf vlc.app
175 distclean: clean
176 rm -f **/*.o **/*~ *.log
177 rm -f Makefile.opts
178 rm -f include/defs.h include/config.h include/modules_builtin.h
179 rm -f config.status config.cache config.log
180 rm -f gmon.out core build-stamp
181 rm -Rf .dep
182 rm -f .gdb_history
184 install:
185 mkdir -p $(DESTDIR)$(bindir)
186 $(INSTALL) vlc $(DESTDIR)$(bindir)
187 ifneq (,$(ALIASES))
188 for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
189 endif
190 mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
191 ifneq (,$(PLUGINS))
192 $(INSTALL) -m 644 $(PLUGINS:%=lib/%.so) $(DESTDIR)$(libdir)/videolan/vlc
193 endif
194 mkdir -p $(DESTDIR)$(datadir)/videolan
195 $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
196 $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
197 $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
199 show:
200 @echo CC: $(CC)
201 @echo CFLAGS: $(CFLAGS)
202 @echo DCFLAGS: $(DCFLAGS)
203 @echo LCFLAGS: $(LCFLAGS)
204 @echo C_OBJ: $(C_OBJ)
205 @echo CPP_OBJ: $(CPP_OBJ)
206 @echo objects: $(objects)
207 @echo cppobjects: $(cppobjects)
208 @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
209 @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
212 # ugliest of all, but I have no time to do it -- sam
213 snapshot: Makefile.opts
214 rm -Rf /tmp/vlc-${PROGRAM_VERSION}* /tmp/vlc-${PROGRAM_VERSION}nocss*
215 # copy archive in /tmp
216 find -type d | grep -v CVS | grep -v '\.dep' | while read i ; \
217 do mkdir -p /tmp/vlc-${PROGRAM_VERSION}/$$i ; \
218 done
219 find debian -mindepth 1 -maxdepth 1 -type d | \
220 while read i ; do rm -Rf /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
221 # .c .h .in .cpp .glade
222 find include src plugins -type f -name '*.[chig]*' | while read i ; \
223 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
224 # Makefiles
225 find . plugins -type f -name Makefile | while read i ; \
226 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
227 # extra files
228 cp -a extras/* /tmp/vlc-${PROGRAM_VERSION}/extras
229 cp -a doc/* /tmp/vlc-${PROGRAM_VERSION}/doc
230 find /tmp/vlc-${PROGRAM_VERSION}/extras \
231 /tmp/vlc-${PROGRAM_VERSION}/doc \
232 -type d -name CVS | while read i ; \
233 do rm -Rf $$i ; \
234 done
235 # copy misc files
236 cp vlc.spec AUTHORS COPYING ChangeLog INSTALL README TODO todo.pl \
237 Makefile.opts.in Makefile.dep Makefile.modules \
238 configure configure.in install-sh config.sub config.guess \
239 /tmp/vlc-${PROGRAM_VERSION}/
240 for file in control control-css vlc-gtk.menu vlc.copyright vlc.docs \
241 changelog changelog-css rules rules-css vlc.dirs vlc.desktop \
242 gvlc.desktop gnome-vlc.desktop vlc.menu ; do \
243 cp debian/$$file /tmp/vlc-${PROGRAM_VERSION}/debian/ ; \
244 done
245 for file in default8x16.psf default8x9.psf vlc_beos.rsrc vlc.icns ; do \
246 cp share/$$file /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
247 for icon in vlc gvlc qvlc gnome-vlc kvlc ; do \
248 cp share/$$icon.xpm share/$$icon.png \
249 /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
251 # build css-enabled archives
252 (cd /tmp ; tar cf vlc-${PROGRAM_VERSION}.tar vlc-${PROGRAM_VERSION} ; \
253 bzip2 -f -9 < vlc-${PROGRAM_VERSION}.tar \
254 > vlc-${PROGRAM_VERSION}.tar.bz2 ; \
255 gzip -f -9 vlc-${PROGRAM_VERSION}.tar )
256 mv /tmp/vlc-${PROGRAM_VERSION}.tar.gz \
257 /tmp/vlc-${PROGRAM_VERSION}.tar.bz2 ..
259 # clean up
260 rm -Rf /tmp/vlc-${PROGRAM_VERSION}*
262 .PHONY: vlc.app
263 vlc.app:
264 ifneq (,$(findstring darwin,$(SYS)))
265 rm -Rf vlc.app
266 mkdir -p vlc.app/Contents/Resources
267 mkdir -p vlc.app/Contents/MacOS/lib
268 mkdir -p vlc.app/Contents/MacOS/share
269 $(INSTALL) -m 644 extras/MacOSX_app/Contents/Info.plist vlc.app/Contents/
270 $(INSTALL) -m 644 extras/MacOSX_app/Contents/PkgInfo vlc.app/Contents/
271 $(INSTALL) vlc vlc.app/Contents/MacOS/
272 $(INSTALL) share/vlc.icns vlc.app/Contents/Resources/
273 ifneq (,$(PLUGINS))
274 $(INSTALL) $(PLUGINS:%=lib/%.so) vlc.app/Contents/MacOS/lib
275 endif
276 $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
277 endif
279 FORCE:
282 # GTK/Gnome aliases - don't add too many aliases which could bloat
283 # the namespace
285 gnome-vlc gvlc kvlc qvlc: vlc
286 rm -f $@ && ln -s vlc $@
289 # Generic rules (see below)
291 $(C_DEP): %.d: FORCE
292 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
294 $(CPP_DEP): %.dpp: FORCE
295 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
297 $(H_OBJ): Makefile.opts Makefile.dep Makefile
298 rm -f $@ && cp $@.in $@
299 ifneq (,$(BUILTINS))
300 for i in $(BUILTINS) ; do \
301 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
302 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
303 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
304 done
305 endif
306 echo "" >> $@ ;
307 printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
308 ifneq (,$(BUILTINS))
309 for i in $(BUILTINS) ; do \
310 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
311 done
312 endif
313 echo "} while( 0 );" >> $@ ;
314 echo "" >> $@ ;
316 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
317 $(C_OBJ): %.o: .dep/%.d
318 $(C_OBJ): %.o: %.c
319 ifneq (,$(findstring darwin,$(SYS)))
320 #this is uglier of all
321 @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
322 else
323 $(CC) $(CFLAGS) -c -o $@ $<
324 endif
326 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
327 $(CPP_OBJ): %.o: .dep/%.dpp
328 $(CPP_OBJ): %.o: %.cpp
329 $(CC) $(CFLAGS) -c -o $@ $<
332 # Main application target
334 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ)
335 $(CC) $(CFLAGS) -o $@ $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
336 ifeq ($(SYS),beos)
337 rm -f ./lib/_APP_
338 ln -s ../vlc ./lib/_APP_
339 xres -o $@ ./share/vlc_beos.rsrc
340 mimeset -f $@
341 endif
344 # Plugins target
346 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
347 $(PLUGIN_OBJ): FORCE
348 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
351 # Built-in modules target
353 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
354 $(BUILTIN_OBJ): FORCE
355 cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
356 ranlib $@