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 video_decoder_obj = video_decoder/video_decoder.o \
211 video_decoder/vdec_motion.o \
212 video_decoder/vdec_motion_inner.o \
213 video_decoder/vdec_idct.o
215 misc_obj = misc/mtime.o \
224 C_OBJ = $(interface_obj) \
226 $(audio_output_obj) \
227 $(video_output_obj) \
229 $(lpcm_decoder_obj) \
230 $(audio_decoder_obj) \
232 $(generic_decoder_obj) \
233 $(video_parser_obj) \
234 $(video_decoder_obj) \
239 CPP_OBJ = misc/beos_specific.o
245 ifneq (,$(findstring 86,$(ARCH)))
246 ifneq (,$(findstring mmx,$(ARCH)))
247 ASM_OBJ = video_decoder/vdec_idctmmx.o \
248 video_output/video_yuv_mmx.o
255 PLUGINS := $(PLUGINS:%=lib/%.so)
257 PLUGIN_BEOS = plugins/beos/beos.o \
258 plugins/beos/aout_beos.o \
259 plugins/beos/intf_beos.o \
260 plugins/beos/vout_beos.o
262 PLUGIN_DSP = plugins/dsp/dsp.o \
263 plugins/dsp/aout_dsp.o \
265 PLUGIN_DUMMY = plugins/dummy/dummy.o \
266 plugins/dummy/aout_dummy.o \
267 plugins/dummy/intf_dummy.o \
268 plugins/dummy/vout_dummy.o
270 PLUGIN_ESD = plugins/esd/esd.o \
271 plugins/esd/aout_esd.o
273 PLUGIN_FB = plugins/fb/fb.o \
274 plugins/fb/intf_fb.o \
277 PLUGIN_GGI = plugins/ggi/ggi.o \
278 plugins/ggi/intf_ggi.o \
279 plugins/ggi/vout_ggi.o
281 PLUGIN_GLIDE = plugins/glide/glide.o \
282 plugins/glide/intf_glide.o \
283 plugins/glide/vout_glide.o
285 PLUGIN_GNOME = plugins/gnome/gnome.o \
286 plugins/gnome/intf_gnome.o \
287 plugins/gnome/intf_gnome_callbacks.o \
288 plugins/gnome/intf_gnome_interface.o \
289 plugins/gnome/intf_gnome_support.o \
290 plugins/gnome/vout_gnome.o
292 PLUGIN_MGA = plugins/mga/mga.o \
293 plugins/mga/intf_mga.o \
294 plugins/mga/vout_mga.o
296 PLUGIN_X11 = plugins/x11/x11.o \
297 plugins/x11/intf_x11.o \
298 plugins/x11/vout_x11.o
300 PLUGIN_YUV = plugins/yuv/yuv.o \
301 plugins/yuv/video_yuv.o \
302 plugins/yuv/video_yuv8.o \
303 plugins/yuv/video_yuv15.o \
304 plugins/yuv/video_yuv16.o \
305 plugins/yuv/video_yuv24.o \
306 plugins/yuv/video_yuv32.o
308 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
309 plugins/yuvmmx/video_yuv.o \
310 plugins/yuvmmx/video_yuv8.o \
311 plugins/yuvmmx/video_yuv15.o \
312 plugins/yuvmmx/video_yuv16.o \
313 plugins/yuvmmx/video_yuv24.o \
314 plugins/yuvmmx/video_yuv32.o
316 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
317 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
318 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX)
320 # Other lists of files
322 C_OBJ := $(C_OBJ:%.o=src/%.o)
323 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
324 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
325 sources_c := $(C_OBJ:%.o=%.c)
326 dependancies := $(sources_c:%.c=.dep/%.d)
328 # All symbols must be exported
331 ################################################################################
333 ################################################################################
338 all: vlc @ALIASES@ plugins
341 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
342 rm -f vlc @ALIASES@ lib/*.so
345 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
346 rm -f Makefile include/defs.h include/config.h
347 rm -f config.status config.cache config.log
348 rm -f gmon.out core build-stamp
352 mkdir -p $(prefix)/bin
353 $(INSTALL) vlc $(prefix)/bin
354 mkdir -p $(prefix)/lib/videolan/vlc
355 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
356 mkdir -p $(prefix)/share/videolan
357 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
358 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
362 @echo CCFLAGS: $(CCFLAGS)
363 @echo DCFLAGS: $(DCFLAGS)
364 @echo LCFLAGS: $(CCFLAGS)
366 # ugliest of all, but I have no time to do it -- sam
368 rm -rf /tmp/${SNAPSHOTDIR}
369 mkdir /tmp/${SNAPSHOTDIR}
370 cp -r * /tmp/${SNAPSHOTDIR}
371 (cd /tmp/${SNAPSHOTDIR} ; \
373 find . -type d -name CVS | xargs rm -rf ; \
374 find . -type f -name '.*.swp' | xargs rm -f ; \
376 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
377 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
378 rm -rf /tmp/${SNAPSHOTDIR}
379 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
380 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
381 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
388 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
390 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
391 rm -f ./plugins/_APP_
392 ln -s ../vlc ./plugins/_APP_
394 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
397 gvlc xvlc fbvlc ggivlc glidevlc: vlc
398 rm -f $@ && ln -s vlc $@
403 # Generic rules (see below)
405 $(dependancies): %.d: FORCE
406 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
408 $(C_OBJ): %.o: Makefile.dep
409 $(C_OBJ): %.o: .dep/%.d
411 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
413 $(CPP_OBJ): %.o: %.cpp
414 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
416 $(ASM_OBJ): %.o: Makefile.dep
418 $(CC) $(CFLAGS) -c -o $@ $<
420 #$(PLUGIN_OBJ): %.so: Makefile.dep
421 #$(PLUGIN_OBJ): %.so: .dep/%.d
423 lib/beos.so: $(PLUGIN_BEOS)
424 $(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
425 $(PLUGIN_BEOS): %.o: %.cpp
426 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
428 lib/esd.so: $(PLUGIN_ESD)
429 ifneq (,$(findstring bsd,$(SYS)))
430 ld -shared -lesd -o $@ $^
432 ld -shared -laudiofile -lesd -o $@ $^
434 $(PLUGIN_ESD): %.o: %.c
435 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
437 lib/dsp.so: $(PLUGIN_DSP)
439 $(PLUGIN_DSP): %.o: %.c
440 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
442 lib/dummy.so: $(PLUGIN_DUMMY)
444 $(PLUGIN_DUMMY): %.o: %.c
445 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
447 lib/fb.so: $(PLUGIN_FB)
449 $(PLUGIN_FB): %.o: %.c
450 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
452 lib/x11.so: $(PLUGIN_X11)
453 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
454 $(PLUGIN_X11): %.o: %.c
455 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
457 lib/mga.so: $(PLUGIN_MGA)
458 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
459 $(PLUGIN_MGA): %.o: %.c
460 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
462 lib/gnome.so: $(PLUGIN_GNOME)
463 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
464 $(PLUGIN_GNOME): %.o: %.c
465 $(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
467 lib/glide.so: $(PLUGIN_GLIDE)
468 ld -shared -lglide2x -o $@ $^
469 $(PLUGIN_GLIDE): %.o: %.c
470 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
472 lib/ggi.so: $(PLUGIN_GGI)
473 ld -shared -lggi -o $@ $^
474 $(PLUGIN_GGI): %.o: %.c
475 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
477 lib/yuv.so: $(PLUGIN_YUV)
479 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
483 $(PLUGIN_YUV): %.o: %.c
484 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
486 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
488 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
492 $(PLUGIN_YUVMMX): %.o: %.c
493 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
495 ################################################################################
496 # Note on generic rules and dependancies
497 ################################################################################
499 # Note on dependancies: each .c file is associated with a .d file, which
500 # depends of it. The .o file associated with a .c file depends of the .d, of the
501 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
503 # The dep directory should be ignored by CVS.
505 # Note on inclusions: depending of the target, the dependancies files must
506 # or must not be included. The problem is that if we ask make to include a file,
507 # and this file does not exist, it is made before it can be included. In a
508 # general way, a .d file should be included if and only if the corresponding .o
509 # needs to be re-made.
511 # Two makefiles are used: the main one (this one) has regular generic rules,
512 # except for .o files, for which it calls the object Makefile. Dependancies
513 # are not included in this file.
514 # The object Makefile known how to make a .o from a .c, and includes
515 # dependancies for the target, but only those required.