]> git.sesse.net Git - vlc/blob - Makefile
. ajout de l'audio output pour Esound
[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=0
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 -lX11 -lXext 
122 endif
123 ifneq (,$(findstring ggi,$(video)))
124 LIB += -lggi
125 endif
126 ifneq (,$(findstring glide,$(video)))
127 LIB += -lglide2x
128 endif
129
130 ifneq (,$(findstring esd,$(audio)))
131 LIB += -lesd -laudiofile
132 endif
133
134 #
135 # C compiler flags: compilation
136 #
137 CCFLAGS += $(DEFINE) $(INCLUDE)
138 CCFLAGS += -Wall
139 CCFLAGS += -D_REENTRANT
140 CCFLAGS += -D_GNU_SOURCE
141
142 # Optimizations : don't compile debug versions with them
143 CCFLAGS += -O6
144 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
145 CCFLAGS += -fomit-frame-pointer
146
147 # Optimizations for x86 familiy
148 ifeq ($(ARCH),X86)
149 CCFLAGS += -malign-double
150 CCFLAGS += -march=pentiumpro
151 #CCFLAGS += -march=pentium
152 endif
153
154 # Optimizations for PowerPC
155 ifeq ($(ARCH),PPC)
156 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
157 endif
158
159 # Optimizations for Sparc
160 ifeq ($(ARCH),SPARC)
161 CCFLAGS += -mhard-float
162 endif
163
164 #
165 # C compiler flags: dependancies
166 #
167 DCFLAGS += $(INCLUDE)
168 DCFLAGS += -MM
169
170 #
171 # C compiler flags: linking
172 #
173 LCFLAGS += $(LIB)
174 LCFLAGS += -Wall
175 #LCFLAGS += -s
176
177 #
178 # C compiler flags: common flags
179 #
180
181 # Eventual MMX optimizations for x86
182 ifeq ($(ARCH),X86)
183 ifeq ($(MMX), YES)
184 CFLAGS += -DHAVE_MMX
185 endif
186 endif
187
188 #
189 # Additionnal debugging flags
190 #
191
192 # Debugging support
193 ifeq ($(DEBUG),1)
194 CFLAGS += -g
195 #CFLAGS += -pg
196 endif
197
198 #################################################################################
199 # Objects and files
200 #################################################################################
201
202 #
203 # C Objects
204
205 interface_obj =                 interface/main.o \
206                                                 interface/interface.o \
207                                                 interface/intf_msg.o \
208                                                 interface/intf_cmd.o \
209                                                 interface/intf_ctrl.o \
210                                                 interface/intf_console.o \
211                                                 $(video:%=interface/intf_%.o)
212
213 input_obj =                     input/input_vlan.o \
214                                                 input/input_file.o \
215                                                 input/input_netlist.o \
216                                                 input/input_network.o \
217                                                 input/input_ctrl.o \
218                                                 input/input_pcr.o \
219                                                 input/input_psi.o \
220                                                 input/input.o
221
222 audio_output_obj =              audio_output/audio_output.o \
223                                                 $(audio:%=audio_output/aout_%.o)
224
225 video_output_obj =              video_output/video_output.o \
226                                                 video_output/video_text.o \
227                                                 video_output/video_yuv.o \
228                                                 $(video:%=video_output/vout_%.o)
229
230 ac3_decoder_obj =               ac3_decoder/ac3_decoder.o \
231                                                 ac3_decoder/ac3_parse.o \
232                                                 ac3_decoder/ac3_exponent.o \
233                                                 ac3_decoder/ac3_bit_allocate.o \
234                                                 ac3_decoder/ac3_mantissa.o \
235                                                 ac3_decoder/ac3_rematrix.o \
236                                                 ac3_decoder/ac3_imdct.o \
237                                                 ac3_decoder/ac3_downmix.o
238
239 audio_decoder_obj =             audio_decoder/audio_decoder.o \
240                                                 audio_decoder/audio_math.o
241
242 spu_decoder_obj =               spu_decoder/spu_decoder.o
243
244 #??generic_decoder_obj =                generic_decoder/generic_decoder.o
245 # remeber to add it to OBJ 
246
247 ifeq ($(DECODER),old)
248 CFLAGS += -DOLD_DECODER
249 video_decoder_obj =             video_decoder_ref/video_decoder.o \
250                                                 video_decoder_ref/display.o \
251                                                 video_decoder_ref/getblk.o \
252                                                 video_decoder_ref/gethdr.o \
253                                                 video_decoder_ref/getpic.o \
254                                                 video_decoder_ref/getvlc.o \
255                                                 video_decoder_ref/idct.o \
256                                                 video_decoder_ref/motion.o \
257                                                 video_decoder_ref/mpeg2dec.o \
258                                                 video_decoder_ref/recon.o \
259                                                 video_decoder_ref/spatscal.o
260 else
261 video_parser_obj =              video_parser/video_parser.o \
262                                                 video_parser/vpar_headers.o \
263                                                 video_parser/vpar_blocks.o \
264                                                 video_parser/vpar_synchro.o \
265                                                 video_parser/video_fifo.o
266
267 video_decoder_obj =             video_decoder/video_decoder.o \
268                                                 video_decoder/vdec_motion.o \
269                                                 video_decoder/vdec_idct.o
270 endif
271
272 misc_obj =                      misc/mtime.o \
273                                                 misc/rsc_files.o \
274                                                 misc/netutils.o \
275                                                 misc/decoder_fifo.o
276
277 C_OBJ = $(interface_obj) \
278                 $(input_obj) \
279                 $(audio_output_obj) \
280                 $(video_output_obj) \
281                 $(ac3_decoder_obj) \
282                 $(audio_decoder_obj) \
283                 $(spu_decoder_obj) \
284                 $(generic_decoder_obj) \
285                 $(video_parser_obj) \
286                 $(video_decoder_obj) \
287                 $(vlan_obj) \
288                 $(misc_obj)
289
290 #
291 # Assembler Objects
292
293 ifeq ($(ARCH),X86)
294 ifeq ($(MMX), YES)
295 ifeq ($(DECODER),new)
296 ASM_OBJ =                       video_decoder/vdec_idctmmx.o \
297                                                 video_output/video_yuv_mmx.o
298 else
299 ASM_OBJ =                       video_decoder_ref/vdec_idctmmx.o \
300                                                 video_output/video_yuv_mmx.o
301 endif
302 endif
303 endif
304
305 #
306 # Other lists of files
307 #
308 sources := $(C_OBJ:%.o=%.c)
309 dependancies := $(sources:%.c=dep/%.d)
310
311 # All symbols must be exported
312 export
313
314 ################################################################################
315 # Targets
316 ################################################################################
317
318 #
319 # Virtual targets
320 #
321 all: vlc
322
323 clean:
324         rm -f $(C_OBJ) $(ASM_OBJ)
325
326 distclean: clean
327         rm -f **/*.o **/*~ *.log
328         rm -f vlc gmon.out core
329         rm -rf dep
330
331 show:
332         @echo "Command line for C objects:"
333         @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
334         @echo
335         @echo "Command line for assembler objects:"
336         @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
337
338 FORCE:
339
340 #
341 # Real targets
342 #
343 vlc: $(C_OBJ) $(ASM_OBJ)
344         $(CC) $(LCFLAGS) $(CFLAGS) -o $@ $(C_OBJ) $(ASM_OBJ)    
345
346 #
347 # Generic rules (see below)
348 #
349 $(dependancies): %.d: FORCE
350         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
351
352 $(C_OBJ): %.o: Makefile.dep
353 $(C_OBJ): %.o: dep/%.d
354 $(C_OBJ): %.o: %.c
355         @echo "compiling $*.c"
356         @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
357
358 $(ASM_OBJ): %.o: Makefile.dep
359 $(ASM_OBJ): %.o: %.S
360         @echo "assembling $*.S"
361         @$(CC) $(CFLAGS) -c -o $@ $<
362
363 ################################################################################
364 # Note on generic rules and dependancies
365 ################################################################################
366
367 # Note on dependancies: each .c file is associated with a .d file, which
368 # depends of it. The .o file associated with a .c file depends of the .d, of the 
369 # .c itself, and of Makefile. The .d files are stored in a separate dep/ 
370 # directory.
371 # The dep directory should be ignored by CVS.
372
373 # Note on inclusions: depending of the target, the dependancies files must 
374 # or must not be included. The problem is that if we ask make to include a file,
375 # and this file does not exist, it is made before it can be included. In a 
376 # general way, a .d file should be included if and only if the corresponding .o 
377 # needs to be re-made.
378
379 # Two makefiles are used: the main one (this one) has regular generic rules,
380 # except for .o files, for which it calls the object Makefile. Dependancies
381 # are not included in this file.
382 # The object Makefile known how to make a .o from a .c, and includes
383 # dependancies for the target, but only those required.