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 CFLAGS += $(DEFINE) $(INCLUDE)
83 CFLAGS += -Wall -Winline
84 CFLAGS += -D_REENTRANT
85 CFLAGS += -D_GNU_SOURCE
87 # flags needed for clean beos compilation
89 CFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
92 # Optimizations : don't compile debug versions with them
95 CFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
96 CFLAGS += -fomit-frame-pointer
98 # Optimizations for x86 familiy
99 ifneq (,$(findstring 86,$(ARCH)))
100 CFLAGS += -malign-double
101 # Eventual Pentium Pro optimizations
102 ifneq (,$(findstring ppro,$(ARCH)))
104 CFLAGS += -march=pentiumpro
107 CFLAGS += -march=pentium
109 # Eventual MMX optimizations for x86
110 ifneq (,$(findstring mmx,$(ARCH)))
115 # Optimizations for PowerPC
116 ifneq (,$(findstring powerpc,$(ARCH)))
118 CFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
120 #CFLAGS += -mcpu=750 -mmultiple -mhard-float -mstring
122 #CFLAGS += -mcpu=7400 -mmultiple -mhard-float -mstring
125 # Optimizations for Sparc
126 ifneq (,$(findstring sparc,$(ARCH)))
127 CFLAGS += -mhard-float
130 # End of optimizations
134 # C compiler flags: dependancies
136 DCFLAGS += $(INCLUDE)
140 # C compiler flags: linking
147 # Additionnal debugging flags
150 # Debugging and profiling support
159 #################################################################################
161 #################################################################################
166 interface_obj = interface/main.o \
167 interface/interface.o \
168 interface/intf_msg.o \
169 interface/intf_cmd.o \
170 interface/intf_ctrl.o \
171 interface/intf_console.o
173 input_obj = input/input_vlan.o \
175 input/input_netlist.o \
176 input/input_network.o \
182 audio_output_obj = audio_output/audio_output.o
184 video_output_obj = video_output/video_output.o \
185 video_output/video_text.o \
186 video_output/video_spu.o \
187 video_output/video_yuv.o
189 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
190 ac3_decoder/ac3_decoder.o \
191 ac3_decoder/ac3_parse.o \
192 ac3_decoder/ac3_exponent.o \
193 ac3_decoder/ac3_bit_allocate.o \
194 ac3_decoder/ac3_mantissa.o \
195 ac3_decoder/ac3_rematrix.o \
196 ac3_decoder/ac3_imdct.o \
197 ac3_decoder/ac3_downmix.o
199 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
200 lpcm_decoder/lpcm_decoder.o
202 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
203 audio_decoder/audio_decoder.o \
204 audio_decoder/audio_math.o
206 spu_decoder_obj = spu_decoder/spu_decoder.o
208 #??generic_decoder_obj = generic_decoder/generic_decoder.o
209 # remeber to add it to OBJ
211 video_parser_obj = video_parser/video_parser.o \
212 video_parser/vpar_headers.o \
213 video_parser/vpar_blocks.o \
214 video_parser/vpar_synchro.o \
215 video_parser/video_fifo.o
217 ifneq (,$(findstring mmx,$(ARCH)))
218 vdec_motion_inner = video_decoder/vdec_motion_inner_mmx.o
220 vdec_motion_inner = video_decoder/vdec_motion_inner.o
223 video_decoder_obj = video_decoder/video_decoder.o \
224 video_decoder/vdec_motion.o \
225 video_decoder/vdec_idct.o \
228 misc_obj = misc/mtime.o \
237 C_OBJ = $(interface_obj) \
239 $(audio_output_obj) \
240 $(video_output_obj) \
242 $(lpcm_decoder_obj) \
243 $(audio_decoder_obj) \
245 $(generic_decoder_obj) \
246 $(video_parser_obj) \
247 $(video_decoder_obj) \
252 CPP_OBJ = misc/beos_specific.o
258 ifneq (,$(findstring 86,$(ARCH)))
259 ifneq (,$(findstring mmx,$(ARCH)))
260 ASM_OBJ = video_decoder/vdec_idctmmx.o \
261 video_output/video_yuv_mmx.o
268 PLUGINS := $(PLUGINS:%=lib/%.so)
270 PLUGIN_BEOS = plugins/beos/beos.o \
271 plugins/beos/aout_beos.o \
272 plugins/beos/intf_beos.o \
273 plugins/beos/vout_beos.o
275 PLUGIN_DSP = plugins/dsp/dsp.o \
276 plugins/dsp/aout_dsp.o \
278 PLUGIN_DUMMY = plugins/dummy/dummy.o \
279 plugins/dummy/aout_dummy.o \
280 plugins/dummy/intf_dummy.o \
281 plugins/dummy/vout_dummy.o
283 PLUGIN_ESD = plugins/esd/esd.o \
284 plugins/esd/aout_esd.o
286 PLUGIN_FB = plugins/fb/fb.o \
287 plugins/fb/intf_fb.o \
290 PLUGIN_GGI = plugins/ggi/ggi.o \
291 plugins/ggi/intf_ggi.o \
292 plugins/ggi/vout_ggi.o
294 PLUGIN_SDL = plugins/sdl/sdl.o \
295 plugins/sdl/intf_sdl.o \
296 plugins/sdl/vout_sdl.o
298 PLUGIN_GLIDE = plugins/glide/glide.o \
299 plugins/glide/intf_glide.o \
300 plugins/glide/vout_glide.o
302 PLUGIN_GNOME = plugins/gnome/gnome.o \
303 plugins/gnome/intf_gnome.o \
304 plugins/gnome/intf_gnome_callbacks.o \
305 plugins/gnome/intf_gnome_interface.o \
306 plugins/gnome/intf_gnome_support.o \
307 plugins/gnome/vout_gnome.o
309 PLUGIN_MGA = plugins/mga/mga.o \
310 plugins/mga/intf_mga.o \
311 plugins/mga/vout_mga.o
313 PLUGIN_X11 = plugins/x11/x11.o \
314 plugins/x11/intf_x11.o \
315 plugins/x11/vout_x11.o
317 PLUGIN_YUV = plugins/yuv/yuv.o \
318 plugins/yuv/video_yuv.o \
319 plugins/yuv/video_yuv8.o \
320 plugins/yuv/video_yuv15.o \
321 plugins/yuv/video_yuv16.o \
322 plugins/yuv/video_yuv24.o \
323 plugins/yuv/video_yuv32.o
325 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
326 plugins/yuvmmx/video_yuv.o \
327 plugins/yuvmmx/video_yuv8.o \
328 plugins/yuvmmx/video_yuv15.o \
329 plugins/yuvmmx/video_yuv16.o \
330 plugins/yuvmmx/video_yuv24.o \
331 plugins/yuvmmx/video_yuv32.o
333 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
334 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
335 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX) \
338 # Other lists of files
340 C_OBJ := $(C_OBJ:%.o=src/%.o)
341 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
342 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
343 sources_c := $(C_OBJ:%.o=%.c)
344 dependancies := $(sources_c:%.c=.dep/%.d)
346 # All symbols must be exported
349 ################################################################################
351 ################################################################################
356 all: vlc @ALIASES@ plugins
359 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
360 rm -f vlc @ALIASES@ lib/*.so
363 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
364 rm -f Makefile include/defs.h include/config.h
365 rm -f config.status config.cache config.log
366 rm -f gmon.out core build-stamp
368 rm -rf debian/tmp debian/*.debhelper debian/*.substvars
369 find debian/* -type d -maxdepth 0 -name 'vlc-*' | xargs rm -rf
372 mkdir -p $(prefix)/bin
373 $(INSTALL) vlc $(prefix)/bin
374 for alias in @ALIASES@ ; do ln -s vlc $(prefix)/bin/$$alias ; done
375 mkdir -p $(prefix)/lib/videolan/vlc
376 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
377 mkdir -p $(prefix)/share/videolan
378 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
379 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
383 @echo CFLAGS: $(CFLAGS)
384 @echo DCFLAGS: $(DCFLAGS)
385 @echo LCFLAGS: $(LCFLAGS)
387 # ugliest of all, but I have no time to do it -- sam
389 rm -rf /tmp/${SNAPSHOTDIR}
390 mkdir /tmp/${SNAPSHOTDIR}
391 cp -r * /tmp/${SNAPSHOTDIR}
392 (cd /tmp/${SNAPSHOTDIR} ; \
394 find . -type d -name CVS | xargs rm -rf ; \
395 find . -type f -name '.*.swp' | xargs rm -f ; \
396 find . -type f -name '.cvsignore' | xargs rm -f ; \
398 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
399 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
400 rm -rf /tmp/${SNAPSHOTDIR}
401 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
402 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
403 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
410 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
412 $(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
413 rm -f ./plugins/_APP_
414 ln -s ../vlc ./plugins/_APP_
416 $(CC) $(CFLAGS) $(LCFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
420 # Gnome and Framebuffer aliases - don't add new aliases which could bloat
424 rm -f $@ && ln -s vlc $@
429 # Generic rules (see below)
431 $(dependancies): %.d: FORCE
432 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
434 $(C_OBJ): %.o: Makefile.dep
435 $(C_OBJ): %.o: .dep/%.d
437 $(CC) $(CFLAGS) -c -o $@ $<
439 $(CPP_OBJ): %.o: %.cpp
440 $(CC) $(CFLAGS) -c -o $@ $<
442 $(ASM_OBJ): %.o: Makefile.dep
444 $(CC) $(CFLAGS) -c -o $@ $<
446 #$(PLUGIN_OBJ): %.so: Makefile.dep
447 #$(PLUGIN_OBJ): %.so: .dep/%.d
449 lib/beos.so: $(PLUGIN_BEOS)
450 $(CC) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
451 $(PLUGIN_BEOS): %.o: %.cpp
452 $(CC) $(CFLAGS) -c -o $@ $<
454 lib/esd.so: $(PLUGIN_ESD)
455 ifneq (,$(findstring bsd,$(SYS)))
456 ld -shared -lesd -o $@ $^
458 ld -shared -laudiofile -lesd -o $@ $^
460 $(PLUGIN_ESD): %.o: %.c
461 $(CC) $(CFLAGS) -c -o $@ $<
463 lib/dsp.so: $(PLUGIN_DSP)
465 $(PLUGIN_DSP): %.o: %.c
466 $(CC) $(CFLAGS) -c -o $@ $<
468 lib/dummy.so: $(PLUGIN_DUMMY)
470 $(PLUGIN_DUMMY): %.o: %.c
471 $(CC) $(CFLAGS) -c -o $@ $<
473 lib/fb.so: $(PLUGIN_FB)
475 $(PLUGIN_FB): %.o: %.c
476 $(CC) $(CFLAGS) -c -o $@ $<
478 lib/x11.so: $(PLUGIN_X11)
479 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
480 $(PLUGIN_X11): %.o: %.c
481 $(CC) $(CFLAGS) -c -o $@ $<
483 lib/mga.so: $(PLUGIN_MGA)
484 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
485 $(PLUGIN_MGA): %.o: %.c
486 $(CC) $(CFLAGS) -c -o $@ $<
488 lib/gnome.so: $(PLUGIN_GNOME)
489 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
490 $(PLUGIN_GNOME): %.o: %.c
491 $(CC) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
493 lib/glide.so: $(PLUGIN_GLIDE)
494 ld -shared -lglide2x -o $@ $^
495 $(PLUGIN_GLIDE): %.o: %.c
496 $(CC) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
498 lib/ggi.so: $(PLUGIN_GGI)
499 ld -shared -lggi -o $@ $^
500 $(PLUGIN_GGI): %.o: %.c
501 $(CC) $(CFLAGS) -c -o $@ $<
503 lib/sdl.so: $(PLUGIN_SDL)
504 ld -shared -lSDL -o $@ $^
505 $(PLUGIN_SDL): %.o: %.c
506 $(CC) $(CFLAGS) -c -o $@ $<
508 lib/yuv.so: $(PLUGIN_YUV)
510 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
514 $(PLUGIN_YUV): %.o: %.c
515 $(CC) $(CFLAGS) -c -o $@ $<
517 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
519 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
523 $(PLUGIN_YUVMMX): %.o: %.c
524 $(CC) $(CFLAGS) -c -o $@ $<
526 ################################################################################
527 # Note on generic rules and dependancies
528 ################################################################################
530 # Note on dependancies: each .c file is associated with a .d file, which
531 # depends of it. The .o file associated with a .c file depends of the .d, of the
532 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
534 # The dep directory should be ignored by CVS.
536 # Note on inclusions: depending of the target, the dependancies files must
537 # or must not be included. The problem is that if we ask make to include a file,
538 # and this file does not exist, it is made before it can be included. In a
539 # general way, a .d file should be included if and only if the corresponding .o
540 # needs to be re-made.
542 # Two makefiles are used: the main one (this one) has regular generic rules,
543 # except for .o files, for which it calls the object Makefile. Dependancies
544 # are not included in this file.
545 # The object Makefile known how to make a .o from a .c, and includes
546 # dependancies for the target, but only those required.