1 ################################################################################
2 # vlc (VideoLAN Client) main makefile
4 ################################################################################
5 # This makefile is the main makefile for the VideoLAN client.
6 ################################################################################
8 ################################################################################
10 ################################################################################
17 # Audio output settings
22 # Fallback method that should always work
25 # Video output settings
33 # Fallback method that should always work
41 # Target operating system
47 # For x86 architecture, choose MMX support
50 # For x86 architecture, optimize for Pentium Pro
51 # (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 - may only be changed by the project leader
69 PROGRAM_VERSION = 0.1.99
72 audio := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
73 AUDIO := $(shell echo $(AUDIO) | tr 'a-z' 'A-Z')
76 video := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
77 VIDEO := $(shell echo $(VIDEO) | tr 'a-z' 'A-Z')
79 # PROGRAM_OPTIONS is an identification string of the compilation options
80 PROGRAM_OPTIONS = $(ARCH) $(SYS)
82 PROGRAM_OPTIONS += DEBUG
85 # PROGRAM_BUILD is a complete identification of the build
86 # ( we can't use fancy options with date since OSes like Solaris
87 # or FreeBSD have strange date implementations )
88 PROGRAM_BUILD = `date` $(USER)@`hostname`
90 # DEFINE will contain some of the constants definitions decided in Makefile,
91 # including ARCH_xx and SYS_xx. It will be passed to C compiler.
92 DEFINE += -DARCH_$(ARCH)
93 DEFINE += -DSYS_$(SYS)
94 DEFINE += -DAUDIO_OPTIONS="\"$(audio)\""
95 DEFINE += -DVIDEO_OPTIONS="\"$(video)\""
96 DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
97 DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
98 DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
103 ################################################################################
104 # Tuning and other variables - do not change anything except if you know
105 # exactly what you are doing
106 ################################################################################
109 # C headers directories
111 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
116 LIB += -L/usr/local/lib
127 # C compiler flags: compilation
129 CCFLAGS += $(DEFINE) $(INCLUDE)
131 CCFLAGS += -D_REENTRANT
132 CCFLAGS += -D_GNU_SOURCE
134 # Optimizations : don't compile debug versions with them
136 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
137 CCFLAGS += -fomit-frame-pointer
139 # Optimizations for x86 familiy
141 CCFLAGS += -malign-double
142 #CCFLAGS += -march=pentium
145 CCFLAGS += -march=pentiumpro
148 # Eventual MMX optimizations for x86
154 # Optimizations for PowerPC
156 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
159 # Optimizations for Sparc
161 CCFLAGS += -mhard-float
165 # C compiler flags: dependancies
167 DCFLAGS += $(INCLUDE)
171 # C compiler flags: linking
178 # Additionnal debugging flags
187 #################################################################################
189 #################################################################################
194 interface_obj = interface/main.o \
195 interface/interface.o \
196 interface/intf_msg.o \
197 interface/intf_cmd.o \
198 interface/intf_ctrl.o \
199 interface/intf_console.o
201 input_obj = input/input_vlan.o \
203 input/input_netlist.o \
204 input/input_network.o \
210 audio_output_obj = audio_output/audio_output.o
212 video_output_obj = video_output/video_output.o \
213 video_output/video_text.o \
214 video_output/video_yuv.o
216 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
217 ac3_decoder/ac3_decoder.o \
218 ac3_decoder/ac3_parse.o \
219 ac3_decoder/ac3_exponent.o \
220 ac3_decoder/ac3_bit_allocate.o \
221 ac3_decoder/ac3_mantissa.o \
222 ac3_decoder/ac3_rematrix.o \
223 ac3_decoder/ac3_imdct.o \
224 ac3_decoder/ac3_downmix.o
226 audio_decoder_obj = audio_decoder/audio_decoder.o \
227 audio_decoder/audio_math.o
229 spu_decoder_obj = spu_decoder/spu_decoder.o
231 #??generic_decoder_obj = generic_decoder/generic_decoder.o
232 # remeber to add it to OBJ
234 ifeq ($(DECODER),old)
235 CFLAGS += -DOLD_DECODER
236 video_decoder_obj = video_decoder_ref/video_decoder.o \
237 video_decoder_ref/display.o \
238 video_decoder_ref/getblk.o \
239 video_decoder_ref/gethdr.o \
240 video_decoder_ref/getpic.o \
241 video_decoder_ref/getvlc.o \
242 video_decoder_ref/idct.o \
243 video_decoder_ref/motion.o \
244 video_decoder_ref/mpeg2dec.o \
245 video_decoder_ref/recon.o \
246 video_decoder_ref/spatscal.o
248 video_parser_obj = video_parser/video_parser.o \
249 video_parser/vpar_headers.o \
250 video_parser/vpar_blocks.o \
251 video_parser/vpar_synchro.o \
252 video_parser/video_fifo.o
254 video_decoder_obj = video_decoder/video_decoder.o \
255 video_decoder/vdec_motion.o \
256 video_decoder/vdec_motion_inner.o \
257 video_decoder/vdec_idct.o
260 misc_obj = misc/mtime.o \
265 C_OBJ = $(interface_obj) \
267 $(audio_output_obj) \
268 $(video_output_obj) \
270 $(audio_decoder_obj) \
272 $(generic_decoder_obj) \
273 $(video_parser_obj) \
274 $(video_decoder_obj) \
283 ifeq ($(DECODER),new)
284 ASM_OBJ = video_decoder/vdec_idctmmx.o \
285 video_output/video_yuv_mmx.o
287 ASM_OBJ = video_decoder_ref/vdec_idctmmx.o \
288 video_output/video_yuv_mmx.o
296 interface_plugin = $(video:%=interface/intf_%.so)
297 audio_plugin = $(audio:%=audio_output/aout_%.so)
298 video_plugin = $(video:%=video_output/vout_%.so)
300 PLUGIN_OBJ = $(interface_plugin) $(audio_plugin) $(video_plugin)
303 # Other lists of files
305 sources := $(C_OBJ:%.o=%.c) $(PLUGIN_OBJ:%.so=%.c)
306 dependancies := $(sources:%.c=dep/%.d)
308 # All symbols must be exported
311 ################################################################################
313 ################################################################################
321 rm -f $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
324 rm -f **/*.o **/*.so **/*~ *.log
325 rm -f vlc gmon.out core
329 @echo "Command line for C objects:"
330 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
332 @echo "Command line for assembler objects:"
333 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
340 vlc: $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
341 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(ASM_OBJ)
344 # Generic rules (see below)
346 $(dependancies): %.d: FORCE
347 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
349 $(C_OBJ): %.o: Makefile.dep
350 $(C_OBJ): %.o: dep/%.d
352 @echo "compiling $*.o from $*.c"
353 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
355 $(ASM_OBJ): %.o: Makefile.dep
357 @echo "assembling $*.o from $*.S"
358 @$(CC) $(CFLAGS) -c -o $@ $<
360 $(PLUGIN_OBJ): %.so: Makefile.dep
361 $(PLUGIN_OBJ): %.so: dep/%.d
364 audio_output/aout_dummy.so audio_output/aout_dsp.so: %.so: %.c
365 @echo "compiling $*.so from $*.c"
366 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
368 audio_output/aout_esd.so: %.so: %.c
369 @echo "compiling $*.so from $*.c"
370 @$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
373 interface/intf_dummy.so video_output/vout_dummy.so \
374 interface/intf_fb.so video_output/vout_fb.so: %.so: %.c
375 @echo "compiling $*.so from $*.c"
376 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
378 interface/intf_x11.so video_output/vout_x11.so: %.so: %.c
379 @echo "compiling $*.so from $*.c"
380 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
382 interface/intf_glide.so video_output/vout_glide.so: %.so: %.c
383 @echo "compiling $*.so from $*.c"
384 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
386 interface/intf_ggi.so video_output/vout_ggi.so: %.so: %.c
387 @echo "compiling $*.so from $*.c"
388 @$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
391 ################################################################################
392 # Note on generic rules and dependancies
393 ################################################################################
395 # Note on dependancies: each .c file is associated with a .d file, which
396 # depends of it. The .o file associated with a .c file depends of the .d, of the
397 # .c itself, and of Makefile. The .d files are stored in a separate dep/
399 # The dep directory should be ignored by CVS.
401 # Note on inclusions: depending of the target, the dependancies files must
402 # or must not be included. The problem is that if we ask make to include a file,
403 # and this file does not exist, it is made before it can be included. In a
404 # general way, a .d file should be included if and only if the corresponding .o
405 # needs to be re-made.
407 # Two makefiles are used: the main one (this one) has regular generic rules,
408 # except for .o files, for which it calls the object Makefile. Dependancies
409 # are not included in this file.
410 # The object Makefile known how to make a .o from a .c, and includes
411 # dependancies for the target, but only those required.