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)
83 CCFLAGS += -D_REENTRANT
84 CCFLAGS += -D_GNU_SOURCE
86 # flags needed for clean beos compilation
87 CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
89 # Optimizations : don't compile debug versions with them
92 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
93 CCFLAGS += -fomit-frame-pointer
95 # Optimizations for x86 familiy
96 ifneq (,$(findstring 86,$(ARCH)))
97 CCFLAGS += -malign-double
98 #CCFLAGS += -march=pentium
99 # Eventual Pentium Pro optimizations
100 ifneq (,$(findstring pentiumpro,$(ARCH)))
102 CCFLAGS += -march=pentiumpro
105 # Eventual MMX optimizations for x86
106 ifneq (,$(findstring mmx,$(ARCH)))
111 # Optimizations for PowerPC
112 ifneq (,$(findstring ppc,$(ARCH)))
113 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
116 # Optimizations for Sparc
117 ifneq (,$(findstring sparc,$(ARCH)))
118 CCFLAGS += -mhard-float
121 # End of optimizations
125 # C compiler flags: dependancies
127 DCFLAGS += $(INCLUDE)
131 # C compiler flags: linking
138 # Additionnal debugging flags
141 # Debugging and profiling support
150 #################################################################################
152 #################################################################################
157 interface_obj = interface/main.o \
158 interface/interface.o \
159 interface/intf_msg.o \
160 interface/intf_cmd.o \
161 interface/intf_ctrl.o \
162 interface/intf_console.o
164 input_obj = input/input_vlan.o \
166 input/input_netlist.o \
167 input/input_network.o \
173 audio_output_obj = audio_output/audio_output.o
175 video_output_obj = video_output/video_output.o \
176 video_output/video_text.o \
177 video_output/video_spu.o \
178 video_output/video_yuv.o
180 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
181 ac3_decoder/ac3_decoder.o \
182 ac3_decoder/ac3_parse.o \
183 ac3_decoder/ac3_exponent.o \
184 ac3_decoder/ac3_bit_allocate.o \
185 ac3_decoder/ac3_mantissa.o \
186 ac3_decoder/ac3_rematrix.o \
187 ac3_decoder/ac3_imdct.o \
188 ac3_decoder/ac3_downmix.o
190 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
191 lpcm_decoder/lpcm_decoder.o
193 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
194 audio_decoder/audio_decoder.o \
195 audio_decoder/audio_math.o
197 spu_decoder_obj = spu_decoder/spu_decoder.o
199 #??generic_decoder_obj = generic_decoder/generic_decoder.o
200 # remeber to add it to OBJ
202 video_parser_obj = video_parser/video_parser.o \
203 video_parser/vpar_headers.o \
204 video_parser/vpar_blocks.o \
205 video_parser/vpar_synchro.o \
206 video_parser/video_fifo.o
208 video_decoder_obj = video_decoder/video_decoder.o \
209 video_decoder/vdec_motion.o \
210 video_decoder/vdec_motion_inner.o \
211 video_decoder/vdec_idct.o
213 misc_obj = misc/mtime.o \
221 C_OBJ = $(interface_obj) \
223 $(audio_output_obj) \
224 $(video_output_obj) \
226 $(lpcm_decoder_obj) \
227 $(audio_decoder_obj) \
229 $(generic_decoder_obj) \
230 $(video_parser_obj) \
231 $(video_decoder_obj) \
236 CPP_OBJ = misc/beos_specific.o
242 ifneq (,$(findstring 86,$(ARCH)))
243 ifneq (,$(findstring mmx,$(ARCH)))
244 ASM_OBJ = video_decoder/vdec_idctmmx.o \
245 video_output/video_yuv_mmx.o
252 PLUGINS := $(PLUGINS:%=lib/%.so)
254 PLUGIN_BEOS = plugins/beos/beos.o \
255 plugins/beos/aout_beos.o \
256 plugins/beos/intf_beos.o \
257 plugins/beos/vout_beos.o
259 PLUGIN_DSP = plugins/dsp/dsp.o \
260 plugins/dsp/aout_dsp.o \
262 PLUGIN_DUMMY = plugins/dummy/dummy.o \
263 plugins/dummy/aout_dummy.o \
264 plugins/dummy/intf_dummy.o \
265 plugins/dummy/vout_dummy.o
267 PLUGIN_ESD = plugins/esd/esd.o \
268 plugins/esd/aout_esd.o
270 PLUGIN_FB = plugins/fb/fb.o \
271 plugins/fb/intf_fb.o \
274 PLUGIN_GGI = plugins/ggi/ggi.o \
275 plugins/ggi/intf_ggi.o \
276 plugins/ggi/vout_ggi.o
278 PLUGIN_GLIDE = plugins/glide/glide.o \
279 plugins/glide/intf_glide.o \
280 plugins/glide/vout_glide.o
282 PLUGIN_GNOME = plugins/gnome/gnome.o \
283 plugins/gnome/intf_gnome.o \
284 plugins/gnome/intf_gnome_callbacks.o \
285 plugins/gnome/intf_gnome_interface.o \
286 plugins/gnome/intf_gnome_support.o \
287 plugins/gnome/vout_gnome.o
289 PLUGIN_MGA = plugins/mga/mga.o \
290 plugins/mga/intf_mga.o \
291 plugins/mga/vout_mga.o
293 PLUGIN_X11 = plugins/x11/x11.o \
294 plugins/x11/intf_x11.o \
295 plugins/x11/vout_x11.o
297 PLUGIN_YUV = plugins/yuv/yuv.o \
298 plugins/yuv/video_yuv.o \
299 plugins/yuv/video_yuv8.o \
300 plugins/yuv/video_yuv15.o \
301 plugins/yuv/video_yuv16.o \
302 plugins/yuv/video_yuv24.o \
303 plugins/yuv/video_yuv32.o
305 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
306 plugins/yuvmmx/video_yuv.o \
307 plugins/yuvmmx/video_yuv8.o \
308 plugins/yuvmmx/video_yuv15.o \
309 plugins/yuvmmx/video_yuv16.o \
310 plugins/yuvmmx/video_yuv24.o \
311 plugins/yuvmmx/video_yuv32.o
313 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
314 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
315 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX)
317 # Other lists of files
319 C_OBJ := $(C_OBJ:%.o=src/%.o)
320 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
321 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
322 sources_c := $(C_OBJ:%.o=%.c)
323 dependancies := $(sources_c:%.c=.dep/%.d)
325 # All symbols must be exported
328 ################################################################################
330 ################################################################################
335 all: vlc @ALIASES@ plugins
338 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
339 rm -f vlc @ALIASES@ lib/*.so
342 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
343 rm -f Makefile include/defs.h include/config.h
344 rm -f config.status config.cache config.log
345 rm -f gmon.out core build-stamp
349 mkdir -p $(prefix)/bin
350 $(INSTALL) vlc $(prefix)/bin
351 mkdir -p $(prefix)/lib/videolan/vlc
352 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
353 mkdir -p $(prefix)/share/videolan
354 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
355 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
359 @echo CCFLAGS: $(CCFLAGS)
360 @echo DCFLAGS: $(DCFLAGS)
361 @echo LCFLAGS: $(CCFLAGS)
363 # ugliest of all, but I have no time to do it -- sam
365 rm -rf /tmp/${SNAPSHOTDIR}
366 mkdir /tmp/${SNAPSHOTDIR}
367 cp -r * /tmp/${SNAPSHOTDIR}
368 (cd /tmp/${SNAPSHOTDIR} ; \
370 find . -type d -name CVS | xargs rm -rf ; \
371 find . -type f -name '.*.swp' | xargs rm -f ; \
373 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
374 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
375 rm -rf /tmp/${SNAPSHOTDIR}
376 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
377 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
378 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
385 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
387 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
388 rm -f ./plugins/_APP_
389 ln -s ../vlc ./plugins/_APP_
391 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
394 gvlc xvlc fbvlc ggivlc glidevlc: vlc
395 rm -f $@ && ln -s vlc $@
400 # Generic rules (see below)
402 $(dependancies): %.d: FORCE
403 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
405 $(C_OBJ): %.o: Makefile.dep
406 $(C_OBJ): %.o: .dep/%.d
408 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
410 $(CPP_OBJ): %.o: %.cpp
411 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
413 $(ASM_OBJ): %.o: Makefile.dep
415 $(CC) $(CFLAGS) -c -o $@ $<
417 #$(PLUGIN_OBJ): %.so: Makefile.dep
418 #$(PLUGIN_OBJ): %.so: .dep/%.d
420 lib/beos.so: $(PLUGIN_BEOS)
421 $(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
422 $(PLUGIN_BEOS): %.o: %.cpp
423 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
425 lib/esd.so: $(PLUGIN_ESD)
426 ifneq (,$(findstring bsd,$(SYS)))
427 ld -shared -lesd -o $@ $^
429 ld -shared -laudiofile -lesd -o $@ $^
431 $(PLUGIN_ESD): %.o: %.c
432 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
434 lib/dsp.so: $(PLUGIN_DSP)
436 $(PLUGIN_DSP): %.o: %.c
437 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
439 lib/dummy.so: $(PLUGIN_DUMMY)
441 $(PLUGIN_DUMMY): %.o: %.c
442 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
444 lib/fb.so: $(PLUGIN_FB)
446 $(PLUGIN_FB): %.o: %.c
447 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
449 lib/x11.so: $(PLUGIN_X11)
450 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
451 $(PLUGIN_X11): %.o: %.c
452 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
454 lib/mga.so: $(PLUGIN_MGA)
455 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
456 $(PLUGIN_MGA): %.o: %.c
457 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
459 lib/gnome.so: $(PLUGIN_GNOME)
460 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
461 $(PLUGIN_GNOME): %.o: %.c
462 $(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
464 lib/glide.so: $(PLUGIN_GLIDE)
465 ld -shared -lglide2x -o $@ $^
466 $(PLUGIN_GLIDE): %.o: %.c
467 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
469 lib/ggi.so: $(PLUGIN_GGI)
470 ld -shared -lggi -o $@ $^
471 $(PLUGIN_GGI): %.o: %.c
472 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
474 lib/yuv.so: $(PLUGIN_YUV)
476 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
480 $(PLUGIN_YUV): %.o: %.c
481 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
483 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
485 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
489 $(PLUGIN_YUVMMX): %.o: %.c
490 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
492 ################################################################################
493 # Note on generic rules and dependancies
494 ################################################################################
496 # Note on dependancies: each .c file is associated with a .d file, which
497 # depends of it. The .o file associated with a .c file depends of the .d, of the
498 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
500 # The dep directory should be ignored by CVS.
502 # Note on inclusions: depending of the target, the dependancies files must
503 # or must not be included. The problem is that if we ask make to include a file,
504 # and this file does not exist, it is made before it can be included. In a
505 # general way, a .d file should be included if and only if the corresponding .o
506 # needs to be re-made.
508 # Two makefiles are used: the main one (this one) has regular generic rules,
509 # except for .o files, for which it calls the object Makefile. Dependancies
510 # are not included in this file.
511 # The object Makefile known how to make a .o from a .c, and includes
512 # dependancies for the target, but only those required.