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
29 # Target architecture and optimization
35 # Target operating system
40 # Decoder choice - ?? old decoder will be removed soon
44 # Debugging mode on or off (set to 1 to activate)
47 #----------------- do not change anything below this line ----------------------
49 ################################################################################
50 # Configuration pre-processing
51 ################################################################################
53 # Program version - may only be changed by the project leader
54 PROGRAM_VERSION = 1.0-dev
56 # PROGRAM_OPTIONS is an identification string of the compilation options
57 PROGRAM_OPTIONS = $(VIDEO) $(ARCH) $(SYS)
59 PROGRAM_OPTIONS += DEBUG
62 # PROGRAM_BUILD is a complete identification of the build
63 PROGRAM_BUILD = `date -R` $(USER)@`hostname`
65 # DEFINE will contain some of the constants definitions decided in Makefile,
66 # including VIDEO_xx and ARCH_xx. It will be passed to C compiler.
67 DEFINE += -DVIDEO_$(VIDEO)
68 DEFINE += -DARCH_$(ARCH)
69 DEFINE += -DSYS_$(SYS)
70 DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
71 DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
72 DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
77 # video is a lowercase version of VIDEO used for filenames
78 video = $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
80 ################################################################################
81 # Tunning and other variables - do not change anything except if you know
82 # exactly what you are doing
83 ################################################################################
86 # C headers directories
91 INCLUDE += -I/usr/X11R6/include
95 INCLUDE += -I/usr/include/glide
105 LIB += -L/usr/X11R6/lib
117 # C compiler flags: compilation
119 CCFLAGS += $(DEFINE) $(INCLUDE)
121 CCFLAGS += -D_REENTRANT
122 CCFLAGS += -D_GNU_SOURCE
124 # Optimizations : don't compile debug versions with them
126 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
127 CCFLAGS += -fomit-frame-pointer
129 # Optimizations for x86 familiy, without MMX
131 CCFLAGS += -malign-double
132 CCFLAGS += -march=pentiumpro
133 #CCFLAGS += -march=pentium
136 # Optimization for x86 with MMX support
138 CCFLAGS += -malign-double
139 CCFLAGS += -march=pentiumpro
142 # Optimizations for PowerPC
144 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
147 # Optimizations for Sparc
149 CCFLAGS += -mhard-float
153 # C compiler flags: dependancies
155 DCFLAGS += $(INCLUDE)
159 # C compiler flags: linking
166 # C compiler flags: common flags
169 # Optimizations for x86 with MMX support
175 # Additionnal debugging flags
184 #################################################################################
186 #################################################################################
191 interface_obj = interface/main.o \
192 interface/interface.o \
193 interface/intf_msg.o \
194 interface/intf_cmd.o \
195 interface/intf_ctrl.o \
196 interface/control.o \
197 interface/intf_console.o \
198 interface/intf_$(video).o
200 input_obj = input/input_vlan.o \
202 input/input_netlist.o \
203 input/input_network.o \
209 audio_output_obj = audio_output/audio_output.o \
210 audio_output/audio_dsp.o
212 video_output_obj = video_output/video_output.o \
213 video_output/video_$(video).o \
214 video_output/video_text.o \
215 video_output/video_yuv.o
217 ac3_decoder_obj = ac3_decoder/ac3_decoder.o \
218 ac3_decoder/ac3_parse.o \
219 ac3_decoder/ac3_exponent.o \
220 ac3_decoder/ac3_bit_allocate.o \
221 ac3_decoder/ac3_mantissa.o \
222 ac3_decoder/ac3_rematrix.o \
223 ac3_decoder/ac3_imdct.o \
224 ac3_decoder/ac3_downmix.o
226 audio_decoder_obj = audio_decoder/audio_decoder.o \
227 audio_decoder/audio_math.o
229 spu_decoder_obj = spu_decoder/spu_decoder.o
231 #??generic_decoder_obj = generic_decoder/generic_decoder.o
232 # remeber to add it to OBJ
234 ifeq ($(DECODER),old)
235 CFLAGS += -DOLD_DECODER
236 video_decoder_obj = video_decoder_ref/video_decoder.o \
237 video_decoder_ref/display.o \
238 video_decoder_ref/getblk.o \
239 video_decoder_ref/gethdr.o \
240 video_decoder_ref/getpic.o \
241 video_decoder_ref/getvlc.o \
242 video_decoder_ref/idct.o \
243 video_decoder_ref/motion.o \
244 video_decoder_ref/mpeg2dec.o \
245 video_decoder_ref/recon.o \
246 video_decoder_ref/spatscal.o
248 video_parser_obj = video_parser/video_parser.o \
249 video_parser/vpar_headers.o \
250 video_parser/vpar_blocks.o \
251 video_parser/vpar_synchro.o \
252 video_parser/video_fifo.o
254 video_decoder_obj = video_decoder/video_decoder.o \
255 video_decoder/vdec_motion.o \
256 video_decoder/vdec_idct.o
259 misc_obj = misc/mtime.o \
263 C_OBJ = $(interface_obj) \
265 $(audio_output_obj) \
266 $(video_output_obj) \
268 $(audio_decoder_obj) \
270 $(generic_decoder_obj) \
271 $(video_parser_obj) \
272 $(video_decoder_obj) \
280 ifeq ($(DECODER),old)
281 ASM_OBJ = video_decoder_ref/idctmmx.o \
282 video_output/video_yuv_mmx.o
284 ASM_OBJ = video_decoder/idctmmx.o \
285 video_output/video_yuv_mmx.o
290 # Other lists of files
292 sources := $(C_OBJ:%.o=%.c)
293 dependancies := $(sources:%.c=dep/%.d)
295 # All symbols must be exported
298 ################################################################################
300 ################################################################################
308 rm -f $(C_OBJ) $(ASM_OBJ)
311 rm -f **/*.o **/*~ *.log
312 rm -f vlc gmon.out core
316 @echo "Command line for C objects:"
317 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
319 @echo "Command line for assembler objects:"
320 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
327 vlc: $(C_OBJ) $(ASM_OBJ)
328 $(CC) $(LCFLAGS) $(CFLAGS) -o $@ $(C_OBJ) $(ASM_OBJ)
331 # Generic rules (see below)
333 $(dependancies): %.d: FORCE
334 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
336 $(C_OBJ): %.o: Makefile Makefile.dep
337 $(C_OBJ): %.o: dep/%.d
339 @echo "compiling $*.c"
340 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
342 $(ASM_OBJ): %.o: Makefile Makefile.dep
344 @echo "assembling $*.S"
345 @$(CC) $(CFLAGS) -c -o $@ $<
347 ################################################################################
348 # Note on generic rules and dependancies
349 ################################################################################
351 # Note on dependancies: each .c file is associated with a .d file, which
352 # depends of it. The .o file associated with a .c file depends of the .d, of the
353 # .c itself, and of Makefile. The .d files are stored in a separate dep/
355 # The dep directory should be ignored by CVS.
357 # Note on inclusions: depending of the target, the dependancies files must
358 # or must not be included. The problem is that if we ask make to include a file,
359 # and this file does not exist, it is made before it can be included. In a
360 # general way, a .d file should be included if and only if the corresponding .o
361 # needs to be re-made.
363 # Two makefiles are used: the main one (this one) has regular generic rules,
364 # except for .o files, for which it calls the object Makefile. Dependancies
365 # are not included in this file.
366 # The object Makefile known how to make a .o from a .c, and includes
367 # dependancies for the target, but only those required.