]> git.sesse.net Git - vlc/blob - Makefile
La plupart des causes de segfault de la video ont �t� �limin�es, les messages
[vlc] / Makefile
1 ################################################################################
2 # vlc (VideoLAN Client) main makefile
3 # (c)1998 VideoLAN
4 ################################################################################
5 # This makefile is the main makefile for the VideoLAN client.
6 ################################################################################
7
8 ################################################################################
9 # Configuration
10 ################################################################################
11
12 # Environment
13 CC=egcc
14 SHELL=/bin/sh
15
16 # Audio output settings
17 AUDIO = dsp
18 # Not yet supported
19 #AUDIO += esd
20 # Fallback method that should always work
21 AUDIO += dummy
22
23 # Video output settings
24 VIDEO = x11
25 VIDEO += fb
26 #VIDEO += ggi
27 #VIDEO += glide
28 # Not yet supported
29 #VIDEO += beos
30 #VIDEO += dga
31 # Fallback method that should always work
32 VIDEO += dummy
33
34 # Target architecture
35 ARCH=X86
36 #ARCH=PPC
37 #ARCH=SPARC
38
39 # Target operating system
40 SYS=LINUX
41 #SYS=BSD
42 #SYS=BEOS
43
44 # For x86 architecture, choose MMX support
45 MMX=YES
46 #MMX=NO
47
48 # Decoder choice - ?? old decoder will be removed soon
49 #DECODER=old
50 DECODER=new
51
52 # Debugging mode on or off (set to 1 to activate)
53 DEBUG=1
54
55 #----------------- do not change anything below this line ----------------------
56
57 ################################################################################
58 # Configuration pre-processing
59 ################################################################################
60
61 # Program version - may only be changed by the project leader
62 PROGRAM_VERSION = 0.95.0
63
64 # audio options
65 audio := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
66 AUDIO := $(shell echo $(AUDIO) | tr 'a-z' 'A-Z')
67 DEFINE += $(AUDIO:%=-DAUDIO_%)
68
69 # video options
70 video := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
71 VIDEO := $(shell echo $(VIDEO) | tr 'a-z' 'A-Z')
72 DEFINE += $(VIDEO:%=-DVIDEO_%)
73
74 # PROGRAM_OPTIONS is an identification string of the compilation options
75 PROGRAM_OPTIONS = $(ARCH) $(SYS)
76 ifeq ($(DEBUG),1)
77 PROGRAM_OPTIONS += DEBUG
78 endif
79
80 # PROGRAM_BUILD is a complete identification of the build
81 PROGRAM_BUILD = `date -R` $(USER)@`hostname`
82
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)\""
92 ifeq ($(DEBUG),1)
93 DEFINE += -DDEBUG
94 endif
95
96 ################################################################################
97 # Tuning and other variables - do not change anything except if you know
98 # exactly what you are doing
99 ################################################################################
100
101 #
102 # C headers directories
103 #
104 INCLUDE += -Iinclude
105
106 ifneq (,$(findstring x11,$(video)))
107 INCLUDE += -I/usr/X11R6/include
108 endif
109
110 ifneq (,$(findstring glide,$(video)))
111 INCLUDE += -I/usr/include/glide
112 endif
113
114 #
115 # Libraries
116 #
117 LIB += -lpthread
118 LIB += -lm
119
120 ifneq (,$(findstring x11,$(video)))
121 LIB += -L/usr/X11R6/lib
122 LIB += -lX11
123 LIB += -lXext 
124 endif
125 ifneq (,$(findstring ggi,$(video)))
126 LIB += -lggi
127 endif
128 ifneq (,$(findstring glide,$(video)))
129 LIB += -lglide2x
130 endif
131
132 #
133 # C compiler flags: compilation
134 #
135 CCFLAGS += $(DEFINE) $(INCLUDE)
136 CCFLAGS += -Wall
137 CCFLAGS += -D_REENTRANT
138 CCFLAGS += -D_GNU_SOURCE
139
140 # Optimizations : don't compile debug versions with them
141 CCFLAGS += -O6
142 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
143 #CCFLAGS += -fomit-frame-pointer
144
145 # Optimizations for x86 familiy
146 ifeq ($(ARCH),X86)
147 CCFLAGS += -malign-double
148 CCFLAGS += -march=pentiumpro
149 #CCFLAGS += -march=pentium
150 endif
151
152 # Optimizations for PowerPC
153 ifeq ($(ARCH),PPC)
154 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
155 endif
156
157 # Optimizations for Sparc
158 ifeq ($(ARCH),SPARC)
159 CCFLAGS += -mhard-float
160 endif
161
162 #
163 # C compiler flags: dependancies
164 #
165 DCFLAGS += $(INCLUDE)
166 DCFLAGS += -MM
167
168 #
169 # C compiler flags: linking
170 #
171 LCFLAGS += $(LIB)
172 LCFLAGS += -Wall
173 #LCFLAGS += -s
174
175 #
176 # C compiler flags: common flags
177 #
178
179 # Eventual MMX optimizations for x86
180 ifeq ($(ARCH),X86)
181 ifeq ($(MMX), YES) # MMX is YES or AUTO
182 CFLAGS += -DHAVE_MMX
183 endif
184 endif
185
186 #
187 # Additionnal debugging flags
188 #
189
190 # Debugging support
191 ifeq ($(DEBUG),1)
192 CFLAGS += -g
193 #CFLAGS += -pg
194 endif
195
196 #################################################################################
197 # Objects and files
198 #################################################################################
199
200 #
201 # C Objects
202
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)
211
212 input_obj =                     input/input_vlan.o \
213                                                 input/input_file.o \
214                                                 input/input_netlist.o \
215                                                 input/input_network.o \
216                                                 input/input_ctrl.o \
217                                                 input/input_pcr.o \
218                                                 input/input_psi.o \
219                                                 input/input.o
220
221 audio_output_obj =              audio_output/audio_output.o \
222                                                 $(audio:%=audio_output/aout_%.o)
223
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)
228
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
237
238 audio_decoder_obj =             audio_decoder/audio_decoder.o \
239                                                 audio_decoder/audio_math.o
240
241 spu_decoder_obj =               spu_decoder/spu_decoder.o
242
243 #??generic_decoder_obj =                generic_decoder/generic_decoder.o
244 # remeber to add it to OBJ 
245
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
259 else
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
265
266 video_decoder_obj =             video_decoder/video_decoder.o \
267                                                 video_decoder/vdec_motion.o \
268                                                 video_decoder/vdec_idct.o
269 endif
270
271 misc_obj =                      misc/mtime.o \
272                                                 misc/rsc_files.o \
273                                                 misc/netutils.o \
274                                                 misc/decoder_fifo.o
275
276 C_OBJ = $(interface_obj) \
277                 $(input_obj) \
278                 $(audio_output_obj) \
279                 $(video_output_obj) \
280                 $(ac3_decoder_obj) \
281                 $(audio_decoder_obj) \
282                 $(spu_decoder_obj) \
283                 $(generic_decoder_obj) \
284                 $(video_parser_obj) \
285                 $(video_decoder_obj) \
286                 $(vlan_obj) \
287                 $(misc_obj)
288
289 #
290 # Assembler Objects
291
292 ifeq ($(ARCH),X86)
293 ifeq ($(MMX), YES)
294 ifeq ($(DECODER),new)
295 ASM_OBJ =                       video_decoder/vdec_idctmmx.o \
296                                                 video_output/video_yuv_mmx.o
297 else
298 ASM_OBJ =                       video_decoder_ref/vdec_idctmmx.o \
299                                                 video_output/video_yuv_mmx.o
300 endif
301 endif
302 endif
303
304 #
305 # Other lists of files
306 #
307 sources := $(C_OBJ:%.o=%.c)
308 dependancies := $(sources:%.c=dep/%.d)
309
310 # All symbols must be exported
311 export
312
313 ################################################################################
314 # Targets
315 ################################################################################
316
317 #
318 # Virtual targets
319 #
320 all: vlc
321
322 clean:
323         rm -f $(C_OBJ) $(ASM_OBJ)
324
325 distclean: clean
326         rm -f **/*.o **/*~ *.log
327         rm -f vlc gmon.out core
328         rm -rf dep
329
330 show:
331         @echo "Command line for C objects:"
332         @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
333         @echo
334         @echo "Command line for assembler objects:"
335         @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
336
337 FORCE:
338
339 #
340 # Real targets
341 #
342 vlc: $(C_OBJ) $(ASM_OBJ)
343         $(CC) $(LCFLAGS) $(CFLAGS) -o $@ $(C_OBJ) $(ASM_OBJ)    
344
345 #
346 # Generic rules (see below)
347 #
348 $(dependancies): %.d: FORCE
349         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
350
351 $(C_OBJ): %.o: Makefile.dep
352 $(C_OBJ): %.o: dep/%.d
353 $(C_OBJ): %.o: %.c
354         @echo "compiling $*.c"
355         @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
356
357 $(ASM_OBJ): %.o: Makefile.dep
358 $(ASM_OBJ): %.o: %.S
359         @echo "assembling $*.S"
360         @$(CC) $(CFLAGS) -c -o $@ $<
361
362 ################################################################################
363 # Note on generic rules and dependancies
364 ################################################################################
365
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/ 
369 # directory.
370 # The dep directory should be ignored by CVS.
371
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.
377
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.