1 ################################################################################
2 # vlc (VideoLAN Client) main makefile
4 ################################################################################
5 # This makefile is the main makefile for the VideoLAN client.
6 ################################################################################
8 ################################################################################
10 ################################################################################
16 # Video output settings
34 # Target operating system
39 # For x86 architecture, choose MMX support
43 # Decoder choice - ?? old decoder will be removed soon
47 # Debugging mode on or off (set to 1 to activate)
50 #----------------- do not change anything below this line ----------------------
52 ################################################################################
53 # Configuration pre-processing
54 ################################################################################
56 # Program version - may only be changed by the project leader
57 PROGRAM_VERSION = 1.0-dev
59 # PROGRAM_OPTIONS is an identification string of the compilation options
60 PROGRAM_OPTIONS = $(VIDEO) $(ARCH) $(SYS)
62 PROGRAM_OPTIONS += DEBUG
65 # PROGRAM_BUILD is a complete identification of the build
66 PROGRAM_BUILD = `date -R` $(USER)@`hostname`
68 # DEFINE will contain some of the constants definitions decided in Makefile,
69 # including VIDEO_xx and ARCH_xx. It will be passed to C compiler.
70 DEFINE += -DVIDEO_$(VIDEO)
71 DEFINE += -DARCH_$(ARCH)
72 DEFINE += -DSYS_$(SYS)
73 DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
74 DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
75 DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
80 # video is a lowercase version of VIDEO used for filenames
81 video = $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
83 ################################################################################
84 # Tunning and other variables - do not change anything except if you know
85 # exactly what you are doing
86 ################################################################################
89 # C headers directories
94 INCLUDE += -I/usr/X11R6/include
98 INCLUDE += -I/usr/include/glide
108 LIB += -L/usr/X11R6/lib
120 # C compiler flags: compilation
122 CCFLAGS += $(DEFINE) $(INCLUDE)
124 CCFLAGS += -D_REENTRANT
125 CCFLAGS += -D_GNU_SOURCE
127 # Optimizations : don't compile debug versions with them
129 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
130 CCFLAGS += -fomit-frame-pointer
132 # Optimizations for x86 familiy
134 CCFLAGS += -malign-double
135 CCFLAGS += -march=pentiumpro
136 #CCFLAGS += -march=pentium
139 # Optimizations for PowerPC
141 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
144 # Optimizations for Sparc
146 CCFLAGS += -mhard-float
150 # C compiler flags: dependancies
152 DCFLAGS += $(INCLUDE)
156 # C compiler flags: linking
163 # C compiler flags: common flags
166 # Eventual MMX optimizations for x86
168 ifeq ($(MMX), YES) # MMX is YES or AUTO
174 # Additionnal debugging flags
183 #################################################################################
185 #################################################################################
190 interface_obj = interface/main.o \
191 interface/interface.o \
192 interface/intf_msg.o \
193 interface/intf_cmd.o \
194 interface/intf_ctrl.o \
195 interface/control.o \
196 interface/intf_console.o \
197 interface/intf_$(video).o
199 input_obj = input/input_vlan.o \
201 input/input_netlist.o \
202 input/input_network.o \
208 audio_output_obj = audio_output/audio_output.o \
209 audio_output/audio_dsp.o
211 video_output_obj = video_output/video_output.o \
212 video_output/video_$(video).o \
213 video_output/video_text.o \
214 video_output/video_yuv.o
216 ac3_decoder_obj = ac3_decoder/ac3_decoder.o \
217 ac3_decoder/ac3_parse.o \
218 ac3_decoder/ac3_exponent.o \
219 ac3_decoder/ac3_bit_allocate.o \
220 ac3_decoder/ac3_mantissa.o \
221 ac3_decoder/ac3_rematrix.o \
222 ac3_decoder/ac3_imdct.o \
223 ac3_decoder/ac3_downmix.o
225 audio_decoder_obj = audio_decoder/audio_decoder.o \
226 audio_decoder/audio_math.o
228 spu_decoder_obj = spu_decoder/spu_decoder.o
230 #??generic_decoder_obj = generic_decoder/generic_decoder.o
231 # remeber to add it to OBJ
233 ifeq ($(DECODER),old)
234 CFLAGS += -DOLD_DECODER
235 video_decoder_obj = video_decoder_ref/video_decoder.o \
236 video_decoder_ref/display.o \
237 video_decoder_ref/getblk.o \
238 video_decoder_ref/gethdr.o \
239 video_decoder_ref/getpic.o \
240 video_decoder_ref/getvlc.o \
241 video_decoder_ref/idct.o \
242 video_decoder_ref/motion.o \
243 video_decoder_ref/mpeg2dec.o \
244 video_decoder_ref/recon.o \
245 video_decoder_ref/spatscal.o
247 video_parser_obj = video_parser/video_parser.o \
248 video_parser/vpar_headers.o \
249 video_parser/vpar_blocks.o \
250 video_parser/vpar_synchro.o \
251 video_parser/video_fifo.o
253 video_decoder_obj = video_decoder/video_decoder.o \
254 video_decoder/vdec_motion.o \
255 video_decoder/vdec_idct.o
258 misc_obj = misc/mtime.o \
262 C_OBJ = $(interface_obj) \
264 $(audio_output_obj) \
265 $(video_output_obj) \
267 $(audio_decoder_obj) \
269 $(generic_decoder_obj) \
270 $(video_parser_obj) \
271 $(video_decoder_obj) \
280 ifeq ($(DECODER),new)
281 ASM_OBJ = video_decoder/idctmmx.o \
282 video_output/video_yuv_mmx.o
284 ASM_OBJ = video_decoder_ref/idctmmx.o \
285 video_output/video_yuv_mmx.o
291 # Other lists of files
293 sources := $(C_OBJ:%.o=%.c)
294 dependancies := $(sources:%.c=dep/%.d)
296 # All symbols must be exported
299 ################################################################################
301 ################################################################################
309 rm -f $(C_OBJ) $(ASM_OBJ)
312 rm -f **/*.o **/*~ *.log
313 rm -f vlc gmon.out core
317 @echo "Command line for C objects:"
318 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
320 @echo "Command line for assembler objects:"
321 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
328 vlc: $(C_OBJ) $(ASM_OBJ)
329 $(CC) $(LCFLAGS) $(CFLAGS) -o $@ $(C_OBJ) $(ASM_OBJ)
332 # Generic rules (see below)
334 $(dependancies): %.d: FORCE
335 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
337 $(C_OBJ): %.o: Makefile Makefile.dep
338 $(C_OBJ): %.o: dep/%.d
340 @echo "compiling $*.c"
341 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
343 $(ASM_OBJ): %.o: Makefile Makefile.dep
345 @echo "assembling $*.S"
346 @$(CC) $(CFLAGS) -c -o $@ $<
348 ################################################################################
349 # Note on generic rules and dependancies
350 ################################################################################
352 # Note on dependancies: each .c file is associated with a .d file, which
353 # depends of it. The .o file associated with a .c file depends of the .d, of the
354 # .c itself, and of Makefile. The .d files are stored in a separate dep/
356 # The dep directory should be ignored by CVS.
358 # Note on inclusions: depending of the target, the dependancies files must
359 # or must not be included. The problem is that if we ask make to include a file,
360 # and this file does not exist, it is made before it can be included. In a
361 # general way, a .d file should be included if and only if the corresponding .o
362 # needs to be re-made.
364 # Two makefiles are used: the main one (this one) has regular generic rules,
365 # except for .o files, for which it calls the object Makefile. Dependancies
366 # are not included in this file.
367 # The object Makefile known how to make a .o from a .c, and includes
368 # dependancies for the target, but only those required.