1 ################################################################################
2 # vlc (VideoLAN Client) main makefile
4 ################################################################################
5 # This makefile is the main makefile for the VideoLAN client.
6 ################################################################################
8 ################################################################################
10 ################################################################################
12 # Debugging mode on or off (set to 1 to activate)
17 SNAPSHOTDIR=vlc-@VLC_VERSION@
22 #----------------- do not change anything below this line ----------------------
24 ################################################################################
25 # Configuration pre-processing
26 ################################################################################
28 # PROGRAM_OPTIONS is an identification string of the compilation options
29 PROGRAM_OPTIONS = $(SYS) $(ARCH)
31 PROGRAM_OPTIONS += DEBUG
35 # PROGRAM_BUILD is a complete identification of the build
36 # ( we can't use fancy options with date since OSes like Solaris
37 # or FreeBSD have strange date implementations )
38 PROGRAM_BUILD = `date` $(USER)
39 # XXX: beos does not support hostname
40 #PROGRAM_BUILD = `date` $(USER)@`hostname`
42 # DEFINE will contain some of the constants definitions decided in Makefile,
43 # including SYS_xx. It will be passed to C compiler.
44 DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z A-Z)
46 ################################################################################
47 # Tuning and other variables - do not change anything except if you know
48 # exactly what you are doing
49 ################################################################################
52 # C headers directories
54 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
64 ifneq (,$(findstring bsd,$(SYS)))
65 LIB += -pthread -lgnugetopt
66 LIB += -L/usr/local/lib
69 ifneq (,$(findstring linux,$(SYS)))
74 LIB += -lbe -lroot -lgame
80 # C compiler flags: compilation
82 CCFLAGS += $(DEFINE) $(INCLUDE)
83 CCFLAGS += -Wall -Winline
84 CCFLAGS += -D_REENTRANT
85 CCFLAGS += -D_GNU_SOURCE
87 # flags needed for clean beos compilation
89 CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
92 # Optimizations : don't compile debug versions with them
95 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
96 CCFLAGS += -fomit-frame-pointer
98 # Optimizations for x86 familiy
99 ifneq (,$(findstring 86,$(ARCH)))
100 CCFLAGS += -malign-double
101 # Eventual Pentium Pro optimizations
102 ifneq (,$(findstring ppro,$(ARCH)))
104 CCFLAGS += -march=pentiumpro
107 CCFLAGS += -march=pentium
109 # Eventual MMX optimizations for x86
110 ifneq (,$(findstring mmx,$(ARCH)))
115 # Optimizations for PowerPC
116 ifneq (,$(findstring ppc,$(ARCH)))
117 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
120 # Optimizations for Sparc
121 ifneq (,$(findstring sparc,$(ARCH)))
122 CCFLAGS += -mhard-float
125 # End of optimizations
129 # C compiler flags: dependancies
131 DCFLAGS += $(INCLUDE)
135 # C compiler flags: linking
142 # Additionnal debugging flags
145 # Debugging and profiling support
154 #################################################################################
156 #################################################################################
161 interface_obj = interface/main.o \
162 interface/interface.o \
163 interface/intf_msg.o \
164 interface/intf_cmd.o \
165 interface/intf_ctrl.o \
166 interface/intf_console.o
168 input_obj = input/input_vlan.o \
170 input/input_netlist.o \
171 input/input_network.o \
177 audio_output_obj = audio_output/audio_output.o
179 video_output_obj = video_output/video_output.o \
180 video_output/video_text.o \
181 video_output/video_spu.o \
182 video_output/video_yuv.o
184 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
185 ac3_decoder/ac3_decoder.o \
186 ac3_decoder/ac3_parse.o \
187 ac3_decoder/ac3_exponent.o \
188 ac3_decoder/ac3_bit_allocate.o \
189 ac3_decoder/ac3_mantissa.o \
190 ac3_decoder/ac3_rematrix.o \
191 ac3_decoder/ac3_imdct.o \
192 ac3_decoder/ac3_downmix.o
194 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
195 lpcm_decoder/lpcm_decoder.o
197 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
198 audio_decoder/audio_decoder.o \
199 audio_decoder/audio_math.o
201 spu_decoder_obj = spu_decoder/spu_decoder.o
203 #??generic_decoder_obj = generic_decoder/generic_decoder.o
204 # remeber to add it to OBJ
206 video_parser_obj = video_parser/video_parser.o \
207 video_parser/vpar_headers.o \
208 video_parser/vpar_blocks.o \
209 video_parser/vpar_synchro.o \
210 video_parser/video_fifo.o
212 ifneq (,$(findstring mmx,$(ARCH)))
213 vdec_motion_inner = video_decoder/vdec_motion_inner_mmx.o
215 vdec_motion_inner = video_decoder/vdec_motion_inner.o
218 video_decoder_obj = video_decoder/video_decoder.o \
219 video_decoder/vdec_motion.o \
220 video_decoder/vdec_idct.o \
223 misc_obj = misc/mtime.o \
232 C_OBJ = $(interface_obj) \
234 $(audio_output_obj) \
235 $(video_output_obj) \
237 $(lpcm_decoder_obj) \
238 $(audio_decoder_obj) \
240 $(generic_decoder_obj) \
241 $(video_parser_obj) \
242 $(video_decoder_obj) \
247 CPP_OBJ = misc/beos_specific.o
253 ifneq (,$(findstring 86,$(ARCH)))
254 ifneq (,$(findstring mmx,$(ARCH)))
255 ASM_OBJ = video_decoder/vdec_idctmmx.o \
256 video_output/video_yuv_mmx.o
263 PLUGINS := $(PLUGINS:%=lib/%.so)
265 PLUGIN_BEOS = plugins/beos/beos.o \
266 plugins/beos/aout_beos.o \
267 plugins/beos/intf_beos.o \
268 plugins/beos/vout_beos.o
270 PLUGIN_DSP = plugins/dsp/dsp.o \
271 plugins/dsp/aout_dsp.o \
273 PLUGIN_DUMMY = plugins/dummy/dummy.o \
274 plugins/dummy/aout_dummy.o \
275 plugins/dummy/intf_dummy.o \
276 plugins/dummy/vout_dummy.o
278 PLUGIN_ESD = plugins/esd/esd.o \
279 plugins/esd/aout_esd.o
281 PLUGIN_FB = plugins/fb/fb.o \
282 plugins/fb/intf_fb.o \
285 PLUGIN_GGI = plugins/ggi/ggi.o \
286 plugins/ggi/intf_ggi.o \
287 plugins/ggi/vout_ggi.o
289 PLUGIN_SDL = plugins/sdl/sdl.o \
290 plugins/sdl/intf_sdl.o \
291 plugins/sdl/vout_sdl.o
293 PLUGIN_GLIDE = plugins/glide/glide.o \
294 plugins/glide/intf_glide.o \
295 plugins/glide/vout_glide.o
297 PLUGIN_GNOME = plugins/gnome/gnome.o \
298 plugins/gnome/intf_gnome.o \
299 plugins/gnome/intf_gnome_callbacks.o \
300 plugins/gnome/intf_gnome_interface.o \
301 plugins/gnome/intf_gnome_support.o \
302 plugins/gnome/vout_gnome.o
304 PLUGIN_MGA = plugins/mga/mga.o \
305 plugins/mga/intf_mga.o \
306 plugins/mga/vout_mga.o
308 PLUGIN_X11 = plugins/x11/x11.o \
309 plugins/x11/intf_x11.o \
310 plugins/x11/vout_x11.o
312 PLUGIN_YUV = plugins/yuv/yuv.o \
313 plugins/yuv/video_yuv.o \
314 plugins/yuv/video_yuv8.o \
315 plugins/yuv/video_yuv15.o \
316 plugins/yuv/video_yuv16.o \
317 plugins/yuv/video_yuv24.o \
318 plugins/yuv/video_yuv32.o
320 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
321 plugins/yuvmmx/video_yuv.o \
322 plugins/yuvmmx/video_yuv8.o \
323 plugins/yuvmmx/video_yuv15.o \
324 plugins/yuvmmx/video_yuv16.o \
325 plugins/yuvmmx/video_yuv24.o \
326 plugins/yuvmmx/video_yuv32.o
328 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
329 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
330 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX) \
333 # Other lists of files
335 C_OBJ := $(C_OBJ:%.o=src/%.o)
336 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
337 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
338 sources_c := $(C_OBJ:%.o=%.c)
339 dependancies := $(sources_c:%.c=.dep/%.d)
341 # All symbols must be exported
344 ################################################################################
346 ################################################################################
351 all: vlc @ALIASES@ plugins
354 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
355 rm -f vlc @ALIASES@ lib/*.so
358 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
359 rm -f Makefile include/defs.h include/config.h
360 rm -f config.status config.cache config.log
361 rm -f gmon.out core build-stamp
362 rm -rf .dep debian/tmp
365 mkdir -p $(prefix)/bin
366 $(INSTALL) vlc $(prefix)/bin
367 for alias in @ALIASES@ ; do ln -s vlc $(prefix)/bin/$$alias ; done
368 mkdir -p $(prefix)/lib/videolan/vlc
369 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
370 mkdir -p $(prefix)/share/videolan
371 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
372 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
376 @echo CCFLAGS: $(CCFLAGS)
377 @echo DCFLAGS: $(DCFLAGS)
378 @echo LCFLAGS: $(CCFLAGS)
380 # ugliest of all, but I have no time to do it -- sam
382 rm -rf /tmp/${SNAPSHOTDIR}
383 mkdir /tmp/${SNAPSHOTDIR}
384 cp -r * /tmp/${SNAPSHOTDIR}
385 (cd /tmp/${SNAPSHOTDIR} ; \
387 find . -type d -name CVS | xargs rm -rf ; \
388 find . -type f -name '.*.swp' | xargs rm -f ; \
389 find . -type f -name '.cvsignore' | xargs rm -f ; \
391 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
392 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
393 rm -rf /tmp/${SNAPSHOTDIR}
394 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
395 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
396 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
403 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
405 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
406 rm -f ./plugins/_APP_
407 ln -s ../vlc ./plugins/_APP_
409 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
412 sdlvlc gvlc xvlc fbvlc: vlc
413 rm -f $@ && ln -s vlc $@
418 # Generic rules (see below)
420 $(dependancies): %.d: FORCE
421 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
423 $(C_OBJ): %.o: Makefile.dep
424 $(C_OBJ): %.o: .dep/%.d
426 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
428 $(CPP_OBJ): %.o: %.cpp
429 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
431 $(ASM_OBJ): %.o: Makefile.dep
433 $(CC) $(CFLAGS) -c -o $@ $<
435 #$(PLUGIN_OBJ): %.so: Makefile.dep
436 #$(PLUGIN_OBJ): %.so: .dep/%.d
438 lib/beos.so: $(PLUGIN_BEOS)
439 $(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
440 $(PLUGIN_BEOS): %.o: %.cpp
441 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
443 lib/esd.so: $(PLUGIN_ESD)
444 ifneq (,$(findstring bsd,$(SYS)))
445 ld -shared -lesd -o $@ $^
447 ld -shared -laudiofile -lesd -o $@ $^
449 $(PLUGIN_ESD): %.o: %.c
450 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
452 lib/dsp.so: $(PLUGIN_DSP)
454 $(PLUGIN_DSP): %.o: %.c
455 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
457 lib/dummy.so: $(PLUGIN_DUMMY)
459 $(PLUGIN_DUMMY): %.o: %.c
460 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
462 lib/fb.so: $(PLUGIN_FB)
464 $(PLUGIN_FB): %.o: %.c
465 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
467 lib/x11.so: $(PLUGIN_X11)
468 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
469 $(PLUGIN_X11): %.o: %.c
470 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
472 lib/mga.so: $(PLUGIN_MGA)
473 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
474 $(PLUGIN_MGA): %.o: %.c
475 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
477 lib/gnome.so: $(PLUGIN_GNOME)
478 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
479 $(PLUGIN_GNOME): %.o: %.c
480 $(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
482 lib/glide.so: $(PLUGIN_GLIDE)
483 ld -shared -lglide2x -o $@ $^
484 $(PLUGIN_GLIDE): %.o: %.c
485 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
487 lib/ggi.so: $(PLUGIN_GGI)
488 ld -shared -lggi -o $@ $^
489 $(PLUGIN_GGI): %.o: %.c
490 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
492 lib/sdl.so: $(PLUGIN_SDL)
493 ld -shared -lSDL -o $@ $^
494 $(PLUGIN_SDL): %.o: %.c
495 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
497 lib/yuv.so: $(PLUGIN_YUV)
499 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
503 $(PLUGIN_YUV): %.o: %.c
504 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
506 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
508 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
512 $(PLUGIN_YUVMMX): %.o: %.c
513 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
515 ################################################################################
516 # Note on generic rules and dependancies
517 ################################################################################
519 # Note on dependancies: each .c file is associated with a .d file, which
520 # depends of it. The .o file associated with a .c file depends of the .d, of the
521 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
523 # The dep directory should be ignored by CVS.
525 # Note on inclusions: depending of the target, the dependancies files must
526 # or must not be included. The problem is that if we ask make to include a file,
527 # and this file does not exist, it is made before it can be included. In a
528 # general way, a .d file should be included if and only if the corresponding .o
529 # needs to be re-made.
531 # Two makefiles are used: the main one (this one) has regular generic rules,
532 # except for .o files, for which it calls the object Makefile. Dependancies
533 # are not included in this file.
534 # The object Makefile known how to make a .o from a .c, and includes
535 # dependancies for the target, but only those required.