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.95.0
65 audio := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
66 AUDIO := $(shell echo $(AUDIO) | tr 'a-z' 'A-Z')
67 DEFINE += $(AUDIO:%=-DAUDIO_%)
70 video := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
71 VIDEO := $(shell echo $(VIDEO) | tr 'a-z' 'A-Z')
72 DEFINE += $(VIDEO:%=-DVIDEO_%)
74 # PROGRAM_OPTIONS is an identification string of the compilation options
75 PROGRAM_OPTIONS = $(ARCH) $(SYS)
77 PROGRAM_OPTIONS += DEBUG
80 # PROGRAM_BUILD is a complete identification of the build
81 PROGRAM_BUILD = `date -R` $(USER)@`hostname`
83 # DEFINE will contain some of the constants definitions decided in Makefile,
84 # including ARCH_xx and SYS_xx. It will be passed to C compiler.
85 DEFINE += -DARCH_$(ARCH)
86 DEFINE += -DSYS_$(SYS)
87 DEFINE += -DAUDIO_OPTIONS="\"$(audio)\""
88 DEFINE += -DVIDEO_OPTIONS="\"$(video)\""
89 DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
90 DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
91 DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
96 ################################################################################
97 # Tuning and other variables - do not change anything except if you know
98 # exactly what you are doing
99 ################################################################################
102 # C headers directories
106 ifneq (,$(findstring x11,$(video)))
107 INCLUDE += -I/usr/X11R6/include
110 ifneq (,$(findstring glide,$(video)))
111 INCLUDE += -I/usr/include/glide
120 ifneq (,$(findstring x11,$(video)))
121 LIB += -L/usr/X11R6/lib -lX11 -lXext
123 ifneq (,$(findstring ggi,$(video)))
126 ifneq (,$(findstring glide,$(video)))
130 ifneq (,$(findstring esd,$(audio)))
131 LIB += -lesd -laudiofile
135 # C compiler flags: compilation
137 CCFLAGS += $(DEFINE) $(INCLUDE)
139 CCFLAGS += -D_REENTRANT
140 CCFLAGS += -D_GNU_SOURCE
142 # Optimizations : don't compile debug versions with them
144 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
145 CCFLAGS += -fomit-frame-pointer
147 # Optimizations for x86 familiy
149 CCFLAGS += -malign-double
150 CCFLAGS += -march=pentiumpro
151 #CCFLAGS += -march=pentium
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 # C compiler flags: common flags
181 # Eventual MMX optimizations for x86
189 # Additionnal debugging flags
198 #################################################################################
200 #################################################################################
205 interface_obj = interface/main.o \
206 interface/interface.o \
207 interface/intf_msg.o \
208 interface/intf_cmd.o \
209 interface/intf_ctrl.o \
210 interface/intf_console.o \
211 $(video:%=interface/intf_%.o)
213 input_obj = input/input_vlan.o \
215 input/input_netlist.o \
216 input/input_network.o \
222 audio_output_obj = audio_output/audio_output.o \
223 $(audio:%=audio_output/aout_%.o)
225 video_output_obj = video_output/video_output.o \
226 video_output/video_text.o \
227 video_output/video_yuv.o \
228 $(video:%=video_output/vout_%.o)
230 ac3_decoder_obj = ac3_decoder/ac3_decoder.o \
231 ac3_decoder/ac3_parse.o \
232 ac3_decoder/ac3_exponent.o \
233 ac3_decoder/ac3_bit_allocate.o \
234 ac3_decoder/ac3_mantissa.o \
235 ac3_decoder/ac3_rematrix.o \
236 ac3_decoder/ac3_imdct.o \
237 ac3_decoder/ac3_downmix.o
239 audio_decoder_obj = audio_decoder/audio_decoder.o \
240 audio_decoder/audio_math.o
242 spu_decoder_obj = spu_decoder/spu_decoder.o
244 #??generic_decoder_obj = generic_decoder/generic_decoder.o
245 # remeber to add it to OBJ
247 ifeq ($(DECODER),old)
248 CFLAGS += -DOLD_DECODER
249 video_decoder_obj = video_decoder_ref/video_decoder.o \
250 video_decoder_ref/display.o \
251 video_decoder_ref/getblk.o \
252 video_decoder_ref/gethdr.o \
253 video_decoder_ref/getpic.o \
254 video_decoder_ref/getvlc.o \
255 video_decoder_ref/idct.o \
256 video_decoder_ref/motion.o \
257 video_decoder_ref/mpeg2dec.o \
258 video_decoder_ref/recon.o \
259 video_decoder_ref/spatscal.o
261 video_parser_obj = video_parser/video_parser.o \
262 video_parser/vpar_headers.o \
263 video_parser/vpar_blocks.o \
264 video_parser/vpar_synchro.o \
265 video_parser/video_fifo.o
267 video_decoder_obj = video_decoder/video_decoder.o \
268 video_decoder/vdec_motion.o \
269 video_decoder/vdec_idct.o
272 misc_obj = misc/mtime.o \
277 C_OBJ = $(interface_obj) \
279 $(audio_output_obj) \
280 $(video_output_obj) \
282 $(audio_decoder_obj) \
284 $(generic_decoder_obj) \
285 $(video_parser_obj) \
286 $(video_decoder_obj) \
295 ifeq ($(DECODER),new)
296 ASM_OBJ = video_decoder/vdec_idctmmx.o \
297 video_output/video_yuv_mmx.o
299 ASM_OBJ = video_decoder_ref/vdec_idctmmx.o \
300 video_output/video_yuv_mmx.o
306 # Other lists of files
308 sources := $(C_OBJ:%.o=%.c)
309 dependancies := $(sources:%.c=dep/%.d)
311 # All symbols must be exported
314 ################################################################################
316 ################################################################################
324 rm -f $(C_OBJ) $(ASM_OBJ)
327 rm -f **/*.o **/*~ *.log
328 rm -f vlc gmon.out core
332 @echo "Command line for C objects:"
333 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
335 @echo "Command line for assembler objects:"
336 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
343 vlc: $(C_OBJ) $(ASM_OBJ)
344 $(CC) $(LCFLAGS) $(CFLAGS) -o $@ $(C_OBJ) $(ASM_OBJ)
347 # Generic rules (see below)
349 $(dependancies): %.d: FORCE
350 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
352 $(C_OBJ): %.o: Makefile.dep
353 $(C_OBJ): %.o: dep/%.d
355 @echo "compiling $*.c"
356 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
358 $(ASM_OBJ): %.o: Makefile.dep
360 @echo "assembling $*.S"
361 @$(CC) $(CFLAGS) -c -o $@ $<
363 ################################################################################
364 # Note on generic rules and dependancies
365 ################################################################################
367 # Note on dependancies: each .c file is associated with a .d file, which
368 # depends of it. The .o file associated with a .c file depends of the .d, of the
369 # .c itself, and of Makefile. The .d files are stored in a separate dep/
371 # The dep directory should be ignored by CVS.
373 # Note on inclusions: depending of the target, the dependancies files must
374 # or must not be included. The problem is that if we ask make to include a file,
375 # and this file does not exist, it is made before it can be included. In a
376 # general way, a .d file should be included if and only if the corresponding .o
377 # needs to be re-made.
379 # Two makefiles are used: the main one (this one) has regular generic rules,
380 # except for .o files, for which it calls the object Makefile. Dependancies
381 # are not included in this file.
382 # The object Makefile known how to make a .o from a .c, and includes
383 # dependancies for the target, but only those required.