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
111 # Optimizations for PowerPC
112 ifneq (,$(findstring powerpc,$(ARCH)))
114 CFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
116 #CFLAGS += -mcpu=750 -mmultiple -mhard-float -mstring
118 #CFLAGS += -mcpu=7400 -mmultiple -mhard-float -mstring
121 # Optimizations for Sparc
122 ifneq (,$(findstring sparc,$(ARCH)))
123 CFLAGS += -mhard-float
129 # Eventual MMX optimizations for x86
130 ifneq (,$(findstring mmx,$(ARCH)))
134 # End of optimizations
137 # C compiler flags: dependancies
139 DCFLAGS += $(INCLUDE)
143 # C compiler flags: linking
150 # Additionnal debugging flags
153 # Debugging and profiling support
162 #################################################################################
164 #################################################################################
169 interface_obj = interface/main.o \
170 interface/interface.o \
171 interface/intf_msg.o \
172 interface/intf_cmd.o \
173 interface/intf_ctrl.o \
174 interface/intf_console.o
176 input_obj = input/input_vlan.o \
178 input/input_netlist.o \
179 input/input_network.o \
185 audio_output_obj = audio_output/audio_output.o
187 video_output_obj = video_output/video_output.o \
188 video_output/video_text.o \
189 video_output/video_spu.o \
190 video_output/video_yuv.o
192 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
193 ac3_decoder/ac3_decoder.o \
194 ac3_decoder/ac3_parse.o \
195 ac3_decoder/ac3_exponent.o \
196 ac3_decoder/ac3_bit_allocate.o \
197 ac3_decoder/ac3_mantissa.o \
198 ac3_decoder/ac3_rematrix.o \
199 ac3_decoder/ac3_imdct.o \
200 ac3_decoder/ac3_downmix.o
202 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
203 lpcm_decoder/lpcm_decoder.o
205 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
206 audio_decoder/audio_decoder.o \
207 audio_decoder/audio_math.o
209 spu_decoder_obj = spu_decoder/spu_decoder.o
211 #??generic_decoder_obj = generic_decoder/generic_decoder.o
212 # remeber to add it to OBJ
214 video_parser_obj = video_parser/video_parser.o \
215 video_parser/vpar_headers.o \
216 video_parser/vpar_blocks.o \
217 video_parser/vpar_synchro.o \
218 video_parser/video_fifo.o
220 ifneq (,$(findstring mmx,$(ARCH)))
221 vdec_motion_inner = video_decoder/vdec_motion_inner_mmx.o
223 vdec_motion_inner = video_decoder/vdec_motion_inner.o
226 video_decoder_obj = video_decoder/video_decoder.o \
227 video_decoder/vdec_motion.o \
228 video_decoder/vdec_idct.o \
231 misc_obj = misc/mtime.o \
240 C_OBJ = $(interface_obj) \
242 $(audio_output_obj) \
243 $(video_output_obj) \
245 $(lpcm_decoder_obj) \
246 $(audio_decoder_obj) \
248 $(generic_decoder_obj) \
249 $(video_parser_obj) \
250 $(video_decoder_obj) \
255 CPP_OBJ = misc/beos_specific.o
261 ifneq (,$(findstring 86,$(ARCH)))
262 ifneq (,$(findstring mmx,$(ARCH)))
263 ASM_OBJ = video_decoder/vdec_idctmmx.o \
264 video_output/video_yuv_mmx.o
271 PLUGINS := $(PLUGINS:%=lib/%.so)
273 PLUGIN_BEOS = plugins/beos/beos.o \
274 plugins/beos/aout_beos.o \
275 plugins/beos/intf_beos.o \
276 plugins/beos/vout_beos.o
278 PLUGIN_DSP = plugins/dsp/dsp.o \
279 plugins/dsp/aout_dsp.o \
281 PLUGIN_DUMMY = plugins/dummy/dummy.o \
282 plugins/dummy/aout_dummy.o \
283 plugins/dummy/intf_dummy.o \
284 plugins/dummy/vout_dummy.o
286 PLUGIN_ESD = plugins/esd/esd.o \
287 plugins/esd/aout_esd.o
289 PLUGIN_FB = plugins/fb/fb.o \
290 plugins/fb/intf_fb.o \
293 PLUGIN_GGI = plugins/ggi/ggi.o \
294 plugins/ggi/intf_ggi.o \
295 plugins/ggi/vout_ggi.o
297 PLUGIN_SDL = plugins/sdl/sdl.o \
298 plugins/sdl/intf_sdl.o \
299 plugins/sdl/vout_sdl.o
300 # plugins/sdl/video_yuv.o \
301 # plugins/sdl/video_yuvall.o
304 PLUGIN_GLIDE = plugins/glide/glide.o \
305 plugins/glide/intf_glide.o \
306 plugins/glide/vout_glide.o
308 PLUGIN_GNOME = plugins/gnome/gnome.o \
309 plugins/gnome/intf_gnome.o \
310 plugins/gnome/intf_gnome_callbacks.o \
311 plugins/gnome/intf_gnome_interface.o \
312 plugins/gnome/intf_gnome_support.o \
313 plugins/gnome/vout_gnome.o
315 PLUGIN_MGA = plugins/mga/mga.o \
316 plugins/mga/intf_mga.o \
317 plugins/mga/vout_mga.o
319 PLUGIN_X11 = plugins/x11/x11.o \
320 plugins/x11/intf_x11.o \
321 plugins/x11/vout_x11.o
323 PLUGIN_YUV = plugins/yuv/yuv.o \
324 plugins/yuv/video_yuv.o \
325 plugins/yuv/video_yuv8.o \
326 plugins/yuv/video_yuv15.o \
327 plugins/yuv/video_yuv16.o \
328 plugins/yuv/video_yuv24.o \
329 plugins/yuv/video_yuv32.o
332 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
333 plugins/yuvmmx/video_yuv.o \
334 plugins/yuvmmx/video_yuv8.o \
335 plugins/yuvmmx/video_yuv15.o \
336 plugins/yuvmmx/video_yuv16.o \
337 plugins/yuvmmx/video_yuv24.o \
338 plugins/yuvmmx/video_yuv32.o
340 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
341 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
342 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX) \
345 # Other lists of files
347 C_OBJ := $(C_OBJ:%.o=src/%.o)
348 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
349 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
350 sources_c := $(C_OBJ:%.o=%.c)
351 dependancies := $(sources_c:%.c=.dep/%.d)
353 # All symbols must be exported
356 ################################################################################
358 ################################################################################
363 all: vlc @ALIASES@ plugins
366 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
367 rm -f vlc @ALIASES@ lib/*.so
370 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
371 rm -f Makefile include/defs.h include/config.h
372 rm -f config.status config.cache config.log
373 rm -f gmon.out core build-stamp
375 rm -rf debian/tmp debian/files debian/*.debhelper debian/*.substvars
376 find debian/* -type d -maxdepth 0 -name 'vlc-*' | xargs rm -rf
379 mkdir -p $(prefix)/bin
380 $(INSTALL) vlc $(prefix)/bin
382 for alias in "" @ALIASES@ ; do if test $$alias ; then ln -s vlc $(prefix)/bin/$$alias ; fi ; done
383 mkdir -p $(prefix)/lib/videolan/vlc
384 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
385 mkdir -p $(prefix)/share/videolan
386 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
387 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
391 @echo CFLAGS: $(CFLAGS)
392 @echo DCFLAGS: $(DCFLAGS)
393 @echo LCFLAGS: $(LCFLAGS)
395 # ugliest of all, but I have no time to do it -- sam
397 rm -rf /tmp/${SNAPSHOTDIR}
398 mkdir /tmp/${SNAPSHOTDIR}
399 cp -a * /tmp/${SNAPSHOTDIR}
400 (cd /tmp/${SNAPSHOTDIR} ; \
402 find . -type d -name CVS | xargs rm -rf ; \
403 find . -type f -name '.*.swp' | xargs rm -f ; \
404 find . -type f -name '.cvsignore' | xargs rm -f ; \
406 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
407 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
408 rm -rf /tmp/${SNAPSHOTDIR}
409 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
410 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
411 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
418 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
420 $(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
421 rm -f ./plugins/_APP_
422 ln -s ../vlc ./plugins/_APP_
424 $(CC) $(CFLAGS) $(LCFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
428 # Gnome and Framebuffer aliases - don't add new aliases which could bloat
432 rm -f $@ && ln -s vlc $@
437 # Generic rules (see below)
439 $(dependancies): %.d: FORCE
440 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
442 $(C_OBJ): %.o: Makefile.dep
443 $(C_OBJ): %.o: .dep/%.d
445 $(CC) $(CFLAGS) -c -o $@ $<
447 $(CPP_OBJ): %.o: %.cpp
448 $(CC) $(CFLAGS) -c -o $@ $<
450 $(ASM_OBJ): %.o: Makefile.dep
452 $(CC) $(CFLAGS) -c -o $@ $<
454 #$(PLUGIN_OBJ): %.so: Makefile.dep
455 #$(PLUGIN_OBJ): %.so: .dep/%.d
457 lib/beos.so: $(PLUGIN_BEOS)
458 $(CC) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
459 $(PLUGIN_BEOS): %.o: %.cpp
460 $(CC) $(CFLAGS) -c -o $@ $<
462 lib/esd.so: $(PLUGIN_ESD)
463 ifneq (,$(findstring bsd,$(SYS)))
464 ld -shared -lesd -o $@ $^
466 ld -shared -laudiofile -lesd -o $@ $^
468 $(PLUGIN_ESD): %.o: %.c
469 $(CC) $(CFLAGS) -c -o $@ $<
471 lib/dsp.so: $(PLUGIN_DSP)
473 $(PLUGIN_DSP): %.o: %.c
474 $(CC) $(CFLAGS) -c -o $@ $<
476 lib/dummy.so: $(PLUGIN_DUMMY)
478 $(PLUGIN_DUMMY): %.o: %.c
479 $(CC) $(CFLAGS) -c -o $@ $<
481 lib/fb.so: $(PLUGIN_FB)
483 $(PLUGIN_FB): %.o: %.c
484 $(CC) $(CFLAGS) -c -o $@ $<
486 lib/x11.so: $(PLUGIN_X11)
487 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
488 $(PLUGIN_X11): %.o: %.c
489 $(CC) $(CFLAGS) -c -o $@ $<
491 lib/mga.so: $(PLUGIN_MGA)
492 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
493 $(PLUGIN_MGA): %.o: %.c
494 $(CC) $(CFLAGS) -c -o $@ $<
496 lib/gnome.so: $(PLUGIN_GNOME)
497 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
498 $(PLUGIN_GNOME): %.o: %.c
499 $(CC) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
501 lib/glide.so: $(PLUGIN_GLIDE)
502 ld -shared -lglide2x -o $@ $^
503 $(PLUGIN_GLIDE): %.o: %.c
504 $(CC) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
506 lib/ggi.so: $(PLUGIN_GGI)
507 ld -shared -lggi -o $@ $^
508 $(PLUGIN_GGI): %.o: %.c
509 $(CC) $(CFLAGS) -c -o $@ $<
511 lib/sdl.so: $(PLUGIN_SDL)
512 ld -shared -lSDL -o $@ $^
513 $(PLUGIN_SDL): %.o: %.c
514 $(CC) $(CFLAGS) -c -o $@ $<
516 lib/yuv.so: $(PLUGIN_YUV)
518 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
522 $(PLUGIN_YUV): %.o: %.c
523 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
525 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
527 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
531 $(PLUGIN_YUVMMX): %.o: %.c
532 $(CC) $(CFLAGS) -c -o $@ $<
534 ################################################################################
535 # Note on generic rules and dependancies
536 ################################################################################
538 # Note on dependancies: each .c file is associated with a .d file, which
539 # depends of it. The .o file associated with a .c file depends of the .d, of the
540 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
542 # The dep directory should be ignored by CVS.
544 # Note on inclusions: depending of the target, the dependancies files must
545 # or must not be included. The problem is that if we ask make to include a file,
546 # and this file does not exist, it is made before it can be included. In a
547 # general way, a .d file should be included if and only if the corresponding .o
548 # needs to be re-made.
550 # Two makefiles are used: the main one (this one) has regular generic rules,
551 # except for .o files, for which it calls the object Makefile. Dependancies
552 # are not included in this file.
553 # The object Makefile known how to make a .o from a .c, and includes
554 # dependancies for the target, but only those required.