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_ALSA = plugins/alsa/alsa.o \
343 plugins/alsa/aout_alsa.o
345 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
346 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
347 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX) \
348 $(PLUGIN_SDL) $(PLUGIN_ALSA)
350 # Other lists of files
352 C_OBJ := $(C_OBJ:%.o=src/%.o)
353 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
354 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
355 sources_c := $(C_OBJ:%.o=%.c)
356 dependancies := $(sources_c:%.c=.dep/%.d)
358 # All symbols must be exported
361 ################################################################################
363 ################################################################################
368 all: vlc @ALIASES@ plugins
371 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
372 rm -f vlc @ALIASES@ lib/*.so
375 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
376 rm -f Makefile include/defs.h include/config.h
377 rm -f config.status config.cache config.log
378 rm -f gmon.out core build-stamp
380 rm -rf debian/tmp debian/files debian/*.debhelper debian/*.substvars
381 find debian/* -type d -maxdepth 0 -name 'vlc-*' | xargs rm -rf
384 mkdir -p $(prefix)/bin
385 $(INSTALL) vlc $(prefix)/bin
387 for alias in "" @ALIASES@ ; do if test $$alias ; then ln -s vlc $(prefix)/bin/$$alias ; fi ; done
388 mkdir -p $(prefix)/lib/videolan/vlc
389 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
390 mkdir -p $(prefix)/share/videolan
391 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
392 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
396 @echo CFLAGS: $(CFLAGS)
397 @echo DCFLAGS: $(DCFLAGS)
398 @echo LCFLAGS: $(LCFLAGS)
400 # ugliest of all, but I have no time to do it -- sam
402 rm -rf /tmp/${SNAPSHOTDIR}
403 mkdir /tmp/${SNAPSHOTDIR}
404 cp -a * /tmp/${SNAPSHOTDIR}
405 (cd /tmp/${SNAPSHOTDIR} ; \
407 find . -type d -name CVS | xargs rm -rf ; \
408 find . -type f -name '.*.swp' | xargs rm -f ; \
409 find . -type f -name '.cvsignore' | xargs rm -f ; \
411 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
412 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
413 rm -rf /tmp/${SNAPSHOTDIR}
414 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
415 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
416 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
423 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
425 $(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
426 rm -f ./plugins/_APP_
427 ln -s ../vlc ./plugins/_APP_
429 $(CC) $(CFLAGS) $(LCFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
433 # Gnome and Framebuffer aliases - don't add new aliases which could bloat
437 rm -f $@ && ln -s vlc $@
442 # Generic rules (see below)
444 $(dependancies): %.d: FORCE
445 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
447 $(C_OBJ): %.o: Makefile.dep
448 $(C_OBJ): %.o: .dep/%.d
450 $(CC) $(CFLAGS) -c -o $@ $<
452 $(CPP_OBJ): %.o: %.cpp
453 $(CC) $(CFLAGS) -c -o $@ $<
455 $(ASM_OBJ): %.o: Makefile.dep
457 $(CC) $(CFLAGS) -c -o $@ $<
459 #$(PLUGIN_OBJ): %.so: Makefile.dep
460 #$(PLUGIN_OBJ): %.so: .dep/%.d
462 lib/beos.so: $(PLUGIN_BEOS)
463 $(CC) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
464 $(PLUGIN_BEOS): %.o: %.cpp
465 $(CC) $(CFLAGS) -c -o $@ $<
467 lib/esd.so: $(PLUGIN_ESD)
468 ifneq (,$(findstring bsd,$(SYS)))
469 ld -shared -lesd -o $@ $^
471 ld -shared -laudiofile -lesd -o $@ $^
473 $(PLUGIN_ESD): %.o: %.c
474 $(CC) $(CFLAGS) -c -o $@ $<
476 lib/dsp.so: $(PLUGIN_DSP)
478 $(PLUGIN_DSP): %.o: %.c
479 $(CC) $(CFLAGS) -c -o $@ $<
481 lib/alsa.so: $(PLUGIN_ALSA)
483 $(PLUGIN_ALSA): %.o: %.c
484 $(CC) $(CFLAGS) -c -o $@ $<
486 lib/dummy.so: $(PLUGIN_DUMMY)
488 $(PLUGIN_DUMMY): %.o: %.c
489 $(CC) $(CFLAGS) -c -o $@ $<
491 lib/fb.so: $(PLUGIN_FB)
493 $(PLUGIN_FB): %.o: %.c
494 $(CC) $(CFLAGS) -c -o $@ $<
496 lib/x11.so: $(PLUGIN_X11)
497 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
498 $(PLUGIN_X11): %.o: %.c
499 $(CC) $(CFLAGS) -c -o $@ $<
501 lib/mga.so: $(PLUGIN_MGA)
502 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
503 $(PLUGIN_MGA): %.o: %.c
504 $(CC) $(CFLAGS) -c -o $@ $<
506 lib/gnome.so: $(PLUGIN_GNOME)
507 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
508 $(PLUGIN_GNOME): %.o: %.c
509 $(CC) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
511 lib/glide.so: $(PLUGIN_GLIDE)
512 ld -shared -lglide2x -o $@ $^
513 $(PLUGIN_GLIDE): %.o: %.c
514 $(CC) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
516 lib/ggi.so: $(PLUGIN_GGI)
517 ld -shared -lggi -o $@ $^
518 $(PLUGIN_GGI): %.o: %.c
519 $(CC) $(CFLAGS) -c -o $@ $<
521 lib/sdl.so: $(PLUGIN_SDL)
522 ld -shared -lSDL -o $@ $^
523 $(PLUGIN_SDL): %.o: %.c
524 $(CC) $(CFLAGS) -c -o $@ $<
526 lib/yuv.so: $(PLUGIN_YUV)
528 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
532 $(PLUGIN_YUV): %.o: %.c
533 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
535 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
537 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
541 $(PLUGIN_YUVMMX): %.o: %.c
542 $(CC) $(CFLAGS) -c -o $@ $<
544 ################################################################################
545 # Note on generic rules and dependancies
546 ################################################################################
548 # Note on dependancies: each .c file is associated with a .d file, which
549 # depends of it. The .o file associated with a .c file depends of the .d, of the
550 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
552 # The dep directory should be ignored by CVS.
554 # Note on inclusions: depending of the target, the dependancies files must
555 # or must not be included. The problem is that if we ask make to include a file,
556 # and this file does not exist, it is made before it can be included. In a
557 # general way, a .d file should be included if and only if the corresponding .o
558 # needs to be re-made.
560 # Two makefiles are used: the main one (this one) has regular generic rules,
561 # except for .o files, for which it calls the object Makefile. Dependancies
562 # are not included in this file.
563 # The object Makefile known how to make a .o from a .c, and includes
564 # dependancies for the target, but only those required.