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_motion_inner.o \
245 video_decoder/vdec_idct.o
248 misc_obj = misc/mtime.o \
253 C_OBJ = $(interface_obj) \
255 $(audio_output_obj) \
256 $(video_output_obj) \
258 $(audio_decoder_obj) \
260 $(generic_decoder_obj) \
261 $(video_parser_obj) \
262 $(video_decoder_obj) \
271 ifeq ($(DECODER),new)
272 ASM_OBJ = video_decoder/vdec_idctmmx.o \
273 video_output/video_yuv_mmx.o
275 ASM_OBJ = video_decoder_ref/vdec_idctmmx.o \
276 video_output/video_yuv_mmx.o
284 interface_plugin = $(video:%=interface/intf_%.so)
285 audio_plugin = $(audio:%=audio_output/aout_%.so)
286 video_plugin = $(video:%=video_output/vout_%.so)
288 PLUGIN_OBJ = $(interface_plugin) \
293 # Other lists of files
295 sources := $(C_OBJ:%.o=%.c) $(PLUGIN_OBJ:%.so=%.c)
296 dependancies := $(sources:%.c=dep/%.d)
298 # All symbols must be exported
301 ################################################################################
303 ################################################################################
311 rm -f $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
314 rm -f **/*.o **/*.so **/*~ *.log
315 rm -f vlc gmon.out core
319 @echo "Command line for C objects:"
320 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
322 @echo "Command line for assembler objects:"
323 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
330 vlc: $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
331 $(CC) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(ASM_OBJ)
334 # Generic rules (see below)
336 $(dependancies): %.d: FORCE
337 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
339 $(C_OBJ): %.o: Makefile.dep
340 $(C_OBJ): %.o: dep/%.d
342 @echo "compiling $*.o from $*.c"
343 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
345 $(ASM_OBJ): %.o: Makefile.dep
347 @echo "assembling $*.o from $*.S"
348 @$(CC) $(CFLAGS) -c -o $@ $<
350 $(PLUGIN_OBJ): %.so: Makefile.dep
351 $(PLUGIN_OBJ): %.so: dep/%.d
354 audio_output/aout_dummy.so \
355 audio_output/aout_dsp.so: %.so: %.c
356 @echo "compiling $*.so from $*.c"
357 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
359 audio_output/aout_esd.so: %.so: %.c
360 @echo "compiling $*.so from $*.c"
361 @$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
364 interface/intf_dummy.so \
365 video_output/vout_dummy.so \
366 interface/intf_fb.so \
367 video_output/vout_fb.so: %.so: %.c
368 @echo "compiling $*.so from $*.c"
369 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
371 interface/intf_x11.so \
372 video_output/vout_x11.so: %.so: %.c
373 @echo "compiling $*.so from $*.c"
374 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
376 interface/intf_glide.so \
377 video_output/vout_glide.so: %.so: %.c
378 @echo "compiling $*.so from $*.c"
379 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
381 interface/intf_ggi.so \
382 video_output/vout_ggi.so: %.so: %.c
383 @echo "compiling $*.so from $*.c"
384 @$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
387 ################################################################################
388 # Note on generic rules and dependancies
389 ################################################################################
391 # Note on dependancies: each .c file is associated with a .d file, which
392 # depends of it. The .o file associated with a .c file depends of the .d, of the
393 # .c itself, and of Makefile. The .d files are stored in a separate dep/
395 # The dep directory should be ignored by CVS.
397 # Note on inclusions: depending of the target, the dependancies files must
398 # or must not be included. The problem is that if we ask make to include a file,
399 # and this file does not exist, it is made before it can be included. In a
400 # general way, a .d file should be included if and only if the corresponding .o
401 # needs to be re-made.
403 # Two makefiles are used: the main one (this one) has regular generic rules,
404 # except for .o files, for which it calls the object Makefile. Dependancies
405 # are not included in this file.
406 # The object Makefile known how to make a .o from a .c, and includes
407 # dependancies for the target, but only those required.