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_ps.o \
180 input/mpeg_system.o \
181 input/input_ext-dec.o \
184 audio_output_obj = audio_output/audio_output.o
186 video_output_obj = video_output/video_output.o \
187 video_output/video_text.o \
188 video_output/video_spu.o \
189 video_output/video_yuv.o
191 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
192 ac3_decoder/ac3_decoder.o \
193 ac3_decoder/ac3_parse.o \
194 ac3_decoder/ac3_exponent.o \
195 ac3_decoder/ac3_bit_allocate.o \
196 ac3_decoder/ac3_mantissa.o \
197 ac3_decoder/ac3_rematrix.o \
198 ac3_decoder/ac3_imdct.o \
199 ac3_decoder/ac3_downmix.o
201 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
202 lpcm_decoder/lpcm_decoder.o
204 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
205 audio_decoder/audio_decoder.o \
206 audio_decoder/audio_math.o
208 spu_decoder_obj = spu_decoder/spu_decoder.o
210 #??generic_decoder_obj = generic_decoder/generic_decoder.o
211 # remeber to add it to OBJ
213 video_parser_obj = video_parser/video_parser.o \
214 video_parser/vpar_headers.o \
215 video_parser/vpar_blocks.o \
216 video_parser/vpar_synchro.o \
217 video_parser/video_fifo.o
219 ifneq (,$(findstring mmx,$(ARCH)))
220 vdec_motion_inner = video_decoder/vdec_motion_inner_mmx.o
222 vdec_motion_inner = video_decoder/vdec_motion_inner.o
225 video_decoder_obj = video_decoder/video_decoder.o \
226 video_decoder/vdec_motion.o \
227 video_decoder/vdec_idct.o \
230 misc_obj = misc/mtime.o \
238 C_OBJ = $(interface_obj) \
240 $(audio_output_obj) \
241 $(video_output_obj) \
243 $(lpcm_decoder_obj) \
244 $(audio_decoder_obj) \
246 $(generic_decoder_obj) \
247 $(video_parser_obj) \
248 $(video_decoder_obj) \
253 CPP_OBJ = misc/beos_specific.o
259 ifneq (,$(findstring 86,$(ARCH)))
260 ifneq (,$(findstring mmx,$(ARCH)))
261 ASM_OBJ = video_decoder/vdec_idctmmx.o \
262 video_output/video_yuv_mmx.o
269 PLUGINS := $(PLUGINS:%=lib/%.so)
271 PLUGIN_BEOS = plugins/beos/beos.o \
272 plugins/beos/aout_beos.o \
273 plugins/beos/intf_beos.o \
274 plugins/beos/vout_beos.o
276 PLUGIN_DSP = plugins/dsp/dsp.o \
277 plugins/dsp/aout_dsp.o \
279 PLUGIN_DUMMY = plugins/dummy/dummy.o \
280 plugins/dummy/aout_dummy.o \
281 plugins/dummy/intf_dummy.o \
282 plugins/dummy/vout_dummy.o
284 PLUGIN_ESD = plugins/esd/esd.o \
285 plugins/esd/aout_esd.o
287 PLUGIN_FB = plugins/fb/fb.o \
288 plugins/fb/intf_fb.o \
291 PLUGIN_GGI = plugins/ggi/ggi.o \
292 plugins/ggi/intf_ggi.o \
293 plugins/ggi/vout_ggi.o
295 PLUGIN_SDL = plugins/sdl/sdl.o \
296 plugins/sdl/intf_sdl.o \
297 plugins/sdl/vout_sdl.o
298 # plugins/sdl/video_yuv.o \
299 # plugins/sdl/video_yuvall.o
302 PLUGIN_GLIDE = plugins/glide/glide.o \
303 plugins/glide/intf_glide.o \
304 plugins/glide/vout_glide.o
306 PLUGIN_GNOME = plugins/gnome/gnome.o \
307 plugins/gnome/intf_gnome.o \
308 plugins/gnome/intf_gnome_callbacks.o \
309 plugins/gnome/intf_gnome_interface.o \
310 plugins/gnome/intf_gnome_support.o \
311 plugins/gnome/vout_gnome.o
313 PLUGIN_MGA = plugins/mga/mga.o \
314 plugins/mga/intf_mga.o \
315 plugins/mga/vout_mga.o
317 PLUGIN_X11 = plugins/x11/x11.o \
318 plugins/x11/intf_x11.o \
319 plugins/x11/vout_x11.o
321 PLUGIN_YUV = plugins/yuv/yuv.o \
322 plugins/yuv/video_yuv.o \
323 plugins/yuv/video_yuv8.o \
324 plugins/yuv/video_yuv15.o \
325 plugins/yuv/video_yuv16.o \
326 plugins/yuv/video_yuv24.o \
327 plugins/yuv/video_yuv32.o
330 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
331 plugins/yuvmmx/video_yuv.o \
332 plugins/yuvmmx/video_yuv8.o \
333 plugins/yuvmmx/video_yuv15.o \
334 plugins/yuvmmx/video_yuv16.o \
335 plugins/yuvmmx/video_yuv24.o \
336 plugins/yuvmmx/video_yuv32.o
338 PLUGIN_ALSA = plugins/alsa/alsa.o \
339 plugins/alsa/aout_alsa.o
341 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
342 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
343 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX) \
344 $(PLUGIN_SDL) $(PLUGIN_ALSA)
346 # Other lists of files
348 C_OBJ := $(C_OBJ:%.o=src/%.o)
349 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
350 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
351 sources_c := $(C_OBJ:%.o=%.c)
352 dependancies := $(sources_c:%.c=.dep/%.d)
354 # All symbols must be exported
357 ################################################################################
359 ################################################################################
364 all: vlc @ALIASES@ plugins
367 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
368 rm -f vlc @ALIASES@ lib/*.so
371 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
372 rm -f Makefile include/defs.h include/config.h
373 rm -f config.status config.cache config.log
374 rm -f gmon.out core build-stamp
376 rm -rf debian/tmp debian/files debian/*.debhelper debian/*.substvars
377 find debian/* -type d -maxdepth 0 -name 'vlc-*' | xargs rm -rf
380 mkdir -p $(prefix)/bin
381 $(INSTALL) vlc $(prefix)/bin
383 for alias in "" @ALIASES@ ; do if test $$alias ; then ln -s vlc $(prefix)/bin/$$alias ; fi ; done
384 mkdir -p $(prefix)/lib/videolan/vlc
385 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
386 mkdir -p $(prefix)/share/videolan
387 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
388 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
392 @echo CFLAGS: $(CFLAGS)
393 @echo DCFLAGS: $(DCFLAGS)
394 @echo LCFLAGS: $(LCFLAGS)
396 # ugliest of all, but I have no time to do it -- sam
398 rm -rf /tmp/${SNAPSHOTDIR}
399 mkdir /tmp/${SNAPSHOTDIR}
400 cp -a * /tmp/${SNAPSHOTDIR}
401 (cd /tmp/${SNAPSHOTDIR} ; \
403 find . -type d -name CVS | xargs rm -rf ; \
404 find . -type f -name '.*.swp' | xargs rm -f ; \
405 find . -type f -name '.cvsignore' | xargs rm -f ; \
407 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
408 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
409 rm -rf /tmp/${SNAPSHOTDIR}
410 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
411 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
412 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
419 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
421 $(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
422 rm -f ./plugins/_APP_
423 ln -s ../vlc ./plugins/_APP_
425 $(CC) $(CFLAGS) $(LCFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
429 # Gnome and Framebuffer aliases - don't add new aliases which could bloat
433 rm -f $@ && ln -s vlc $@
438 # Generic rules (see below)
440 $(dependancies): %.d: FORCE
441 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
443 $(C_OBJ): %.o: Makefile.dep
444 $(C_OBJ): %.o: .dep/%.d
446 $(CC) $(CFLAGS) -c -o $@ $<
448 $(CPP_OBJ): %.o: %.cpp
449 $(CC) $(CFLAGS) -c -o $@ $<
451 $(ASM_OBJ): %.o: Makefile.dep
453 $(CC) $(CFLAGS) -c -o $@ $<
455 #$(PLUGIN_OBJ): %.so: Makefile.dep
456 #$(PLUGIN_OBJ): %.so: .dep/%.d
458 lib/beos.so: $(PLUGIN_BEOS)
459 $(CC) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
460 $(PLUGIN_BEOS): %.o: %.cpp
461 $(CC) $(CFLAGS) -c -o $@ $<
463 lib/esd.so: $(PLUGIN_ESD)
464 ifneq (,$(findstring bsd,$(SYS)))
465 ld -shared -lesd -o $@ $^
467 ld -shared -laudiofile -lesd -o $@ $^
469 $(PLUGIN_ESD): %.o: %.c
470 $(CC) $(CFLAGS) -c -o $@ $<
472 lib/dsp.so: $(PLUGIN_DSP)
474 $(PLUGIN_DSP): %.o: %.c
475 $(CC) $(CFLAGS) -c -o $@ $<
477 lib/alsa.so: $(PLUGIN_ALSA)
479 $(PLUGIN_ALSA): %.o: %.c
480 $(CC) $(CFLAGS) -c -o $@ $<
482 lib/dummy.so: $(PLUGIN_DUMMY)
484 $(PLUGIN_DUMMY): %.o: %.c
485 $(CC) $(CFLAGS) -c -o $@ $<
487 lib/fb.so: $(PLUGIN_FB)
489 $(PLUGIN_FB): %.o: %.c
490 $(CC) $(CFLAGS) -c -o $@ $<
492 lib/x11.so: $(PLUGIN_X11)
493 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
494 $(PLUGIN_X11): %.o: %.c
495 $(CC) $(CFLAGS) -c -o $@ $<
497 lib/mga.so: $(PLUGIN_MGA)
498 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
499 $(PLUGIN_MGA): %.o: %.c
500 $(CC) $(CFLAGS) -c -o $@ $<
502 lib/gnome.so: $(PLUGIN_GNOME)
503 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
504 $(PLUGIN_GNOME): %.o: %.c
505 $(CC) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
507 lib/glide.so: $(PLUGIN_GLIDE)
508 ld -shared -lglide2x -o $@ $^
509 $(PLUGIN_GLIDE): %.o: %.c
510 $(CC) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
512 lib/ggi.so: $(PLUGIN_GGI)
513 ld -shared -lggi -o $@ $^
514 $(PLUGIN_GGI): %.o: %.c
515 $(CC) $(CFLAGS) -c -o $@ $<
517 lib/sdl.so: $(PLUGIN_SDL)
518 ld -shared -lSDL -o $@ $^
519 $(PLUGIN_SDL): %.o: %.c
520 $(CC) $(CFLAGS) -c -o $@ $<
522 lib/yuv.so: $(PLUGIN_YUV)
524 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
528 $(PLUGIN_YUV): %.o: %.c
529 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
531 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
533 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
537 $(PLUGIN_YUVMMX): %.o: %.c
538 $(CC) $(CFLAGS) -c -o $@ $<
540 ################################################################################
541 # Note on generic rules and dependancies
542 ################################################################################
544 # Note on dependancies: each .c file is associated with a .d file, which
545 # depends of it. The .o file associated with a .c file depends of the .d, of the
546 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
548 # The dep directory should be ignored by CVS.
550 # Note on inclusions: depending of the target, the dependancies files must
551 # or must not be included. The problem is that if we ask make to include a file,
552 # and this file does not exist, it is made before it can be included. In a
553 # general way, a .d file should be included if and only if the corresponding .o
554 # needs to be re-made.
556 # Two makefiles are used: the main one (this one) has regular generic rules,
557 # except for .o files, for which it calls the object Makefile. Dependancies
558 # are not included in this file.
559 # The object Makefile known how to make a .o from a .c, and includes
560 # dependancies for the target, but only those required.