1 ################################################################################
2 # vlc (VideoLAN Client) main makefile
4 ################################################################################
5 # This makefile is the main makefile for the VideoLAN client.
6 ################################################################################
8 ################################################################################
10 ################################################################################
19 # Audio output settings
24 # Fallback method that should always work
27 # Video output settings
35 # Fallback method that should always work
43 # Target operating system
49 # For x86 architecture, choose MMX support
51 # For x86 architecture, optimize for Pentium Pro
52 # (choose NO if you get `Invalid instruction' errors)
55 # Decoder choice - ?? old decoder will be removed soon
59 # Debugging mode on or off (set to 1 to activate)
62 #----------------- do not change anything below this line ----------------------
64 ################################################################################
65 # Configuration pre-processing
66 ################################################################################
68 # Program version and codename - may only be changed by the project leader
69 PROGRAM_VERSION = 0.1.99
70 PROGRAM_CODENAME = Onatopp
72 # audio and video options
73 AUDIO := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
74 VIDEO := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
76 # PROGRAM_OPTIONS is an identification string of the compilation options
77 PROGRAM_OPTIONS = $(SYS) $(ARCH)
79 PROGRAM_OPTIONS += DEBUG
82 # PROGRAM_BUILD is a complete identification of the build
83 # ( we can't use fancy options with date since OSes like Solaris
84 # or FreeBSD have strange date implementations )
85 PROGRAM_BUILD = `date` $(USER)@`hostname`
87 # DEFINE will contain some of the constants definitions decided in Makefile,
88 # including ARCH_xx and SYS_xx. It will be passed to C compiler.
89 DEFINE += -DARCH_$(shell echo $(ARCH) | cut -f1 -d' ')
90 DEFINE += -DSYS_$(SYS)
91 DEFINE += -DPLUGIN_PATH="\"$(PREFIX)/lib/videolan/vlc\""
92 DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
93 DEFINE += -DPROGRAM_CODENAME="\"$(PROGRAM_CODENAME)\""
94 DEFINE += -DPROGRAM_OPTIONS="\"$(shell echo $(PROGRAM_OPTIONS) | tr 'A-Z' 'a-z')\""
95 DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
100 ################################################################################
101 # Tuning and other variables - do not change anything except if you know
102 # exactly what you are doing
103 ################################################################################
106 # C headers directories
108 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
115 LIB += -lthreads -ldl
119 LIB += -pthread -lgnugetopt
120 LIB += -L/usr/local/lib
124 LIB += -lpthread -ldl
130 # C compiler flags: compilation
132 CCFLAGS += $(DEFINE) $(INCLUDE)
134 CCFLAGS += -D_REENTRANT
135 CCFLAGS += -D_GNU_SOURCE
137 # Optimizations : don't compile debug versions with them
139 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
140 CCFLAGS += -fomit-frame-pointer
142 # Optimizations for x86 familiy
143 ifneq (,$(findstring X86,$(ARCH)))
144 CCFLAGS += -malign-double
145 #CCFLAGS += -march=pentium
146 # Eventual Pentium Pro optimizations
147 ifneq (,$(findstring PPRO,$(ARCH)))
149 CCFLAGS += -march=pentiumpro
152 # Eventual MMX optimizations for x86
153 ifneq (,$(findstring MMX,$(ARCH)))
158 # Optimizations for PowerPC
159 ifneq (,$(findstring PPC,$(ARCH)))
160 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
163 # Optimizations for Sparc
164 ifneq (,$(findstring SPARC,$(ARCH)))
165 CCFLAGS += -mhard-float
169 # C compiler flags: dependancies
171 DCFLAGS += $(INCLUDE)
175 # C compiler flags: linking
182 # Additionnal debugging flags
191 #################################################################################
193 #################################################################################
198 interface_obj = interface/main.o \
199 interface/interface.o \
200 interface/intf_msg.o \
201 interface/intf_cmd.o \
202 interface/intf_ctrl.o \
203 interface/intf_console.o
205 input_obj = input/input_vlan.o \
207 input/input_netlist.o \
208 input/input_network.o \
214 audio_output_obj = audio_output/audio_output.o
216 video_output_obj = video_output/video_output.o \
217 video_output/video_text.o \
218 video_output/video_yuv.o
220 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
221 ac3_decoder/ac3_decoder.o \
222 ac3_decoder/ac3_parse.o \
223 ac3_decoder/ac3_exponent.o \
224 ac3_decoder/ac3_bit_allocate.o \
225 ac3_decoder/ac3_mantissa.o \
226 ac3_decoder/ac3_rematrix.o \
227 ac3_decoder/ac3_imdct.o \
228 ac3_decoder/ac3_downmix.o
230 audio_decoder_obj = audio_decoder/audio_decoder.o \
231 audio_decoder/audio_math.o
233 spu_decoder_obj = spu_decoder/spu_decoder.o
235 #??generic_decoder_obj = generic_decoder/generic_decoder.o
236 # remeber to add it to OBJ
238 ifeq ($(DECODER),old)
239 CFLAGS += -DOLD_DECODER
240 video_decoder_obj = video_decoder_ref/video_decoder.o \
241 video_decoder_ref/display.o \
242 video_decoder_ref/getblk.o \
243 video_decoder_ref/gethdr.o \
244 video_decoder_ref/getpic.o \
245 video_decoder_ref/getvlc.o \
246 video_decoder_ref/idct.o \
247 video_decoder_ref/motion.o \
248 video_decoder_ref/mpeg2dec.o \
249 video_decoder_ref/recon.o \
250 video_decoder_ref/spatscal.o
252 video_parser_obj = video_parser/video_parser.o \
253 video_parser/vpar_headers.o \
254 video_parser/vpar_blocks.o \
255 video_parser/vpar_synchro.o \
256 video_parser/video_fifo.o
258 video_decoder_obj = video_decoder/video_decoder.o \
259 video_decoder/vdec_motion.o \
260 video_decoder/vdec_motion_inner.o \
261 video_decoder/vdec_idct.o
264 misc_obj = misc/mtime.o \
270 C_OBJ = $(interface_obj) \
272 $(audio_output_obj) \
273 $(video_output_obj) \
275 $(audio_decoder_obj) \
277 $(generic_decoder_obj) \
278 $(video_parser_obj) \
279 $(video_decoder_obj) \
286 ifneq (,$(findstring X86,$(ARCH)))
287 ifneq (,$(findstring MMX,$(ARCH)))
288 ifeq ($(DECODER),new)
289 ASM_OBJ = video_decoder/vdec_idctmmx.o \
290 video_output/video_yuv_mmx.o
292 ASM_OBJ = video_decoder_ref/vdec_idctmmx.o \
293 video_output/video_yuv_mmx.o
301 interface_plugin = $(VIDEO:%=interface/intf_%.so)
302 audio_plugin = $(AUDIO:%=audio_output/aout_%.so)
303 video_plugin = $(VIDEO:%=video_output/vout_%.so)
305 PLUGIN_OBJ = $(interface_plugin) $(audio_plugin) $(video_plugin)
308 # Other lists of files
310 sources := $(C_OBJ:%.o=%.c) $(PLUGIN_OBJ:%.so=%.c)
311 dependancies := $(sources:%.c=.dep/%.d)
313 # All symbols must be exported
316 ################################################################################
318 ################################################################################
326 rm -f $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
329 rm -f **/*.o **/*.so **/*~ *.log
330 rm -f vlc gmon.out core
334 $(INSTALL) vlc $(PREFIX)/bin
335 mkdir -p $(PREFIX)/lib/videolan/vlc
336 $(INSTALL) $(PLUGIN_OBJ) $(PREFIX)/lib/videolan/vlc
339 @echo "Command line for C objects:"
340 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
342 @echo "Command line for assembler objects:"
343 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
350 vlc: $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
351 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(ASM_OBJ)
354 # Generic rules (see below)
356 $(dependancies): %.d: FORCE
357 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
359 $(C_OBJ): %.o: Makefile.dep
360 $(C_OBJ): %.o: .dep/%.d
362 @echo "compiling $*.o from $*.c"
363 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
365 $(ASM_OBJ): %.o: Makefile.dep
367 @echo "assembling $*.o from $*.S"
368 @$(CC) $(CFLAGS) -c -o $@ $<
370 $(PLUGIN_OBJ): %.so: Makefile.dep
371 $(PLUGIN_OBJ): %.so: .dep/%.d
374 audio_output/aout_dummy.so audio_output/aout_dsp.so: %.so: %.c
375 @echo "compiling $*.so from $*.c"
376 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
378 audio_output/aout_esd.so: %.so: %.c
379 @echo "compiling $*.so from $*.c"
381 @$(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
383 @$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
387 interface/intf_dummy.so video_output/vout_dummy.so \
388 interface/intf_fb.so video_output/vout_fb.so: %.so: %.c
389 @echo "compiling $*.so from $*.c"
390 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
392 interface/intf_x11.so video_output/vout_x11.so: %.so: %.c
393 @echo "compiling $*.so from $*.c"
394 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
396 interface/intf_glide.so video_output/vout_glide.so: %.so: %.c
397 @echo "compiling $*.so from $*.c"
398 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
400 interface/intf_ggi.so video_output/vout_ggi.so: %.so: %.c
401 @echo "compiling $*.so from $*.c"
402 @$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
405 ################################################################################
406 # Note on generic rules and dependancies
407 ################################################################################
409 # Note on dependancies: each .c file is associated with a .d file, which
410 # depends of it. The .o file associated with a .c file depends of the .d, of the
411 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
413 # The dep directory should be ignored by CVS.
415 # Note on inclusions: depending of the target, the dependancies files must
416 # or must not be included. The problem is that if we ask make to include a file,
417 # and this file does not exist, it is made before it can be included. In a
418 # general way, a .d file should be included if and only if the corresponding .o
419 # needs to be re-made.
421 # Two makefiles are used: the main one (this one) has regular generic rules,
422 # except for .o files, for which it calls the object Makefile. Dependancies
423 # are not included in this file.
424 # The object Makefile known how to make a .o from a .c, and includes
425 # dependancies for the target, but only those required.