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 += -fomit-frame-pointer
104 # Optimizations for x86 familiy
105 ifneq (,$(findstring 86,$(ARCH)))
106 CFLAGS += -malign-double
107 # Optional Pentium Pro optimizations
108 ifneq (,$(findstring ppro,$(ARCH)))
110 CFLAGS += -march=pentiumpro
113 CFLAGS += -march=pentium
117 # Optimizations for PowerPC
118 ifneq (,$(findstring powerpc,$(ARCH)))
120 CFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
122 #CFLAGS += -mcpu=750 -mmultiple -mhard-float -mstring
124 #CFLAGS += -mcpu=7400 -mmultiple -mhard-float -mstring
127 # Optimizations for Sparc
128 ifneq (,$(findstring sparc,$(ARCH)))
129 CFLAGS += -mhard-float
135 # Optional MMX optimizations for x86
136 ifneq (,$(findstring mmx,$(ARCH)))
140 # End of optimizations
143 # C compiler flags: dependancies
145 DCFLAGS += $(INCLUDE)
149 # C compiler flags: linking
156 # Additionnal debugging flags
159 # Debugging and profiling support
164 #################################################################################
166 #################################################################################
171 interface_obj = interface/main.o \
172 interface/interface.o \
173 interface/intf_msg.o \
174 interface/intf_cmd.o \
175 interface/intf_ctrl.o \
176 interface/intf_console.o
178 input_obj = input/input_vlan.o \
180 input/input_netlist.o \
181 input/input_network.o \
187 audio_output_obj = audio_output/audio_output.o
189 video_output_obj = video_output/video_output.o \
190 video_output/video_text.o \
191 video_output/video_spu.o \
192 video_output/video_yuv.o
194 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
195 ac3_decoder/ac3_decoder.o \
196 ac3_decoder/ac3_parse.o \
197 ac3_decoder/ac3_exponent.o \
198 ac3_decoder/ac3_bit_allocate.o \
199 ac3_decoder/ac3_mantissa.o \
200 ac3_decoder/ac3_rematrix.o \
201 ac3_decoder/ac3_imdct.o \
202 ac3_decoder/ac3_downmix.o
204 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
205 lpcm_decoder/lpcm_decoder.o
207 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
208 audio_decoder/audio_decoder.o \
209 audio_decoder/audio_math.o
211 spu_decoder_obj = spu_decoder/spu_decoder.o
213 #??generic_decoder_obj = generic_decoder/generic_decoder.o
214 # remeber to add it to OBJ
216 video_parser_obj = video_parser/video_parser.o \
217 video_parser/vpar_headers.o \
218 video_parser/vpar_blocks.o \
219 video_parser/vpar_synchro.o \
220 video_parser/video_fifo.o
222 ifneq (,$(findstring mmx,$(ARCH)))
223 vdec_motion_inner = video_decoder/vdec_motion_inner_mmx.o
225 vdec_motion_inner = video_decoder/vdec_motion_inner.o
228 video_decoder_obj = video_decoder/video_decoder.o \
229 video_decoder/vdec_motion.o \
230 video_decoder/vdec_idct.o \
233 misc_obj = misc/mtime.o \
242 C_OBJ = $(interface_obj) \
244 $(audio_output_obj) \
245 $(video_output_obj) \
247 $(lpcm_decoder_obj) \
248 $(audio_decoder_obj) \
250 $(generic_decoder_obj) \
251 $(video_parser_obj) \
252 $(video_decoder_obj) \
257 CPP_OBJ = misc/beos_specific.o
263 ifneq (,$(findstring 86,$(ARCH)))
264 ifneq (,$(findstring mmx,$(ARCH)))
265 ASM_OBJ = video_decoder/vdec_idctmmx.o \
266 video_output/video_yuv_mmx.o
273 PLUGINS := $(PLUGINS:%=lib/%.so)
275 PLUGIN_BEOS = plugins/beos/beos.o \
276 plugins/beos/aout_beos.o \
277 plugins/beos/intf_beos.o \
278 plugins/beos/vout_beos.o
280 PLUGIN_DSP = plugins/dsp/dsp.o \
281 plugins/dsp/aout_dsp.o \
283 PLUGIN_DUMMY = plugins/dummy/dummy.o \
284 plugins/dummy/aout_dummy.o \
285 plugins/dummy/intf_dummy.o \
286 plugins/dummy/vout_dummy.o
288 PLUGIN_ESD = plugins/esd/esd.o \
289 plugins/esd/aout_esd.o
291 PLUGIN_FB = plugins/fb/fb.o \
292 plugins/fb/intf_fb.o \
295 PLUGIN_GGI = plugins/ggi/ggi.o \
296 plugins/ggi/intf_ggi.o \
297 plugins/ggi/vout_ggi.o
299 PLUGIN_SDL = plugins/sdl/sdl.o \
300 plugins/sdl/intf_sdl.o \
301 plugins/sdl/vout_sdl.o
302 # plugins/sdl/video_yuv.o \
303 # plugins/sdl/video_yuvall.o
306 PLUGIN_GLIDE = plugins/glide/glide.o \
307 plugins/glide/intf_glide.o \
308 plugins/glide/vout_glide.o
310 PLUGIN_GNOME = plugins/gnome/gnome.o \
311 plugins/gnome/intf_gnome.o \
312 plugins/gnome/intf_gnome_callbacks.o \
313 plugins/gnome/intf_gnome_interface.o \
314 plugins/gnome/intf_gnome_support.o \
315 plugins/gnome/vout_gnome.o
317 PLUGIN_MGA = plugins/mga/mga.o \
318 plugins/mga/intf_mga.o \
319 plugins/mga/vout_mga.o
321 PLUGIN_X11 = plugins/x11/x11.o \
322 plugins/x11/intf_x11.o \
323 plugins/x11/vout_x11.o
325 PLUGIN_YUV = plugins/yuv/yuv.o \
326 plugins/yuv/video_yuv.o \
327 plugins/yuv/video_yuv8.o \
328 plugins/yuv/video_yuv15.o \
329 plugins/yuv/video_yuv16.o \
330 plugins/yuv/video_yuv24.o \
331 plugins/yuv/video_yuv32.o
334 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
335 plugins/yuvmmx/video_yuv.o \
336 plugins/yuvmmx/video_yuv8.o \
337 plugins/yuvmmx/video_yuv15.o \
338 plugins/yuvmmx/video_yuv16.o \
339 plugins/yuvmmx/video_yuv24.o \
340 plugins/yuvmmx/video_yuv32.o
342 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
343 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
344 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX) \
347 # Other lists of files
349 C_OBJ := $(C_OBJ:%.o=src/%.o)
350 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
351 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
352 sources_c := $(C_OBJ:%.o=%.c)
353 dependancies := $(sources_c:%.c=.dep/%.d)
355 # All symbols must be exported
358 ################################################################################
360 ################################################################################
365 all: vlc @ALIASES@ plugins
368 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
369 rm -f vlc @ALIASES@ lib/*.so
372 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
373 rm -f Makefile include/defs.h include/config.h
374 rm -f config.status config.cache config.log
375 rm -f gmon.out core build-stamp
377 rm -rf debian/tmp debian/files debian/*.debhelper debian/*.substvars
378 find debian/* -type d -maxdepth 0 -name 'vlc-*' | xargs rm -rf
381 mkdir -p $(prefix)/bin
382 $(INSTALL) vlc $(prefix)/bin
384 for alias in "" @ALIASES@ ; do if test $$alias ; then ln -s vlc $(prefix)/bin/$$alias ; fi ; done
385 mkdir -p $(prefix)/lib/videolan/vlc
386 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
387 mkdir -p $(prefix)/share/videolan
388 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
389 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
393 @echo CFLAGS: $(CFLAGS)
394 @echo DCFLAGS: $(DCFLAGS)
395 @echo LCFLAGS: $(LCFLAGS)
397 # ugliest of all, but I have no time to do it -- sam
399 rm -rf /tmp/${SNAPSHOTDIR}
400 mkdir /tmp/${SNAPSHOTDIR}
401 cp -a * /tmp/${SNAPSHOTDIR}
402 (cd /tmp/${SNAPSHOTDIR} ; \
404 find . -type d -name CVS | xargs rm -rf ; \
405 find . -type f -name '.*.swp' | xargs rm -f ; \
406 find . -type f -name '.cvsignore' | xargs rm -f ; \
408 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
409 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
410 rm -rf /tmp/${SNAPSHOTDIR}
411 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
412 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
413 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
420 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
422 $(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
423 rm -f ./plugins/_APP_
424 ln -s ../vlc ./plugins/_APP_
426 $(CC) $(CFLAGS) $(LCFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
430 # Gnome and Framebuffer aliases - don't add new aliases which could bloat
434 rm -f $@ && ln -s vlc $@
439 # Generic rules (see below)
441 $(dependancies): %.d: FORCE
442 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
444 $(C_OBJ): %.o: Makefile.dep
445 $(C_OBJ): %.o: .dep/%.d
447 $(CC) $(CFLAGS) -c -o $@ $<
449 $(CPP_OBJ): %.o: %.cpp
450 $(CC) $(CFLAGS) -c -o $@ $<
452 $(ASM_OBJ): %.o: Makefile.dep
454 $(CC) $(CFLAGS) -c -o $@ $<
456 #$(PLUGIN_OBJ): %.so: Makefile.dep
457 #$(PLUGIN_OBJ): %.so: .dep/%.d
459 lib/beos.so: $(PLUGIN_BEOS)
460 $(CC) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
461 $(PLUGIN_BEOS): %.o: %.cpp
462 $(CC) $(CFLAGS) -c -o $@ $<
464 lib/esd.so: $(PLUGIN_ESD)
465 ifneq (,$(findstring bsd,$(SYS)))
466 ld -shared -lesd -o $@ $^
468 ld -shared -laudiofile -lesd -o $@ $^
470 $(PLUGIN_ESD): %.o: %.c
471 $(CC) $(CFLAGS) -c -o $@ $<
473 lib/dsp.so: $(PLUGIN_DSP)
475 $(PLUGIN_DSP): %.o: %.c
476 $(CC) $(CFLAGS) -c -o $@ $<
478 lib/dummy.so: $(PLUGIN_DUMMY)
480 $(PLUGIN_DUMMY): %.o: %.c
481 $(CC) $(CFLAGS) -c -o $@ $<
483 lib/fb.so: $(PLUGIN_FB)
485 $(PLUGIN_FB): %.o: %.c
486 $(CC) $(CFLAGS) -c -o $@ $<
488 lib/x11.so: $(PLUGIN_X11)
489 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
490 $(PLUGIN_X11): %.o: %.c
491 $(CC) $(CFLAGS) -c -o $@ $<
493 lib/mga.so: $(PLUGIN_MGA)
494 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
495 $(PLUGIN_MGA): %.o: %.c
496 $(CC) $(CFLAGS) -c -o $@ $<
498 lib/gnome.so: $(PLUGIN_GNOME)
499 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
500 $(PLUGIN_GNOME): %.o: %.c
501 $(CC) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
503 lib/glide.so: $(PLUGIN_GLIDE)
504 ld -shared -lglide2x -o $@ $^
505 $(PLUGIN_GLIDE): %.o: %.c
506 $(CC) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
508 lib/ggi.so: $(PLUGIN_GGI)
509 ld -shared -lggi -o $@ $^
510 $(PLUGIN_GGI): %.o: %.c
511 $(CC) $(CFLAGS) -c -o $@ $<
513 lib/sdl.so: $(PLUGIN_SDL)
514 ld -shared -lSDL -o $@ $^
515 $(PLUGIN_SDL): %.o: %.c
516 $(CC) $(CFLAGS) -c -o $@ $<
518 lib/yuv.so: $(PLUGIN_YUV)
520 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
524 $(PLUGIN_YUV): %.o: %.c
525 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
527 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
529 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
533 $(PLUGIN_YUVMMX): %.o: %.c
534 $(CC) $(CFLAGS) -c -o $@ $<
536 ################################################################################
537 # Note on generic rules and dependancies
538 ################################################################################
540 # Note on dependancies: each .c file is associated with a .d file, which
541 # depends of it. The .o file associated with a .c file depends of the .d, of the
542 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
544 # The dep directory should be ignored by CVS.
546 # Note on inclusions: depending of the target, the dependancies files must
547 # or must not be included. The problem is that if we ask make to include a file,
548 # and this file does not exist, it is made before it can be included. In a
549 # general way, a .d file should be included if and only if the corresponding .o
550 # needs to be re-made.
552 # Two makefiles are used: the main one (this one) has regular generic rules,
553 # except for .o files, for which it calls the object Makefile. Dependancies
554 # are not included in this file.
555 # The object Makefile known how to make a .o from a .c, and includes
556 # dependancies for the target, but only those required.