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
30 # Fallback method that should always work
38 # Target operating system
43 # For x86 architecture, choose MMX support
47 # Decoder choice - ?? old decoder will be removed soon
51 # Debugging mode on or off (set to 1 to activate)
54 #----------------- do not change anything below this line ----------------------
56 ################################################################################
57 # Configuration pre-processing
58 ################################################################################
60 # Program version - may only be changed by the project leader
61 PROGRAM_VERSION = 0.95.0
64 audio := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
65 AUDIO := $(shell echo $(AUDIO) | tr 'a-z' 'A-Z')
66 DEFINE += $(AUDIO:%=-DAUDIO_%)
69 video := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
70 VIDEO := $(shell echo $(VIDEO) | tr 'a-z' 'A-Z')
71 DEFINE += $(VIDEO:%=-DVIDEO_%)
73 # PROGRAM_OPTIONS is an identification string of the compilation options
74 PROGRAM_OPTIONS = $(ARCH) $(SYS)
76 PROGRAM_OPTIONS += DEBUG
79 # PROGRAM_BUILD is a complete identification of the build
80 PROGRAM_BUILD = `date -R` $(USER)@`hostname`
82 # DEFINE will contain some of the constants definitions decided in Makefile,
83 # including ARCH_xx and SYS_xx. It will be passed to C compiler.
84 DEFINE += -DARCH_$(ARCH)
85 DEFINE += -DSYS_$(SYS)
86 DEFINE += -DAUDIO_OPTIONS="\"$(audio)\""
87 DEFINE += -DVIDEO_OPTIONS="\"$(video)\""
88 DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
89 DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
90 DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
95 ################################################################################
96 # Tuning and other variables - do not change anything except if you know
97 # exactly what you are doing
98 ################################################################################
101 # C headers directories
105 ifneq (,$(findstring x11,$(video)))
106 INCLUDE += -I/usr/X11R6/include
109 ifneq (,$(findstring glide,$(video)))
110 INCLUDE += -I/usr/include/glide
119 ifneq (,$(findstring x11,$(video)))
120 LIB += -L/usr/X11R6/lib
124 ifneq (,$(findstring ggi,$(video)))
127 ifneq (,$(findstring glide,$(video)))
132 # C compiler flags: compilation
134 CCFLAGS += $(DEFINE) $(INCLUDE)
136 CCFLAGS += -D_REENTRANT
137 CCFLAGS += -D_GNU_SOURCE
139 # Optimizations : don't compile debug versions with them
141 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
142 CCFLAGS += -fomit-frame-pointer
144 # Optimizations for x86 familiy
146 CCFLAGS += -malign-double
147 CCFLAGS += -march=pentiumpro
148 #CCFLAGS += -march=pentium
151 # Optimizations for PowerPC
153 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
156 # Optimizations for Sparc
158 CCFLAGS += -mhard-float
162 # C compiler flags: dependancies
164 DCFLAGS += $(INCLUDE)
168 # C compiler flags: linking
175 # C compiler flags: common flags
178 # Eventual MMX optimizations for x86
180 ifeq ($(MMX), YES) # MMX is YES or AUTO
186 # Additionnal debugging flags
195 #################################################################################
197 #################################################################################
202 interface_obj = interface/main.o \
203 interface/interface.o \
204 interface/intf_msg.o \
205 interface/intf_cmd.o \
206 interface/intf_ctrl.o \
207 interface/control.o \
208 interface/intf_console.o \
209 $(video:%=interface/intf_%.o)
211 input_obj = input/input_vlan.o \
213 input/input_netlist.o \
214 input/input_network.o \
220 audio_output_obj = audio_output/audio_output.o \
221 $(audio:%=audio_output/aout_%.o)
223 video_output_obj = video_output/video_output.o \
224 video_output/video_text.o \
225 video_output/video_yuv.o \
226 $(video:%=video_output/vout_%.o)
228 ac3_decoder_obj = ac3_decoder/ac3_decoder.o \
229 ac3_decoder/ac3_parse.o \
230 ac3_decoder/ac3_exponent.o \
231 ac3_decoder/ac3_bit_allocate.o \
232 ac3_decoder/ac3_mantissa.o \
233 ac3_decoder/ac3_rematrix.o \
234 ac3_decoder/ac3_imdct.o \
235 ac3_decoder/ac3_downmix.o
237 audio_decoder_obj = audio_decoder/audio_decoder.o \
238 audio_decoder/audio_math.o
240 spu_decoder_obj = spu_decoder/spu_decoder.o
242 #??generic_decoder_obj = generic_decoder/generic_decoder.o
243 # remeber to add it to OBJ
245 ifeq ($(DECODER),old)
246 CFLAGS += -DOLD_DECODER
247 video_decoder_obj = video_decoder_ref/video_decoder.o \
248 video_decoder_ref/display.o \
249 video_decoder_ref/getblk.o \
250 video_decoder_ref/gethdr.o \
251 video_decoder_ref/getpic.o \
252 video_decoder_ref/getvlc.o \
253 video_decoder_ref/idct.o \
254 video_decoder_ref/motion.o \
255 video_decoder_ref/mpeg2dec.o \
256 video_decoder_ref/recon.o \
257 video_decoder_ref/spatscal.o
259 video_parser_obj = video_parser/video_parser.o \
260 video_parser/vpar_headers.o \
261 video_parser/vpar_blocks.o \
262 video_parser/vpar_synchro.o \
263 video_parser/video_fifo.o
265 video_decoder_obj = video_decoder/video_decoder.o \
266 video_decoder/vdec_motion.o \
267 video_decoder/vdec_idct.o
270 misc_obj = misc/mtime.o \
274 C_OBJ = $(interface_obj) \
276 $(audio_output_obj) \
277 $(video_output_obj) \
279 $(audio_decoder_obj) \
281 $(generic_decoder_obj) \
282 $(video_parser_obj) \
283 $(video_decoder_obj) \
292 ifeq ($(DECODER),new)
293 ASM_OBJ = video_decoder/vdec_idctmmx.o \
294 video_output/video_yuv_mmx.o
296 ASM_OBJ = video_decoder_ref/vdec_idctmmx.o \
297 video_output/video_yuv_mmx.o
303 # Other lists of files
305 sources := $(C_OBJ:%.o=%.c)
306 dependancies := $(sources:%.c=dep/%.d)
308 # All symbols must be exported
311 ################################################################################
313 ################################################################################
321 rm -f $(C_OBJ) $(ASM_OBJ)
324 rm -f **/*.o **/*~ *.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)
341 $(CC) $(LCFLAGS) $(CFLAGS) -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 $*.c"
353 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
355 $(ASM_OBJ): %.o: Makefile.dep
357 @echo "assembling $*.S"
358 @$(CC) $(CFLAGS) -c -o $@ $<
360 ################################################################################
361 # Note on generic rules and dependancies
362 ################################################################################
364 # Note on dependancies: each .c file is associated with a .d file, which
365 # depends of it. The .o file associated with a .c file depends of the .d, of the
366 # .c itself, and of Makefile. The .d files are stored in a separate dep/
368 # The dep directory should be ignored by CVS.
370 # Note on inclusions: depending of the target, the dependancies files must
371 # or must not be included. The problem is that if we ask make to include a file,
372 # and this file does not exist, it is made before it can be included. In a
373 # general way, a .d file should be included if and only if the corresponding .o
374 # needs to be re-made.
376 # Two makefiles are used: the main one (this one) has regular generic rules,
377 # except for .o files, for which it calls the object Makefile. Dependancies
378 # are not included in this file.
379 # The object Makefile known how to make a .o from a .c, and includes
380 # dependancies for the target, but only those required.