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
181 ifeq ($(MMX), YES) # MMX is YES or AUTO
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/control.o \
209 interface/intf_console.o \
210 $(video:%=interface/intf_%.o)
212 input_obj = input/input_vlan.o \
214 input/input_netlist.o \
215 input/input_network.o \
221 audio_output_obj = audio_output/audio_output.o \
222 $(audio:%=audio_output/aout_%.o)
224 video_output_obj = video_output/video_output.o \
225 video_output/video_text.o \
226 video_output/video_yuv.o \
227 $(video:%=video_output/vout_%.o)
229 ac3_decoder_obj = ac3_decoder/ac3_decoder.o \
230 ac3_decoder/ac3_parse.o \
231 ac3_decoder/ac3_exponent.o \
232 ac3_decoder/ac3_bit_allocate.o \
233 ac3_decoder/ac3_mantissa.o \
234 ac3_decoder/ac3_rematrix.o \
235 ac3_decoder/ac3_imdct.o \
236 ac3_decoder/ac3_downmix.o
238 audio_decoder_obj = audio_decoder/audio_decoder.o \
239 audio_decoder/audio_math.o
241 spu_decoder_obj = spu_decoder/spu_decoder.o
243 #??generic_decoder_obj = generic_decoder/generic_decoder.o
244 # remeber to add it to OBJ
246 ifeq ($(DECODER),old)
247 CFLAGS += -DOLD_DECODER
248 video_decoder_obj = video_decoder_ref/video_decoder.o \
249 video_decoder_ref/display.o \
250 video_decoder_ref/getblk.o \
251 video_decoder_ref/gethdr.o \
252 video_decoder_ref/getpic.o \
253 video_decoder_ref/getvlc.o \
254 video_decoder_ref/idct.o \
255 video_decoder_ref/motion.o \
256 video_decoder_ref/mpeg2dec.o \
257 video_decoder_ref/recon.o \
258 video_decoder_ref/spatscal.o
260 video_parser_obj = video_parser/video_parser.o \
261 video_parser/vpar_headers.o \
262 video_parser/vpar_blocks.o \
263 video_parser/vpar_synchro.o \
264 video_parser/video_fifo.o
266 video_decoder_obj = video_decoder/video_decoder.o \
267 video_decoder/vdec_motion.o \
268 video_decoder/vdec_idct.o
271 misc_obj = misc/mtime.o \
276 C_OBJ = $(interface_obj) \
278 $(audio_output_obj) \
279 $(video_output_obj) \
281 $(audio_decoder_obj) \
283 $(generic_decoder_obj) \
284 $(video_parser_obj) \
285 $(video_decoder_obj) \
294 ifeq ($(DECODER),new)
295 ASM_OBJ = video_decoder/vdec_idctmmx.o \
296 video_output/video_yuv_mmx.o
298 ASM_OBJ = video_decoder_ref/vdec_idctmmx.o \
299 video_output/video_yuv_mmx.o
305 # Other lists of files
307 sources := $(C_OBJ:%.o=%.c)
308 dependancies := $(sources:%.c=dep/%.d)
310 # All symbols must be exported
313 ################################################################################
315 ################################################################################
323 rm -f $(C_OBJ) $(ASM_OBJ)
326 rm -f **/*.o **/*~ *.log
327 rm -f vlc gmon.out core
331 @echo "Command line for C objects:"
332 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
334 @echo "Command line for assembler objects:"
335 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
342 vlc: $(C_OBJ) $(ASM_OBJ)
343 $(CC) $(LCFLAGS) $(CFLAGS) -o $@ $(C_OBJ) $(ASM_OBJ)
346 # Generic rules (see below)
348 $(dependancies): %.d: FORCE
349 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
351 $(C_OBJ): %.o: Makefile.dep
352 $(C_OBJ): %.o: dep/%.d
354 @echo "compiling $*.c"
355 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
357 $(ASM_OBJ): %.o: Makefile.dep
359 @echo "assembling $*.S"
360 @$(CC) $(CFLAGS) -c -o $@ $<
362 ################################################################################
363 # Note on generic rules and dependancies
364 ################################################################################
366 # Note on dependancies: each .c file is associated with a .d file, which
367 # depends of it. The .o file associated with a .c file depends of the .d, of the
368 # .c itself, and of Makefile. The .d files are stored in a separate dep/
370 # The dep directory should be ignored by CVS.
372 # Note on inclusions: depending of the target, the dependancies files must
373 # or must not be included. The problem is that if we ask make to include a file,
374 # and this file does not exist, it is made before it can be included. In a
375 # general way, a .d file should be included if and only if the corresponding .o
376 # needs to be re-made.
378 # Two makefiles are used: the main one (this one) has regular generic rules,
379 # except for .o files, for which it calls the object Makefile. Dependancies
380 # are not included in this file.
381 # The object Makefile known how to make a .o from a .c, and includes
382 # dependancies for the target, but only those required.