1 ################################################################################
2 # vlc (VideoLAN Client) main makefile
4 ################################################################################
5 # This makefile is the main makefile for the VideoLAN client.
6 ################################################################################
8 ################################################################################
10 ################################################################################
16 # Audio output settings
20 # Fallback method that should always work
23 # Video output settings
31 # Fallback method that should always work
39 # Target operating system
44 # For x86 architecture, choose MMX support
48 # Decoder choice - ?? old decoder will be removed soon
52 # Debugging mode on or off (set to 1 to activate)
55 #----------------- do not change anything below this line ----------------------
57 ################################################################################
58 # Configuration pre-processing
59 ################################################################################
61 # Program version - may only be changed by the project leader
62 PROGRAM_VERSION = 0.1.99
65 audio := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
66 AUDIO := $(shell echo $(AUDIO) | tr 'a-z' 'A-Z')
69 video := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
70 VIDEO := $(shell echo $(VIDEO) | tr 'a-z' 'A-Z')
72 # PROGRAM_OPTIONS is an identification string of the compilation options
73 PROGRAM_OPTIONS = $(ARCH) $(SYS)
75 PROGRAM_OPTIONS += DEBUG
78 # PROGRAM_BUILD is a complete identification of the build
79 PROGRAM_BUILD = `date -R` $(USER)@`hostname`
81 # DEFINE will contain some of the constants definitions decided in Makefile,
82 # including ARCH_xx and SYS_xx. It will be passed to C compiler.
83 DEFINE += -DARCH_$(ARCH)
84 DEFINE += -DSYS_$(SYS)
85 DEFINE += -DAUDIO_OPTIONS="\"$(audio)\""
86 DEFINE += -DVIDEO_OPTIONS="\"$(video)\""
87 DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
88 DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
89 DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
94 ################################################################################
95 # Tuning and other variables - do not change anything except if you know
96 # exactly what you are doing
97 ################################################################################
100 # C headers directories
112 # C compiler flags: compilation
114 CCFLAGS += $(DEFINE) $(INCLUDE)
116 CCFLAGS += -D_REENTRANT
117 CCFLAGS += -D_GNU_SOURCE
119 # Optimizations : don't compile debug versions with them
121 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
122 CCFLAGS += -fomit-frame-pointer
124 # Optimizations for x86 familiy
126 CCFLAGS += -malign-double
127 CCFLAGS += -march=pentiumpro
128 #CCFLAGS += -march=pentium
131 # Optimizations for PowerPC
133 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
136 # Optimizations for Sparc
138 CCFLAGS += -mhard-float
142 # C compiler flags: dependancies
144 DCFLAGS += $(INCLUDE)
148 # C compiler flags: linking
155 # C compiler flags: common flags
158 # Eventual MMX optimizations for x86
166 # Additionnal debugging flags
175 #################################################################################
177 #################################################################################
182 interface_obj = interface/main.o \
183 interface/interface.o \
184 interface/intf_msg.o \
185 interface/intf_cmd.o \
186 interface/intf_ctrl.o \
187 interface/intf_console.o
189 input_obj = input/input_vlan.o \
191 input/input_netlist.o \
192 input/input_network.o \
198 audio_output_obj = audio_output/audio_output.o
200 video_output_obj = video_output/video_output.o \
201 video_output/video_text.o \
202 video_output/video_yuv.o
204 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
205 ac3_decoder/ac3_decoder.o \
206 ac3_decoder/ac3_parse.o \
207 ac3_decoder/ac3_exponent.o \
208 ac3_decoder/ac3_bit_allocate.o \
209 ac3_decoder/ac3_mantissa.o \
210 ac3_decoder/ac3_rematrix.o \
211 ac3_decoder/ac3_imdct.o \
212 ac3_decoder/ac3_downmix.o
214 audio_decoder_obj = audio_decoder/audio_decoder.o \
215 audio_decoder/audio_math.o
217 spu_decoder_obj = spu_decoder/spu_decoder.o
219 #??generic_decoder_obj = generic_decoder/generic_decoder.o
220 # remeber to add it to OBJ
222 ifeq ($(DECODER),old)
223 CFLAGS += -DOLD_DECODER
224 video_decoder_obj = video_decoder_ref/video_decoder.o \
225 video_decoder_ref/display.o \
226 video_decoder_ref/getblk.o \
227 video_decoder_ref/gethdr.o \
228 video_decoder_ref/getpic.o \
229 video_decoder_ref/getvlc.o \
230 video_decoder_ref/idct.o \
231 video_decoder_ref/motion.o \
232 video_decoder_ref/mpeg2dec.o \
233 video_decoder_ref/recon.o \
234 video_decoder_ref/spatscal.o
236 video_parser_obj = video_parser/video_parser.o \
237 video_parser/vpar_headers.o \
238 video_parser/vpar_blocks.o \
239 video_parser/vpar_synchro.o \
240 video_parser/video_fifo.o
242 video_decoder_obj = video_decoder/video_decoder.o \
243 video_decoder/vdec_motion.o \
244 video_decoder/vdec_idct.o
247 misc_obj = misc/mtime.o \
252 C_OBJ = $(interface_obj) \
254 $(audio_output_obj) \
255 $(video_output_obj) \
257 $(audio_decoder_obj) \
259 $(generic_decoder_obj) \
260 $(video_parser_obj) \
261 $(video_decoder_obj) \
270 ifeq ($(DECODER),new)
271 ASM_OBJ = video_decoder/vdec_idctmmx.o \
272 video_output/video_yuv_mmx.o
274 ASM_OBJ = video_decoder_ref/vdec_idctmmx.o \
275 video_output/video_yuv_mmx.o
283 interface_plugin = $(video:%=interface/intf_%.so)
284 audio_plugin = $(audio:%=audio_output/aout_%.so)
285 video_plugin = $(video:%=video_output/vout_%.so)
287 PLUGIN_OBJ = $(interface_plugin) \
292 # Other lists of files
294 sources := $(C_OBJ:%.o=%.c) $(PLUGIN_OBJ:%.so=%.c)
295 dependancies := $(sources:%.c=dep/%.d)
297 # All symbols must be exported
300 ################################################################################
302 ################################################################################
310 rm -f $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
313 rm -f **/*.o **/*.so **/*~ *.log
314 rm -f vlc gmon.out core
318 @echo "Command line for C objects:"
319 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
321 @echo "Command line for assembler objects:"
322 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
329 vlc: $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
330 $(CC) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(ASM_OBJ)
333 # Generic rules (see below)
335 $(dependancies): %.d: FORCE
336 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
338 $(C_OBJ): %.o: Makefile.dep
339 $(C_OBJ): %.o: dep/%.d
341 @echo "compiling $*.o from $*.c"
342 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
344 $(ASM_OBJ): %.o: Makefile.dep
346 @echo "assembling $*.o from $*.S"
347 @$(CC) $(CFLAGS) -c -o $@ $<
349 $(PLUGIN_OBJ): %.so: Makefile.dep
350 $(PLUGIN_OBJ): %.so: dep/%.d
353 audio_output/aout_dummy.so \
354 audio_output/aout_dsp.so: %.so: %.c
355 @echo "compiling $*.so from $*.c"
356 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
358 audio_output/aout_esd.so: %.so: %.c
359 @echo "compiling $*.so from $*.c"
360 @$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
363 interface/intf_dummy.so \
364 video_output/vout_dummy.so \
365 interface/intf_fb.so \
366 video_output/vout_fb.so: %.so: %.c
367 @echo "compiling $*.so from $*.c"
368 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
370 interface/intf_x11.so \
371 video_output/vout_x11.so: %.so: %.c
372 @echo "compiling $*.so from $*.c"
373 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
375 interface/intf_glide.so \
376 video_output/vout_glide.so: %.so: %.c
377 @echo "compiling $*.so from $*.c"
378 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
380 interface/intf_ggi.so \
381 video_output/vout_ggi.so: %.so: %.c
382 @echo "compiling $*.so from $*.c"
383 @$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
386 ################################################################################
387 # Note on generic rules and dependancies
388 ################################################################################
390 # Note on dependancies: each .c file is associated with a .d file, which
391 # depends of it. The .o file associated with a .c file depends of the .d, of the
392 # .c itself, and of Makefile. The .d files are stored in a separate dep/
394 # The dep directory should be ignored by CVS.
396 # Note on inclusions: depending of the target, the dependancies files must
397 # or must not be included. The problem is that if we ask make to include a file,
398 # and this file does not exist, it is made before it can be included. In a
399 # general way, a .d file should be included if and only if the corresponding .o
400 # needs to be re-made.
402 # Two makefiles are used: the main one (this one) has regular generic rules,
403 # except for .o files, for which it calls the object Makefile. Dependancies
404 # are not included in this file.
405 # The object Makefile known how to make a .o from a .c, and includes
406 # dependancies for the target, but only those required.