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@
21 #----------------- do not change anything below this line ----------------------
23 ################################################################################
24 # Configuration pre-processing
25 ################################################################################
27 # PROGRAM_OPTIONS is an identification string of the compilation options
28 PROGRAM_OPTIONS = $(SYS) $(ARCH)
30 PROGRAM_OPTIONS += DEBUG
34 # PROGRAM_BUILD is a complete identification of the build
35 # ( we can't use fancy options with date since OSes like Solaris
36 # or FreeBSD have strange date implementations )
37 PROGRAM_BUILD = `date` $(USER)
38 # XXX: beos does not support hostname
39 #PROGRAM_BUILD = `date` $(USER)@`hostname`
41 # DEFINE will contain some of the constants definitions decided in Makefile,
42 # including SYS_xx. It will be passed to C compiler.
43 DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z A-Z)
45 ################################################################################
46 # Tuning and other variables - do not change anything except if you know
47 # exactly what you are doing
48 ################################################################################
51 # C headers directories
53 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
63 ifneq (,$(findstring bsd,$(SYS)))
64 LIB += -pthread -lgnugetopt
65 LIB += -L/usr/local/lib
68 ifneq (,$(findstring linux,$(SYS)))
73 LIB += -lbe -lroot -lgame
79 # C compiler flags: compilation
81 CCFLAGS += $(DEFINE) $(INCLUDE)
82 CCFLAGS += -Wall -Winline
83 CCFLAGS += -D_REENTRANT
84 CCFLAGS += -D_GNU_SOURCE
86 # flags needed for clean beos compilation
88 CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
91 # Optimizations : don't compile debug versions with them
94 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
95 CCFLAGS += -fomit-frame-pointer
97 # Optimizations for x86 familiy
98 ifneq (,$(findstring 86,$(ARCH)))
99 CCFLAGS += -malign-double
100 #CCFLAGS += -march=pentium
101 # Eventual Pentium Pro optimizations
102 ifneq (,$(findstring pentiumpro,$(ARCH)))
104 CCFLAGS += -march=pentiumpro
107 # Eventual MMX optimizations for x86
108 ifneq (,$(findstring mmx,$(ARCH)))
113 # Optimizations for PowerPC
114 ifneq (,$(findstring ppc,$(ARCH)))
115 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
118 # Optimizations for Sparc
119 ifneq (,$(findstring sparc,$(ARCH)))
120 CCFLAGS += -mhard-float
123 # End of optimizations
127 # C compiler flags: dependancies
129 DCFLAGS += $(INCLUDE)
133 # C compiler flags: linking
140 # Additionnal debugging flags
143 # Debugging and profiling support
152 #################################################################################
154 #################################################################################
159 interface_obj = interface/main.o \
160 interface/interface.o \
161 interface/intf_msg.o \
162 interface/intf_cmd.o \
163 interface/intf_ctrl.o \
164 interface/intf_console.o
166 input_obj = input/input_vlan.o \
168 input/input_netlist.o \
169 input/input_network.o \
175 audio_output_obj = audio_output/audio_output.o
177 video_output_obj = video_output/video_output.o \
178 video_output/video_text.o \
179 video_output/video_spu.o \
180 video_output/video_yuv.o
182 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
183 ac3_decoder/ac3_decoder.o \
184 ac3_decoder/ac3_parse.o \
185 ac3_decoder/ac3_exponent.o \
186 ac3_decoder/ac3_bit_allocate.o \
187 ac3_decoder/ac3_mantissa.o \
188 ac3_decoder/ac3_rematrix.o \
189 ac3_decoder/ac3_imdct.o \
190 ac3_decoder/ac3_downmix.o
192 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
193 lpcm_decoder/lpcm_decoder.o
195 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
196 audio_decoder/audio_decoder.o \
197 audio_decoder/audio_math.o
199 spu_decoder_obj = spu_decoder/spu_decoder.o
201 #??generic_decoder_obj = generic_decoder/generic_decoder.o
202 # remeber to add it to OBJ
204 video_parser_obj = video_parser/video_parser.o \
205 video_parser/vpar_headers.o \
206 video_parser/vpar_blocks.o \
207 video_parser/vpar_synchro.o \
208 video_parser/video_fifo.o
210 ifneq (,$(findstring mmx,$(ARCH)))
211 vdec_motion_inner = video_decoder/vdec_motion_inner_mmx.o
213 vdec_motion_inner = video_decoder/vdec_motion_inner.o
216 video_decoder_obj = video_decoder/video_decoder.o \
217 video_decoder/vdec_motion.o \
218 video_decoder/vdec_idct.o \
221 misc_obj = misc/mtime.o \
230 C_OBJ = $(interface_obj) \
232 $(audio_output_obj) \
233 $(video_output_obj) \
235 $(lpcm_decoder_obj) \
236 $(audio_decoder_obj) \
238 $(generic_decoder_obj) \
239 $(video_parser_obj) \
240 $(video_decoder_obj) \
245 CPP_OBJ = misc/beos_specific.o
251 ifneq (,$(findstring 86,$(ARCH)))
252 ifneq (,$(findstring mmx,$(ARCH)))
253 ASM_OBJ = video_decoder/vdec_idctmmx.o \
254 video_output/video_yuv_mmx.o
261 PLUGINS := $(PLUGINS:%=lib/%.so)
263 PLUGIN_BEOS = plugins/beos/beos.o \
264 plugins/beos/aout_beos.o \
265 plugins/beos/intf_beos.o \
266 plugins/beos/vout_beos.o
268 PLUGIN_DSP = plugins/dsp/dsp.o \
269 plugins/dsp/aout_dsp.o \
271 PLUGIN_DUMMY = plugins/dummy/dummy.o \
272 plugins/dummy/aout_dummy.o \
273 plugins/dummy/intf_dummy.o \
274 plugins/dummy/vout_dummy.o
276 PLUGIN_ESD = plugins/esd/esd.o \
277 plugins/esd/aout_esd.o
279 PLUGIN_FB = plugins/fb/fb.o \
280 plugins/fb/intf_fb.o \
283 PLUGIN_GGI = plugins/ggi/ggi.o \
284 plugins/ggi/intf_ggi.o \
285 plugins/ggi/vout_ggi.o
287 PLUGIN_GLIDE = plugins/glide/glide.o \
288 plugins/glide/intf_glide.o \
289 plugins/glide/vout_glide.o
291 PLUGIN_GNOME = plugins/gnome/gnome.o \
292 plugins/gnome/intf_gnome.o \
293 plugins/gnome/intf_gnome_callbacks.o \
294 plugins/gnome/intf_gnome_interface.o \
295 plugins/gnome/intf_gnome_support.o \
296 plugins/gnome/vout_gnome.o
298 PLUGIN_MGA = plugins/mga/mga.o \
299 plugins/mga/intf_mga.o \
300 plugins/mga/vout_mga.o
302 PLUGIN_X11 = plugins/x11/x11.o \
303 plugins/x11/intf_x11.o \
304 plugins/x11/vout_x11.o
306 PLUGIN_YUV = plugins/yuv/yuv.o \
307 plugins/yuv/video_yuv.o \
308 plugins/yuv/video_yuv8.o \
309 plugins/yuv/video_yuv15.o \
310 plugins/yuv/video_yuv16.o \
311 plugins/yuv/video_yuv24.o \
312 plugins/yuv/video_yuv32.o
314 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
315 plugins/yuvmmx/video_yuv.o \
316 plugins/yuvmmx/video_yuv8.o \
317 plugins/yuvmmx/video_yuv15.o \
318 plugins/yuvmmx/video_yuv16.o \
319 plugins/yuvmmx/video_yuv24.o \
320 plugins/yuvmmx/video_yuv32.o
322 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
323 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
324 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX)
326 # Other lists of files
328 C_OBJ := $(C_OBJ:%.o=src/%.o)
329 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
330 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
331 sources_c := $(C_OBJ:%.o=%.c)
332 dependancies := $(sources_c:%.c=.dep/%.d)
334 # All symbols must be exported
337 ################################################################################
339 ################################################################################
344 all: vlc @ALIASES@ plugins
347 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
348 rm -f vlc @ALIASES@ lib/*.so
351 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
352 rm -f Makefile include/defs.h include/config.h
353 rm -f config.status config.cache config.log
354 rm -f gmon.out core build-stamp
355 rm -rf .dep debian/tmp
358 mkdir -p $(prefix)/bin
359 $(INSTALL) vlc @ALIASES@ $(prefix)/bin
360 mkdir -p $(prefix)/lib/videolan/vlc
361 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
362 mkdir -p $(prefix)/share/videolan
363 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
364 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
368 @echo CCFLAGS: $(CCFLAGS)
369 @echo DCFLAGS: $(DCFLAGS)
370 @echo LCFLAGS: $(CCFLAGS)
372 # ugliest of all, but I have no time to do it -- sam
374 rm -rf /tmp/${SNAPSHOTDIR}
375 mkdir /tmp/${SNAPSHOTDIR}
376 cp -r * /tmp/${SNAPSHOTDIR}
377 (cd /tmp/${SNAPSHOTDIR} ; \
379 find . -type d -name CVS | xargs rm -rf ; \
380 find . -type f -name '.*.swp' | xargs rm -f ; \
381 find . -type f -name '.cvsignore' | xargs rm -f ; \
383 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
384 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
385 rm -rf /tmp/${SNAPSHOTDIR}
386 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
387 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
388 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
395 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
397 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
398 rm -f ./plugins/_APP_
399 ln -s ../vlc ./plugins/_APP_
401 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
404 gvlc xvlc fbvlc ggivlc glidevlc: vlc
405 rm -f $@ && ln -s vlc $@
410 # Generic rules (see below)
412 $(dependancies): %.d: FORCE
413 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
415 $(C_OBJ): %.o: Makefile.dep
416 $(C_OBJ): %.o: .dep/%.d
418 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
420 $(CPP_OBJ): %.o: %.cpp
421 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
423 $(ASM_OBJ): %.o: Makefile.dep
425 $(CC) $(CFLAGS) -c -o $@ $<
427 #$(PLUGIN_OBJ): %.so: Makefile.dep
428 #$(PLUGIN_OBJ): %.so: .dep/%.d
430 lib/beos.so: $(PLUGIN_BEOS)
431 $(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
432 $(PLUGIN_BEOS): %.o: %.cpp
433 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
435 lib/esd.so: $(PLUGIN_ESD)
436 ifneq (,$(findstring bsd,$(SYS)))
437 ld -shared -lesd -o $@ $^
439 ld -shared -laudiofile -lesd -o $@ $^
441 $(PLUGIN_ESD): %.o: %.c
442 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
444 lib/dsp.so: $(PLUGIN_DSP)
446 $(PLUGIN_DSP): %.o: %.c
447 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
449 lib/dummy.so: $(PLUGIN_DUMMY)
451 $(PLUGIN_DUMMY): %.o: %.c
452 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
454 lib/fb.so: $(PLUGIN_FB)
456 $(PLUGIN_FB): %.o: %.c
457 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
459 lib/x11.so: $(PLUGIN_X11)
460 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
461 $(PLUGIN_X11): %.o: %.c
462 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
464 lib/mga.so: $(PLUGIN_MGA)
465 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
466 $(PLUGIN_MGA): %.o: %.c
467 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
469 lib/gnome.so: $(PLUGIN_GNOME)
470 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
471 $(PLUGIN_GNOME): %.o: %.c
472 $(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
474 lib/glide.so: $(PLUGIN_GLIDE)
475 ld -shared -lglide2x -o $@ $^
476 $(PLUGIN_GLIDE): %.o: %.c
477 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
479 lib/ggi.so: $(PLUGIN_GGI)
480 ld -shared -lggi -o $@ $^
481 $(PLUGIN_GGI): %.o: %.c
482 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
484 lib/yuv.so: $(PLUGIN_YUV)
486 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
490 $(PLUGIN_YUV): %.o: %.c
491 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
493 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
495 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
499 $(PLUGIN_YUVMMX): %.o: %.c
500 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
502 ################################################################################
503 # Note on generic rules and dependancies
504 ################################################################################
506 # Note on dependancies: each .c file is associated with a .d file, which
507 # depends of it. The .o file associated with a .c file depends of the .d, of the
508 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
510 # The dep directory should be ignored by CVS.
512 # Note on inclusions: depending of the target, the dependancies files must
513 # or must not be included. The problem is that if we ask make to include a file,
514 # and this file does not exist, it is made before it can be included. In a
515 # general way, a .d file should be included if and only if the corresponding .o
516 # needs to be re-made.
518 # Two makefiles are used: the main one (this one) has regular generic rules,
519 # except for .o files, for which it calls the object Makefile. Dependancies
520 # are not included in this file.
521 # The object Makefile known how to make a .o from a .c, and includes
522 # dependancies for the target, but only those required.