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@
24 #----------------- do not change anything below this line ----------------------
26 ################################################################################
27 # Configuration pre-processing
28 ################################################################################
30 # PROGRAM_OPTIONS is an identification string of the compilation options
31 PROGRAM_OPTIONS = $(SYS) $(ARCH)
33 PROGRAM_OPTIONS += DEBUG
37 PROGRAM_OPTIONS += DEBUG
41 # PROGRAM_BUILD is a complete identification of the build
42 # ( we can't use fancy options with date since OSes like Solaris
43 # or FreeBSD have strange date implementations )
44 PROGRAM_BUILD = `date` $(USER)
45 # XXX: beos does not support hostname
46 #PROGRAM_BUILD = `date` $(USER)@`hostname`
48 # DEFINE will contain some of the constants definitions decided in Makefile,
49 # including SYS_xx. It will be passed to C compiler.
50 DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z A-Z)
52 ################################################################################
53 # Tuning and other variables - do not change anything except if you know
54 # exactly what you are doing
55 ################################################################################
58 # C headers directories
60 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
70 ifneq (,$(findstring bsd,$(SYS)))
71 LIB += -pthread -lgnugetopt
72 LIB += -L/usr/local/lib
75 ifneq (,$(findstring linux,$(SYS)))
80 LIB += -lbe -lroot -lgame
86 # C compiler flags: compilation
88 CFLAGS += $(DEFINE) $(INCLUDE)
89 CFLAGS += -Wall -Winline
90 CFLAGS += -D_REENTRANT
91 CFLAGS += -D_GNU_SOURCE
93 # flags needed for clean beos compilation
95 CFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
98 # Optimizations : don't compile debug versions with them
101 CFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
102 CFLAGS += -funroll-all-loops -fstrict-aliasing
103 CFLAGS += -fomit-frame-pointer
105 # Optimizations for x86 familiy
106 ifneq (,$(findstring 86,$(ARCH)))
107 CFLAGS += -malign-double
108 # Optional Pentium Pro optimizations
109 ifneq (,$(findstring ppro,$(ARCH)))
111 CFLAGS += -march=pentiumpro
114 CFLAGS += -march=pentium
118 # Optimizations for PowerPC
119 ifneq (,$(findstring powerpc,$(ARCH)))
121 CFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
123 #CFLAGS += -mcpu=750 -mmultiple -mhard-float -mstring
125 #CFLAGS += -mcpu=7400 -mmultiple -mhard-float -mstring
128 # Optimizations for Sparc
129 ifneq (,$(findstring sparc,$(ARCH)))
130 CFLAGS += -mhard-float
136 # Optional MMX optimizations for x86
137 ifneq (,$(findstring mmx,$(ARCH)))
141 # End of optimizations
144 # C compiler flags: dependancies
146 DCFLAGS += $(INCLUDE)
150 # C compiler flags: linking
157 # Additionnal debugging flags
160 # Debugging and profiling support
165 #################################################################################
167 #################################################################################
172 interface_obj = interface/main.o \
173 interface/interface.o \
174 interface/intf_msg.o \
175 interface/intf_cmd.o \
176 interface/intf_ctrl.o \
177 interface/intf_console.o
179 input_obj = input/input_vlan.o \
181 input/input_netlist.o \
182 input/input_network.o \
188 audio_output_obj = audio_output/audio_output.o
190 video_output_obj = video_output/video_output.o \
191 video_output/video_text.o \
192 video_output/video_spu.o \
193 video_output/video_yuv.o
195 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
196 ac3_decoder/ac3_decoder.o \
197 ac3_decoder/ac3_parse.o \
198 ac3_decoder/ac3_exponent.o \
199 ac3_decoder/ac3_bit_allocate.o \
200 ac3_decoder/ac3_mantissa.o \
201 ac3_decoder/ac3_rematrix.o \
202 ac3_decoder/ac3_imdct.o \
203 ac3_decoder/ac3_downmix.o
205 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
206 lpcm_decoder/lpcm_decoder.o
208 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
209 audio_decoder/audio_decoder.o \
210 audio_decoder/audio_math.o
212 spu_decoder_obj = spu_decoder/spu_decoder.o
214 #??generic_decoder_obj = generic_decoder/generic_decoder.o
215 # remeber to add it to OBJ
217 video_parser_obj = video_parser/video_parser.o \
218 video_parser/vpar_headers.o \
219 video_parser/vpar_blocks.o \
220 video_parser/vpar_synchro.o \
221 video_parser/video_fifo.o
223 ifneq (,$(findstring mmx,$(ARCH)))
224 vdec_motion_inner = video_decoder/vdec_motion_inner_mmx.o
226 vdec_motion_inner = video_decoder/vdec_motion_inner.o
229 video_decoder_obj = video_decoder/video_decoder.o \
230 video_decoder/vdec_motion.o \
231 video_decoder/vdec_idct.o \
234 misc_obj = misc/mtime.o \
243 C_OBJ = $(interface_obj) \
245 $(audio_output_obj) \
246 $(video_output_obj) \
248 $(lpcm_decoder_obj) \
249 $(audio_decoder_obj) \
251 $(generic_decoder_obj) \
252 $(video_parser_obj) \
253 $(video_decoder_obj) \
258 CPP_OBJ = misc/beos_specific.o
264 ifneq (,$(findstring 86,$(ARCH)))
265 ifneq (,$(findstring mmx,$(ARCH)))
266 ASM_OBJ = video_decoder/vdec_idctmmx.o \
267 video_output/video_yuv_mmx.o
274 PLUGINS := $(PLUGINS:%=lib/%.so)
276 PLUGIN_BEOS = plugins/beos/beos.o \
277 plugins/beos/aout_beos.o \
278 plugins/beos/intf_beos.o \
279 plugins/beos/vout_beos.o
281 PLUGIN_DSP = plugins/dsp/dsp.o \
282 plugins/dsp/aout_dsp.o \
284 PLUGIN_DUMMY = plugins/dummy/dummy.o \
285 plugins/dummy/aout_dummy.o \
286 plugins/dummy/intf_dummy.o \
287 plugins/dummy/vout_dummy.o
289 PLUGIN_ESD = plugins/esd/esd.o \
290 plugins/esd/aout_esd.o
292 PLUGIN_FB = plugins/fb/fb.o \
293 plugins/fb/intf_fb.o \
296 PLUGIN_GGI = plugins/ggi/ggi.o \
297 plugins/ggi/intf_ggi.o \
298 plugins/ggi/vout_ggi.o
300 PLUGIN_SDL = plugins/sdl/sdl.o \
301 plugins/sdl/intf_sdl.o \
302 plugins/sdl/vout_sdl.o
303 # plugins/sdl/video_yuv.o \
304 # plugins/sdl/video_yuvall.o
307 PLUGIN_GLIDE = plugins/glide/glide.o \
308 plugins/glide/intf_glide.o \
309 plugins/glide/vout_glide.o
311 PLUGIN_GNOME = plugins/gnome/gnome.o \
312 plugins/gnome/intf_gnome.o \
313 plugins/gnome/intf_gnome_callbacks.o \
314 plugins/gnome/intf_gnome_interface.o \
315 plugins/gnome/intf_gnome_support.o \
316 plugins/gnome/vout_gnome.o
318 PLUGIN_MGA = plugins/mga/mga.o \
319 plugins/mga/intf_mga.o \
320 plugins/mga/vout_mga.o
322 PLUGIN_X11 = plugins/x11/x11.o \
323 plugins/x11/intf_x11.o \
324 plugins/x11/vout_x11.o
326 PLUGIN_YUV = plugins/yuv/yuv.o \
327 plugins/yuv/video_yuv.o \
328 plugins/yuv/video_yuv8.o \
329 plugins/yuv/video_yuv15.o \
330 plugins/yuv/video_yuv16.o \
331 plugins/yuv/video_yuv24.o \
332 plugins/yuv/video_yuv32.o
335 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
336 plugins/yuvmmx/video_yuv.o \
337 plugins/yuvmmx/video_yuv8.o \
338 plugins/yuvmmx/video_yuv15.o \
339 plugins/yuvmmx/video_yuv16.o \
340 plugins/yuvmmx/video_yuv24.o \
341 plugins/yuvmmx/video_yuv32.o
343 PLUGIN_ALSA = plugins/alsa/alsa.o \
344 plugins/alsa/aout_alsa.o
346 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
347 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
348 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX) \
349 $(PLUGIN_SDL) $(PLUGIN_ALSA)
351 # Other lists of files
353 C_OBJ := $(C_OBJ:%.o=src/%.o)
354 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
355 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
356 sources_c := $(C_OBJ:%.o=%.c)
357 dependancies := $(sources_c:%.c=.dep/%.d)
359 # All symbols must be exported
362 ################################################################################
364 ################################################################################
369 all: vlc @ALIASES@ plugins
372 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
373 rm -f vlc @ALIASES@ lib/*.so
376 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
377 rm -f Makefile include/defs.h include/config.h
378 rm -f config.status config.cache config.log
379 rm -f gmon.out core build-stamp
381 rm -rf debian/tmp debian/files debian/*.debhelper debian/*.substvars
382 find debian/* -type d -maxdepth 0 -name 'vlc-*' | xargs rm -rf
385 mkdir -p $(prefix)/bin
386 $(INSTALL) vlc $(prefix)/bin
388 for alias in "" @ALIASES@ ; do if test $$alias ; then ln -s vlc $(prefix)/bin/$$alias ; fi ; done
389 mkdir -p $(prefix)/lib/videolan/vlc
390 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
391 mkdir -p $(prefix)/share/videolan
392 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
393 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
397 @echo CFLAGS: $(CFLAGS)
398 @echo DCFLAGS: $(DCFLAGS)
399 @echo LCFLAGS: $(LCFLAGS)
401 # ugliest of all, but I have no time to do it -- sam
403 rm -rf /tmp/${SNAPSHOTDIR}
404 mkdir /tmp/${SNAPSHOTDIR}
405 cp -a * /tmp/${SNAPSHOTDIR}
406 (cd /tmp/${SNAPSHOTDIR} ; \
408 find . -type d -name CVS | xargs rm -rf ; \
409 find . -type f -name '.*.swp' | xargs rm -f ; \
410 find . -type f -name '.cvsignore' | xargs rm -f ; \
412 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
413 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
414 rm -rf /tmp/${SNAPSHOTDIR}
415 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
416 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
417 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
424 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
426 $(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
427 rm -f ./plugins/_APP_
428 ln -s ../vlc ./plugins/_APP_
430 $(CC) $(CFLAGS) $(LCFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
434 # Gnome and Framebuffer aliases - don't add new aliases which could bloat
438 rm -f $@ && ln -s vlc $@
443 # Generic rules (see below)
445 $(dependancies): %.d: FORCE
446 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
448 $(C_OBJ): %.o: Makefile.dep
449 $(C_OBJ): %.o: .dep/%.d
451 $(CC) $(CFLAGS) -c -o $@ $<
453 $(CPP_OBJ): %.o: %.cpp
454 $(CC) $(CFLAGS) -c -o $@ $<
456 $(ASM_OBJ): %.o: Makefile.dep
458 $(CC) $(CFLAGS) -c -o $@ $<
460 #$(PLUGIN_OBJ): %.so: Makefile.dep
461 #$(PLUGIN_OBJ): %.so: .dep/%.d
463 lib/beos.so: $(PLUGIN_BEOS)
464 $(CC) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
465 $(PLUGIN_BEOS): %.o: %.cpp
466 $(CC) $(CFLAGS) -c -o $@ $<
468 lib/esd.so: $(PLUGIN_ESD)
469 ifneq (,$(findstring bsd,$(SYS)))
470 ld -shared -lesd -o $@ $^
472 ld -shared -laudiofile -lesd -o $@ $^
474 $(PLUGIN_ESD): %.o: %.c
475 $(CC) $(CFLAGS) -c -o $@ $<
477 lib/dsp.so: $(PLUGIN_DSP)
479 $(PLUGIN_DSP): %.o: %.c
480 $(CC) $(CFLAGS) -c -o $@ $<
482 lib/alsa.so: $(PLUGIN_ALSA)
484 $(PLUGIN_ALSA): %.o: %.c
485 $(CC) $(CFLAGS) -c -o $@ $<
487 lib/dummy.so: $(PLUGIN_DUMMY)
489 $(PLUGIN_DUMMY): %.o: %.c
490 $(CC) $(CFLAGS) -c -o $@ $<
492 lib/fb.so: $(PLUGIN_FB)
494 $(PLUGIN_FB): %.o: %.c
495 $(CC) $(CFLAGS) -c -o $@ $<
497 lib/x11.so: $(PLUGIN_X11)
498 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
499 $(PLUGIN_X11): %.o: %.c
500 $(CC) $(CFLAGS) -c -o $@ $<
502 lib/mga.so: $(PLUGIN_MGA)
503 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
504 $(PLUGIN_MGA): %.o: %.c
505 $(CC) $(CFLAGS) -c -o $@ $<
507 lib/gnome.so: $(PLUGIN_GNOME)
508 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
509 $(PLUGIN_GNOME): %.o: %.c
510 $(CC) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
512 lib/glide.so: $(PLUGIN_GLIDE)
513 ld -shared -lglide2x -o $@ $^
514 $(PLUGIN_GLIDE): %.o: %.c
515 $(CC) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
517 lib/ggi.so: $(PLUGIN_GGI)
518 ld -shared -lggi -o $@ $^
519 $(PLUGIN_GGI): %.o: %.c
520 $(CC) $(CFLAGS) -c -o $@ $<
522 lib/sdl.so: $(PLUGIN_SDL)
523 ld -shared -lSDL -o $@ $^
524 $(PLUGIN_SDL): %.o: %.c
525 $(CC) $(CFLAGS) -c -o $@ $<
527 lib/yuv.so: $(PLUGIN_YUV)
529 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
533 $(PLUGIN_YUV): %.o: %.c
534 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
536 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
538 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
542 $(PLUGIN_YUVMMX): %.o: %.c
543 $(CC) $(CFLAGS) -c -o $@ $<
545 ################################################################################
546 # Note on generic rules and dependancies
547 ################################################################################
549 # Note on dependancies: each .c file is associated with a .d file, which
550 # depends of it. The .o file associated with a .c file depends of the .d, of the
551 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
553 # The dep directory should be ignored by CVS.
555 # Note on inclusions: depending of the target, the dependancies files must
556 # or must not be included. The problem is that if we ask make to include a file,
557 # and this file does not exist, it is made before it can be included. In a
558 # general way, a .d file should be included if and only if the corresponding .o
559 # needs to be re-made.
561 # Two makefiles are used: the main one (this one) has regular generic rules,
562 # except for .o files, for which it calls the object Makefile. Dependancies
563 # are not included in this file.
564 # The object Makefile known how to make a .o from a .c, and includes
565 # dependancies for the target, but only those required.