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)
19 SNAPSHOTDIR=vlc-@VLC_VERSION@
30 #----------------- do not change anything below this line ----------------------
32 ################################################################################
33 # Configuration pre-processing
34 ################################################################################
36 # PROGRAM_OPTIONS is an identification string of the compilation options
37 PROGRAM_OPTIONS = $(SYS) $(ARCH)
39 PROGRAM_OPTIONS += DEBUG
43 PROGRAM_OPTIONS += DEBUG
47 # PROGRAM_BUILD is a complete identification of the build
48 # ( we can't use fancy options with date since OSes like Solaris
49 # or FreeBSD have strange date implementations )
50 PROGRAM_BUILD = `date` $(USER)
51 # XXX: beos does not support hostname
52 #PROGRAM_BUILD = `date` $(USER)@`hostname`
54 # DEFINE will contain some of the constants definitions decided in Makefile,
55 # including SYS_xx. It will be passed to C compiler.
56 DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z. A-Z_)
58 ################################################################################
59 # Tuning and other variables - do not change anything except if you know
60 # exactly what you are doing
61 ################################################################################
64 # C headers directories
66 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
75 ifneq (,$(findstring bsd,$(SYS)))
76 LIB += -pthread -lgnugetopt
77 LIB += -L/usr/local/lib
80 ifneq (,$(findstring linux,$(SYS)))
84 ifneq (,$(findstring solaris,$(SYS)))
85 LIB += -ldl -lsocket -lnsl -lpthread
89 LIB += -lbe -lroot -lgame
95 # C compiler flags: mainstream compilation
97 CFLAGS += $(DEFINE) $(INCLUDE)
98 CFLAGS += -Wall -Winline
99 CFLAGS += -D_REENTRANT
100 CFLAGS += -D_GNU_SOURCE
102 # flags needed for clean beos compilation
104 CFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
107 # Optimizations : don't compile debug versions with them
110 CFLAGS += -ffast-math -funroll-loops -funroll-all-loops
111 CFLAGS += -fomit-frame-pointer
112 CFLAGS += @BIZARRE_OPTIMS@
114 # Optimizations for x86 familiy
115 ifneq (,$(findstring 86,$(ARCH)))
116 CFLAGS += -malign-double
117 # Optional Pentium Pro optimizations
118 ifneq (,$(findstring ppro,$(ARCH)))
119 CFLAGS += -march=pentiumpro -mcpu=pentiumpro
121 CFLAGS += -march=pentium -mcpu=pentium
125 # Optimizations for PowerPC
126 ifneq (,$(findstring powerpc,$(ARCH)))
128 CFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
130 #CFLAGS += -mcpu=750 -mmultiple -mhard-float -mstring
132 #CFLAGS += -mcpu=7400 -mmultiple -mhard-float -mstring
135 # Optimizations for Sparc
136 ifneq (,$(findstring sparc,$(ARCH)))
137 CFLAGS += -mhard-float
140 #end of optimisations
143 # Optional MMX optimizations for x86
144 ifneq (,$(findstring mmx,$(ARCH)))
149 # C compiler flags: plugin compilation
154 # C compiler flags: dependancies
156 DCFLAGS += $(INCLUDE)
160 # C compiler flags: linking
167 # Debugging and profiling support (unless optimisations are active)
173 #################################################################################
175 #################################################################################
180 INTERFACE = src/interface/main.o \
181 src/interface/interface.o \
182 src/interface/intf_msg.o \
183 src/interface/intf_cmd.o \
184 src/interface/intf_ctrl.o \
185 src/interface/intf_console.o
187 INPUT = src/input/input_ps.o \
188 src/input/input_ts.o \
189 src/input/dvd_ifo.o \
190 src/input/input_dvd.o \
191 src/input/mpeg_system.o \
192 src/input/input_ext-dec.o \
193 src/input/input_dec.o \
194 src/input/input_programs.o \
195 src/input/input_netlist.o \
198 AUDIO_OUTPUT = src/audio_output/audio_output.o
200 VIDEO_OUTPUT = src/video_output/video_output.o \
201 src/video_output/video_text.o \
202 src/video_output/video_spu.o \
203 src/video_output/video_yuv.o
205 AC3_DECODER = src/ac3_decoder/ac3_decoder_thread.o \
206 src/ac3_decoder/ac3_decoder.o \
207 src/ac3_decoder/ac3_parse.o \
208 src/ac3_decoder/ac3_exponent.o \
209 src/ac3_decoder/ac3_bit_allocate.o \
210 src/ac3_decoder/ac3_mantissa.o \
211 src/ac3_decoder/ac3_rematrix.o \
212 src/ac3_decoder/ac3_imdct.o \
213 src/ac3_decoder/ac3_downmix.o
215 LPCM_DECODER = src/lpcm_decoder/lpcm_decoder_thread.o \
216 src/lpcm_decoder/lpcm_decoder.o
218 AUDIO_DECODER = src/audio_decoder/audio_decoder.o \
219 src/audio_decoder/adec_generic.o \
220 src/audio_decoder/adec_layer1.o \
221 src/audio_decoder/adec_layer2.o \
222 src/audio_decoder/adec_math.o
224 SPU_DECODER = src/spu_decoder/spu_decoder.o
226 #GEN_DECODER = src/generic_decoder/generic_decoder.o
228 VIDEO_PARSER = src/video_parser/video_parser.o \
229 src/video_parser/vpar_headers.o \
230 src/video_parser/vpar_blocks.o \
231 src/video_parser/vpar_synchro.o \
232 src/video_parser/video_fifo.o
234 VIDEO_DECODER = src/video_decoder/video_decoder.o
236 MISC = src/misc/mtime.o \
238 src/misc/rsc_files.o \
240 src/misc/netutils.o \
241 src/misc/playlist.o \
245 C_OBJ = $(INTERFACE) \
263 CPP_OBJ = src/misc/beos_specific.o
269 ifneq (,$(findstring 86,$(ARCH)))
270 ifneq (,$(findstring mmx,$(ARCH)))
279 PLUGIN_BEOS = plugins/beos/beos.o \
280 plugins/beos/aout_beos.o \
281 plugins/beos/intf_beos.o \
282 plugins/beos/vout_beos.o
284 PLUGIN_DSP = plugins/dsp/dsp.o \
285 plugins/dsp/aout_dsp.o
288 PLUGIN_DUMMY = plugins/dummy/dummy.o \
289 plugins/dummy/aout_dummy.o \
290 plugins/dummy/intf_dummy.o \
291 plugins/dummy/vout_dummy.o
293 PLUGIN_ESD = plugins/esd/esd.o \
294 plugins/esd/aout_esd.o
296 PLUGIN_FB = plugins/fb/fb.o \
297 plugins/fb/intf_fb.o \
300 PLUGIN_GGI = plugins/ggi/ggi.o \
301 plugins/ggi/intf_ggi.o \
302 plugins/ggi/vout_ggi.o
304 PLUGIN_SDL = plugins/sdl/sdl.o \
305 plugins/sdl/intf_sdl.o \
306 plugins/sdl/vout_sdl.o \
307 plugins/sdl/aout_sdl.o
309 PLUGIN_NULL = plugins/null/null.o
311 PLUGIN_GLIDE = plugins/glide/glide.o \
312 plugins/glide/intf_glide.o \
313 plugins/glide/vout_glide.o
315 PLUGIN_GNOME = plugins/gnome/gnome.o \
316 plugins/gnome/intf_gnome.o \
317 plugins/gnome/intf_gnome_callbacks.o \
318 plugins/gnome/intf_gnome_interface.o \
319 plugins/gnome/intf_gnome_support.o \
320 plugins/gnome/vout_gnome.o
322 PLUGIN_MGA = plugins/mga/mga.o \
323 plugins/mga/intf_mga.o \
324 plugins/mga/vout_mga.o
326 PLUGIN_X11= plugins/x11/x11.o \
327 plugins/x11/intf_x11.o \
328 plugins/x11/vout_x11.o
330 PLUGIN_YUV = plugins/yuv/yuv.o \
331 plugins/yuv/video_yuv.o \
332 plugins/yuv/transforms_yuv.o
334 PLUGIN_YUVMMX = plugins/yuv/yuvmmx.o \
335 plugins/yuv/video_yuvmmx.o \
336 plugins/yuv/transforms_yuvmmx.o
338 PLUGIN_MOTION = plugins/motion/motion.o \
339 plugins/motion/vdec_motion_common.o \
340 plugins/motion/vdec_motion_inner.o
342 PLUGIN_MOTIONMMX = plugins/motion/motionmmx.o \
343 plugins/motion/vdec_motion_common.o \
344 plugins/motion/vdec_motion_inner_mmx.o
346 PLUGIN_MOTIONMMXEXT = plugins/motion/motionmmxext.o \
347 plugins/motion/vdec_motion_common.o \
348 plugins/motion/vdec_motion_inner_mmxext.o
350 PLUGIN_IDCT = plugins/idct/idct.o \
351 plugins/idct/idct_common.o
353 PLUGIN_IDCTCLASSIC = plugins/idct/idctclassic.o \
354 plugins/idct/idct_common.o
356 PLUGIN_IDCTMMX = plugins/idct/idctmmx.o \
357 plugins/idct/idct_common.o
359 PLUGIN_IDCTMMXEXT = plugins/idct/idctmmxext.o \
360 plugins/idct/idct_common.o
362 PLUGIN_ALSA = plugins/alsa/alsa.o \
363 plugins/alsa/aout_alsa.o
365 STD_PLUGIN_OBJ =$(PLUGIN_BEOS) \
376 $(PLUGIN_MOTIONMMX) \
377 $(PLUGIN_MOTIONMMXEXT) \
379 $(PLUGIN_IDCTCLASSIC) \
381 $(PLUGIN_IDCTMMXEXT) \
387 STD_PLUGIN_COMMON = plugins/idct/idct_common.o \
388 plugins/motion/vdec_motion_common.o
390 # filter out duplicates from the plugin object lists
391 STD_PLUGIN_OBJ := $(filter-out $(STD_PLUGIN_COMMON) $(STD_PLUGIN_ASM), \
392 $(STD_PLUGIN_OBJ)) $(STD_PLUGIN_COMMON)
395 # Other lists of files
397 objects := $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(STD_PLUGIN_OBJ) $(STD_PLUGIN_ASM)
398 dependancies := $(objects:%.o=.dep/%.d)
400 # All symbols must be exported
403 ################################################################################
405 ################################################################################
410 all: vlc @ALIASES@ plugins
413 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(STD_PLUGIN_OBJ)
414 rm -f plugins/*/*.o src/*/*.o lib/*.so
418 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
419 rm -f Makefile include/defs.h include/config.h
420 rm -f config.status config.cache config.log
421 rm -f gmon.out core build-stamp
425 mkdir -p $(prefix)/bin
426 $(INSTALL) vlc $(prefix)/bin
428 for alias in "" @ALIASES@ ; do if test $$alias ; then rm -f $(prefix)/bin/$$alias && ln -s vlc $(prefix)/bin/$$alias ; fi ; done
429 mkdir -p $(prefix)/lib/videolan/vlc
430 $(INSTALL) -m 644 $(PLUGINS:%=lib/%.so) $(prefix)/lib/videolan/vlc
431 mkdir -p $(prefix)/share/videolan
432 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
433 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
437 @echo CFLAGS: $(CFLAGS)
438 @echo DCFLAGS: $(DCFLAGS)
439 @echo LCFLAGS: $(LCFLAGS)
440 @echo STD_PLUGIN_OBJ: $(STD_PLUGIN_OBJ)
442 # ugliest of all, but I have no time to do it -- sam
444 rm -rf /tmp/${SNAPSHOTDIR}
445 mkdir /tmp/${SNAPSHOTDIR}
446 cp -a * /tmp/${SNAPSHOTDIR}
447 (cd /tmp/${SNAPSHOTDIR} ; \
449 find . -type d -name CVS | xargs rm -rf ; \
450 find . -type f -name '.*.swp' | xargs rm -f ; \
451 find . -type f -name '.cvsignore' | xargs rm -f ; \
453 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
454 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
455 rm -rf /tmp/${SNAPSHOTDIR}
456 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
457 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
458 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
460 plugins: $(PLUGINS:%=lib/%.so)
465 # Gnome and Framebuffer aliases - don't add new aliases which could bloat
469 rm -f $@ && ln -s vlc $@
473 # Generic rules (see below)
475 $(dependancies): %.d: FORCE
476 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
478 $(C_OBJ): %.o: Makefile.dep
479 $(C_OBJ): %.o: .dep/%.d
481 $(CC) $(CFLAGS) -c -o $@ $<
483 $(CPP_OBJ): %.o: %.cpp
484 $(CC) $(CFLAGS) -c -o $@ $<
486 $(ASM_OBJ): %.o: Makefile.dep
488 $(CC) $(CFLAGS) -c -o $@ $<
490 $(STD_PLUGIN_OBJ): %.o: Makefile.dep
491 $(STD_PLUGIN_OBJ): %.o: .dep/%.d
492 $(STD_PLUGIN_OBJ): %.o: %.c
493 $(CC) $(CFLAGS) $(PCFLAGS) -c -o $@ $<
495 $(STD_PLUGIN_ASM): %.o: Makefile.dep
496 $(STD_PLUGIN_ASM): %.o: %.S
497 $(CC) $(CFLAGS) $(PCFLAGS) -c -o $@ $<
499 $(PLUGIN_GNOME): %.o: Makefile.dep
500 $(PLUGIN_GNOME): %.o: %.c
501 $(CC) $(CFLAGS) $(PCFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
503 $(PLUGIN_GLIDE): %.o: Makefile.dep
504 $(PLUGIN_GLIDE): %.o: %.c
505 $(CC) $(CFLAGS) $(PCFLAGS) -I/usr/include/glide -c -o $@ $<
508 # Main application target
511 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
513 $(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
514 rm -f ./plugins/_APP_
515 ln -s ../vlc ./plugins/_APP_
517 $(CC) $(CFLAGS) $(LCFLAGS) --export-dynamic @DYNAMIC_FLAG@ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
524 lib/beos.so: $(PLUGIN_BEOS)
525 $(CC) $(PCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
527 lib/esd.so: $(PLUGIN_ESD)
528 ifneq (,$(findstring bsd,$(SYS)))
529 $(CC) $(PCFLAGS) -shared -o $@ $^ -lesd
531 $(CC) $(PCFLAGS) -shared -o $@ $^ -laudiofile -lesd
534 lib/dsp.so: $(PLUGIN_DSP)
535 $(CC) $(PCFLAGS) -shared -o $@ $^
537 lib/alsa.so: $(PLUGIN_ALSA)
538 $(CC) $(PCFLAGS) -shared -o $@ $^ -lasound
540 lib/fb.so: $(PLUGIN_FB)
541 $(CC) $(PCFLAGS) -shared -o $@ $^
543 lib/x11.so: $(PLUGIN_X11)
544 $(CC) $(PCFLAGS) -shared -o $@ $^ -L/usr/X11R6/lib -lX11 -lXext
546 lib/mga.so: $(PLUGIN_MGA)
547 $(CC) $(PCFLAGS) -shared -o $@ $^ -L/usr/X11R6/lib -lX11 -lXext
549 lib/gnome.so: $(PLUGIN_GNOME)
550 $(CC) $(PCFLAGS) -shared -o $@ $^ `gnome-config --libs gnomeui | sed 's,-rdynamic,,'`
552 lib/glide.so: $(PLUGIN_GLIDE)
553 $(CC) $(PCFLAGS) -shared -o $@ $^ $(LIB_GLIDE)
555 lib/ggi.so: $(PLUGIN_GGI)
556 $(CC) $(PCFLAGS) -shared -o $@ $^ $(LIB_GGI)
558 lib/sdl.so: $(PLUGIN_SDL)
559 $(CC) $(PCFLAGS) -shared -o $@ $^ $(LIB_SDL)
562 lib/null.so: $(PLUGIN_NULL)
563 $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
565 lib/dummy.so: $(PLUGIN_DUMMY)
566 $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
568 lib/yuv.so: $(PLUGIN_YUV)
569 $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
571 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
572 $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
574 lib/motion.so: $(PLUGIN_MOTION)
575 $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
577 lib/motionmmx.so: $(PLUGIN_MOTIONMMX)
578 $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
580 lib/motionmmxext.so: $(PLUGIN_MOTIONMMXEXT)
581 $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
583 lib/idct.so: $(PLUGIN_IDCT)
584 $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
586 lib/idctclassic.so: $(PLUGIN_IDCTCLASSIC)
587 $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
589 lib/idctmmx.so: $(PLUGIN_IDCTMMX)
590 $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
592 lib/idctmmxext.so: $(PLUGIN_IDCTMMXEXT)
593 $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
595 lib/null.so: $(PLUGIN_NULL)
596 $(CC) $(PCFLAGS) -shared -o $@ $^
598 lib/dummy.so: $(PLUGIN_DUMMY)
599 $(CC) $(PCFLAGS) -shared -o $@ $^
601 lib/yuv.so: $(PLUGIN_YUV)
602 $(CC) $(PCFLAGS) -shared -o $@ $^
604 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
605 $(CC) $(PCFLAGS) -shared -o $@ $^
607 lib/motion.so: $(PLUGIN_MOTION)
608 $(CC) $(PCFLAGS) -shared -o $@ $^
610 lib/motionmmx.so: $(PLUGIN_MOTIONMMX)
611 $(CC) $(PCFLAGS) -shared -o $@ $^
613 lib/motionmmxext.so: $(PLUGIN_MOTIONMMXEXT)
614 $(CC) $(PCFLAGS) -shared -o $@ $^
616 lib/idct.so: $(PLUGIN_IDCT)
617 $(CC) $(PCFLAGS) -shared -o $@ $^
619 lib/idctclassic.so: $(PLUGIN_IDCTCLASSIC)
620 $(CC) $(PCFLAGS) -shared -o $@ $^
622 lib/idctmmx.so: $(PLUGIN_IDCTMMX)
623 $(CC) $(PCFLAGS) -shared -o $@ $^
625 lib/idctmmxext.so: $(PLUGIN_IDCTMMXEXT)
626 $(CC) $(PCFLAGS) -shared -o $@ $^
629 ################################################################################
630 # Note on generic rules and dependancies
631 ################################################################################
633 # Note on dependancies: each .c file is associated with a .d file, which
634 # depends of it. The .o file associated with a .c file depends of the .d, of the
635 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
637 # The dep directory should be ignored by CVS.
639 # Note on inclusions: depending of the target, the dependancies files must
640 # or must not be included. The problem is that if we ask make to include a file,
641 # and this file does not exist, it is made before it can be included. In a
642 # general way, a .d file should be included if and only if the corresponding .o
643 # needs to be re-made.
645 # Two makefiles are used: the main one (this one) has regular generic rules,
646 # except for .o files, for which it calls the object Makefile. Dependancies
647 # are not included in this file.
648 # The object Makefile known how to make a .o from a .c, and includes
649 # dependancies for the target, but only those required.