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
18 #VIDEO=DGA (not yet supported)
21 #VIDEO=BEOS (not yet supported)
23 # Target architecture and optimization
29 # Target operating system
34 # Decoder choice - ?? old decoder will be removed soon
38 # Debugging mode on or off
41 #----------------- do not change anything below this line ----------------------
43 ################################################################################
44 # Configuration pre-processing
45 ################################################################################
47 # Program version - may only be changed by the project leader
48 PROGRAM_VERSION = 1.0-dev
50 # PROGRAM_OPTIONS is an identification string of the compilation options
51 PROGRAM_OPTIONS = $(VIDEO) $(ARCH) $(SYS)
53 PROGRAM_OPTIONS += DEBUG
56 # PROGRAM_BUILD is a complete identification of the build
57 PROGRAM_BUILD = `date -R` $(USER)@`hostname`
59 # DEFINE will contain some of the constants definitions decided in Makefile,
60 # including VIDEO_xx and ARCH_xx. It will be passed to C compiler.
61 DEFINE += -DVIDEO_$(VIDEO)
62 DEFINE += -DARCH_$(ARCH)
63 DEFINE += -DSYS_$(SYS)
64 DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
65 DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
66 DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
71 # video is a lowercase version of VIDEO used for filenames
72 video = $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
74 ################################################################################
75 # Tunning and other variables - do not change anything except if you know
76 # exactly what you are doing
77 ################################################################################
80 # C headers directories
85 INCLUDE += -I/usr/X11R6/include
95 LIB += -L/usr/X11R6/lib
104 # C compiler flags: compilation
106 CCFLAGS += $(DEFINE) $(INCLUDE)
108 CCFLAGS += -D_REENTRANT
109 CCFLAGS += -D_GNU_SOURCE
111 # Optimizations : don't compile debug versions with them
113 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
114 CCFLAGS += -fomit-frame-pointer
116 # Optimizations for x86 familiy, without MMX
118 CCFLAGS += -malign-double
119 CCFLAGS += -march=pentiumpro
120 #CCFLAGS += -march=pentium
123 # Optimization for x86 with MMX support
125 CCFLAGS += -malign-double
126 CCFLAGS += -march=pentiumpro
129 # Optimizations for PowerPC
131 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
134 # Optimizations for Sparc
136 CCFLAGS += -mhard-float
140 # C compiler flags: dependancies
142 DCFLAGS += $(INCLUDE)
146 # C compiler flags: linking
153 # C compiler flags: common flags
156 # Optimizations for x86 with MMX support
162 # Additionnal debugging flags
171 #################################################################################
173 #################################################################################
178 interface_obj = interface/main.o \
179 interface/interface.o \
180 interface/intf_msg.o \
181 interface/intf_cmd.o \
182 interface/intf_ctrl.o \
183 interface/control.o \
184 interface/intf_console.o \
185 interface/intf_$(video).o
187 input_obj = input/input_vlan.o \
189 input/input_netlist.o \
190 input/input_network.o \
196 audio_output_obj = audio_output/audio_output.o \
197 audio_output/audio_dsp.o
199 video_output_obj = video_output/video_output.o \
200 video_output/video_$(video).o \
201 video_output/video_yuv.o
203 ac3_decoder_obj = ac3_decoder/ac3_decoder.o \
204 ac3_decoder/ac3_parse.o \
205 ac3_decoder/ac3_exponent.o \
206 ac3_decoder/ac3_bit_allocate.o \
207 ac3_decoder/ac3_mantissa.o \
208 ac3_decoder/ac3_rematrix.o \
209 ac3_decoder/ac3_imdct.o \
210 ac3_decoder/ac3_downmix.o
212 audio_decoder_obj = audio_decoder/audio_decoder.o \
213 audio_decoder/audio_math.o
215 subtitle_decoder_obj = subtitle_decoder/subtitle_decoder.o
217 #??generic_decoder_obj = generic_decoder/generic_decoder.o
218 # remeber to add it to OBJ
220 ifeq ($(DECODER),old)
221 CFLAGS += -DOLD_DECODER
222 video_decoder_obj = video_decoder_ref/video_decoder.o \
223 video_decoder_ref/display.o \
224 video_decoder_ref/getblk.o \
225 video_decoder_ref/gethdr.o \
226 video_decoder_ref/getpic.o \
227 video_decoder_ref/getvlc.o \
228 video_decoder_ref/idct.o \
229 video_decoder_ref/motion.o \
230 video_decoder_ref/mpeg2dec.o \
231 video_decoder_ref/recon.o \
232 video_decoder_ref/spatscal.o
234 video_parser_obj = video_parser/video_parser.o \
235 video_parser/vpar_headers.o \
236 video_parser/vpar_blocks.o \
237 video_parser/vpar_motion.o \
238 video_parser/vpar_synchro.o \
239 video_parser/video_fifo.o
241 video_decoder_obj = video_decoder/video_decoder.o \
242 video_decoder/vdec_motion.o \
243 video_decoder/vdec_idct.o
246 misc_obj = misc/mtime.o \
250 C_OBJ = $(interface_obj) \
252 $(audio_output_obj) \
253 $(video_output_obj) \
255 $(audio_decoder_obj) \
256 $(subtitle_decoder_obj) \
257 $(generic_decoder_obj) \
258 $(video_parser_obj) \
259 $(video_decoder_obj) \
267 ifeq ($(DECODER),old)
268 ASM_OBJ = video_decoder_ref/idctmmx.o \
269 video_output/video_yuv_mmx.o
271 ASM_OBJ = video_decoder/idctmmx.o \
272 video_output/video_yuv_mmx.o
277 # Other lists of files
279 sources := $(C_OBJ:%.o=%.c)
280 dependancies := $(sources:%.c=dep/%.d)
282 # All symbols must be exported
285 ################################################################################
287 ################################################################################
295 rm -f $(C_OBJ) $(ASM_OBJ)
298 rm -f **/*.o **/*~ *.log
299 rm -f vlc gmon.out core
303 @echo "Command line for C objects:"
304 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
306 @echo "Command line for assembler objects:"
307 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
314 vlc: $(C_OBJ) $(ASM_OBJ)
315 $(CC) $(LCFLAGS) $(CFLAGS) -o $@ $(C_OBJ) $(ASM_OBJ)
318 # Generic rules (see below)
320 $(dependancies): %.d: FORCE
321 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
323 $(C_OBJ): %.o: Makefile Makefile.dep
324 $(C_OBJ): %.o: dep/%.d
326 @echo "compiling $*.c"
327 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
329 $(ASM_OBJ): %.o: Makefile Makefile.dep
331 @echo "assembling $*.S"
332 @$(CC) $(CFLAGS) -c -o $@ $<
334 ################################################################################
335 # Note on generic rules and dependancies
336 ################################################################################
338 # Note on dependancies: each .c file is associated with a .d file, which
339 # depends of it. The .o file associated with a .c file depends of the .d, of the
340 # .c itself, and of Makefile. The .d files are stored in a separate dep/
342 # The dep directory should be ignored by CVS.
344 # Note on inclusions: depending of the target, the dependancies files must
345 # or must not be included. The problem is that if we ask make to include a file,
346 # and this file does not exist, it is made before it can be included. In a
347 # general way, a .d file should be included if and only if the corresponding .o
348 # needs to be re-made.
350 # Two makefiles are used: the main one (this one) has regular generic rules,
351 # except for .o files, for which it calls the object Makefile. Dependancies
352 # are not included in this file.
353 # The object Makefile known how to make a .o from a .c, and includes
354 # dependancies for the target, but only those required.