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
125 ifneq (,$(findstring ggi,$(video)))
128 ifneq (,$(findstring glide,$(video)))
133 # C compiler flags: compilation
135 CCFLAGS += $(DEFINE) $(INCLUDE)
137 CCFLAGS += -D_REENTRANT
138 CCFLAGS += -D_GNU_SOURCE
140 # Optimizations : don't compile debug versions with them
142 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
143 CCFLAGS += -fomit-frame-pointer
145 # Optimizations for x86 familiy
147 CCFLAGS += -malign-double
148 CCFLAGS += -march=pentiumpro
149 #CCFLAGS += -march=pentium
152 # Optimizations for PowerPC
154 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
157 # Optimizations for Sparc
159 CCFLAGS += -mhard-float
163 # C compiler flags: dependancies
165 DCFLAGS += $(INCLUDE)
169 # C compiler flags: linking
176 # C compiler flags: common flags
179 # Eventual MMX optimizations for x86
187 # Additionnal debugging flags
196 #################################################################################
198 #################################################################################
203 interface_obj = interface/main.o \
204 interface/interface.o \
205 interface/intf_msg.o \
206 interface/intf_cmd.o \
207 interface/intf_ctrl.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 \
275 C_OBJ = $(interface_obj) \
277 $(audio_output_obj) \
278 $(video_output_obj) \
280 $(audio_decoder_obj) \
282 $(generic_decoder_obj) \
283 $(video_parser_obj) \
284 $(video_decoder_obj) \
293 ifeq ($(DECODER),new)
294 ASM_OBJ = video_decoder/vdec_idctmmx.o \
295 video_output/video_yuv_mmx.o
297 ASM_OBJ = video_decoder_ref/vdec_idctmmx.o \
298 video_output/video_yuv_mmx.o
304 # Other lists of files
306 sources := $(C_OBJ:%.o=%.c)
307 dependancies := $(sources:%.c=dep/%.d)
309 # All symbols must be exported
312 ################################################################################
314 ################################################################################
322 rm -f $(C_OBJ) $(ASM_OBJ)
325 rm -f **/*.o **/*~ *.log
326 rm -f vlc gmon.out core
330 @echo "Command line for C objects:"
331 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
333 @echo "Command line for assembler objects:"
334 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
341 vlc: $(C_OBJ) $(ASM_OBJ)
342 $(CC) $(LCFLAGS) $(CFLAGS) -o $@ $(C_OBJ) $(ASM_OBJ)
345 # Generic rules (see below)
347 $(dependancies): %.d: FORCE
348 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
350 $(C_OBJ): %.o: Makefile.dep
351 $(C_OBJ): %.o: dep/%.d
353 @echo "compiling $*.c"
354 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
356 $(ASM_OBJ): %.o: Makefile.dep
358 @echo "assembling $*.S"
359 @$(CC) $(CFLAGS) -c -o $@ $<
361 ################################################################################
362 # Note on generic rules and dependancies
363 ################################################################################
365 # Note on dependancies: each .c file is associated with a .d file, which
366 # depends of it. The .o file associated with a .c file depends of the .d, of the
367 # .c itself, and of Makefile. The .d files are stored in a separate dep/
369 # The dep directory should be ignored by CVS.
371 # Note on inclusions: depending of the target, the dependancies files must
372 # or must not be included. The problem is that if we ask make to include a file,
373 # and this file does not exist, it is made before it can be included. In a
374 # general way, a .d file should be included if and only if the corresponding .o
375 # needs to be re-made.
377 # Two makefiles are used: the main one (this one) has regular generic rules,
378 # except for .o files, for which it calls the object Makefile. Dependancies
379 # are not included in this file.
380 # The object Makefile known how to make a .o from a .c, and includes
381 # dependancies for the target, but only those required.