]> git.sesse.net Git - vlc/blob - Makefile
o remise de b_stereo dans les structures audio en attendant que soit
[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=gcc
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 fb
25 #VIDEO += ggi
26 #VIDEO += glide
27 # Not yet supported
28 #VIDEO += beos
29 #VIDEO += dga
30 # Fallback method that should always work
31 VIDEO += dummy
32
33 # Target architecture
34 ARCH=X86
35 #ARCH=PPC
36 #ARCH=SPARC
37
38 # Target operating system
39 SYS=LINUX
40 #SYS=BSD
41 #SYS=BEOS
42
43 # For x86 architecture, choose MMX support
44 MMX=YES
45 #MMX=NO
46
47 # Decoder choice - ?? old decoder will be removed soon
48 #DECODER=old
49 DECODER=new
50
51 # Debugging mode on or off (set to 1 to activate)
52 DEBUG=0
53
54 #----------------- do not change anything below this line ----------------------
55
56 ################################################################################
57 # Configuration pre-processing
58 ################################################################################
59
60 # Program version - may only be changed by the project leader
61 PROGRAM_VERSION = 0.95.0
62
63 # audio options
64 audio := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
65 AUDIO := $(shell echo $(AUDIO) | tr 'a-z' 'A-Z')
66 DEFINE += $(AUDIO:%=-DAUDIO_%)
67
68 # video options
69 video := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
70 VIDEO := $(shell echo $(VIDEO) | tr 'a-z' 'A-Z')
71 DEFINE += $(VIDEO:%=-DVIDEO_%)
72
73 # PROGRAM_OPTIONS is an identification string of the compilation options
74 PROGRAM_OPTIONS = $(ARCH) $(SYS)
75 ifeq ($(DEBUG),1)
76 PROGRAM_OPTIONS += DEBUG
77 endif
78
79 # PROGRAM_BUILD is a complete identification of the build
80 PROGRAM_BUILD = `date -R` $(USER)@`hostname`
81
82 # DEFINE will contain some of the constants definitions decided in Makefile, 
83 # including ARCH_xx and SYS_xx. It will be passed to C compiler.
84 DEFINE += -DARCH_$(ARCH)
85 DEFINE += -DSYS_$(SYS)
86 DEFINE += -DAUDIO_OPTIONS="\"$(audio)\""
87 DEFINE += -DVIDEO_OPTIONS="\"$(video)\""
88 DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
89 DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
90 DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
91 ifeq ($(DEBUG),1)
92 DEFINE += -DDEBUG
93 endif
94
95 ################################################################################
96 # Tuning and other variables - do not change anything except if you know
97 # exactly what you are doing
98 ################################################################################
99
100 #
101 # C headers directories
102 #
103 INCLUDE += -Iinclude
104
105 ifneq (,$(findstring x11,$(video)))
106 INCLUDE += -I/usr/X11R6/include
107 endif
108
109 ifneq (,$(findstring glide,$(video)))
110 INCLUDE += -I/usr/include/glide
111 endif
112
113 #
114 # Libraries
115 #
116 LIB += -lpthread
117 LIB += -lm
118
119 ifneq (,$(findstring x11,$(video)))
120 LIB += -L/usr/X11R6/lib
121 LIB += -lX11
122 LIB += -lXext 
123 endif
124 ifneq (,$(findstring ggi,$(video)))
125 LIB += -lggi
126 endif
127 ifneq (,$(findstring glide,$(video)))
128 LIB += -lglide2x
129 endif
130
131 #
132 # C compiler flags: compilation
133 #
134 CCFLAGS += $(DEFINE) $(INCLUDE)
135 CCFLAGS += -Wall
136 CCFLAGS += -D_REENTRANT
137 CCFLAGS += -D_GNU_SOURCE
138
139 # Optimizations : don't compile debug versions with them
140 CCFLAGS += -O6
141 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
142 CCFLAGS += -fomit-frame-pointer
143
144 # Optimizations for x86 familiy
145 ifeq ($(ARCH),X86)
146 CCFLAGS += -malign-double
147 CCFLAGS += -march=pentiumpro
148 #CCFLAGS += -march=pentium
149 endif
150
151 # Optimizations for PowerPC
152 ifeq ($(ARCH),PPC)
153 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
154 endif
155
156 # Optimizations for Sparc
157 ifeq ($(ARCH),SPARC)
158 CCFLAGS += -mhard-float
159 endif
160
161 #
162 # C compiler flags: dependancies
163 #
164 DCFLAGS += $(INCLUDE)
165 DCFLAGS += -MM
166
167 #
168 # C compiler flags: linking
169 #
170 LCFLAGS += $(LIB)
171 LCFLAGS += -Wall
172 #LCFLAGS += -s
173
174 #
175 # C compiler flags: common flags
176 #
177
178 # Eventual MMX optimizations for x86
179 ifeq ($(ARCH),X86)
180 ifeq ($(MMX), YES) # MMX is YES or AUTO
181 CFLAGS += -DHAVE_MMX
182 endif
183 endif
184
185 #
186 # Additionnal debugging flags
187 #
188
189 # Debugging support
190 ifeq ($(DEBUG),1)
191 CFLAGS += -g
192 #CFLAGS += -pg
193 endif
194
195 #################################################################################
196 # Objects and files
197 #################################################################################
198
199 #
200 # C Objects
201
202 interface_obj =                 interface/main.o \
203                                                 interface/interface.o \
204                                                 interface/intf_msg.o \
205                                                 interface/intf_cmd.o \
206                                                 interface/intf_ctrl.o \
207                                                 interface/control.o \
208                                                 interface/intf_console.o \
209                                                 $(video:%=interface/intf_%.o)
210
211 input_obj =                     input/input_vlan.o \
212                                                 input/input_file.o \
213                                                 input/input_netlist.o \
214                                                 input/input_network.o \
215                                                 input/input_ctrl.o \
216                                                 input/input_pcr.o \
217                                                 input/input_psi.o \
218                                                 input/input.o
219
220 audio_output_obj =              audio_output/audio_output.o \
221                                                 $(audio:%=audio_output/aout_%.o)
222
223 video_output_obj =              video_output/video_output.o \
224                                                 video_output/video_text.o \
225                                                 video_output/video_yuv.o \
226                                                 $(video:%=video_output/vout_%.o)
227
228 ac3_decoder_obj =               ac3_decoder/ac3_decoder.o \
229                                                 ac3_decoder/ac3_parse.o \
230                                                 ac3_decoder/ac3_exponent.o \
231                                                 ac3_decoder/ac3_bit_allocate.o \
232                                                 ac3_decoder/ac3_mantissa.o \
233                                                 ac3_decoder/ac3_rematrix.o \
234                                                 ac3_decoder/ac3_imdct.o \
235                                                 ac3_decoder/ac3_downmix.o
236
237 audio_decoder_obj =             audio_decoder/audio_decoder.o \
238                                                 audio_decoder/audio_math.o
239
240 spu_decoder_obj =               spu_decoder/spu_decoder.o
241
242 #??generic_decoder_obj =                generic_decoder/generic_decoder.o
243 # remeber to add it to OBJ 
244
245 ifeq ($(DECODER),old)
246 CFLAGS += -DOLD_DECODER
247 video_decoder_obj =             video_decoder_ref/video_decoder.o \
248                                                 video_decoder_ref/display.o \
249                                                 video_decoder_ref/getblk.o \
250                                                 video_decoder_ref/gethdr.o \
251                                                 video_decoder_ref/getpic.o \
252                                                 video_decoder_ref/getvlc.o \
253                                                 video_decoder_ref/idct.o \
254                                                 video_decoder_ref/motion.o \
255                                                 video_decoder_ref/mpeg2dec.o \
256                                                 video_decoder_ref/recon.o \
257                                                 video_decoder_ref/spatscal.o
258 else
259 video_parser_obj =              video_parser/video_parser.o \
260                                                 video_parser/vpar_headers.o \
261                                                 video_parser/vpar_blocks.o \
262                                                 video_parser/vpar_synchro.o \
263                                                 video_parser/video_fifo.o
264
265 video_decoder_obj =             video_decoder/video_decoder.o \
266                                                 video_decoder/vdec_motion.o \
267                                                 video_decoder/vdec_idct.o
268 endif
269
270 misc_obj =                      misc/mtime.o \
271                                                 misc/rsc_files.o \
272                                                 misc/netutils.o
273
274 C_OBJ = $(interface_obj) \
275                 $(input_obj) \
276                 $(audio_output_obj) \
277                 $(video_output_obj) \
278                 $(ac3_decoder_obj) \
279                 $(audio_decoder_obj) \
280                 $(spu_decoder_obj) \
281                 $(generic_decoder_obj) \
282                 $(video_parser_obj) \
283                 $(video_decoder_obj) \
284                 $(vlan_obj) \
285                 $(misc_obj)
286
287 #
288 # Assembler Objects
289
290 ifeq ($(ARCH),X86)
291 ifeq ($(MMX), YES)
292 ifeq ($(DECODER),new)
293 ASM_OBJ =                       video_decoder/vdec_idctmmx.o \
294                                                 video_output/video_yuv_mmx.o
295 else
296 ASM_OBJ =                       video_decoder_ref/vdec_idctmmx.o \
297                                                 video_output/video_yuv_mmx.o
298 endif
299 endif
300 endif
301
302 #
303 # Other lists of files
304 #
305 sources := $(C_OBJ:%.o=%.c)
306 dependancies := $(sources:%.c=dep/%.d)
307
308 # All symbols must be exported
309 export
310
311 ################################################################################
312 # Targets
313 ################################################################################
314
315 #
316 # Virtual targets
317 #
318 all: vlc
319
320 clean:
321         rm -f $(C_OBJ) $(ASM_OBJ)
322
323 distclean: clean
324         rm -f **/*.o **/*~ *.log
325         rm -f vlc gmon.out core
326         rm -rf dep
327
328 show:
329         @echo "Command line for C objects:"
330         @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
331         @echo
332         @echo "Command line for assembler objects:"
333         @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
334
335 FORCE:
336
337 #
338 # Real targets
339 #
340 vlc: $(C_OBJ) $(ASM_OBJ)
341         $(CC) $(LCFLAGS) $(CFLAGS) -o $@ $(C_OBJ) $(ASM_OBJ)    
342
343 #
344 # Generic rules (see below)
345 #
346 $(dependancies): %.d: FORCE
347         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
348
349 $(C_OBJ): %.o: Makefile.dep
350 $(C_OBJ): %.o: dep/%.d
351 $(C_OBJ): %.o: %.c
352         @echo "compiling $*.c"
353         @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
354
355 $(ASM_OBJ): %.o: Makefile.dep
356 $(ASM_OBJ): %.o: %.S
357         @echo "assembling $*.S"
358         @$(CC) $(CFLAGS) -c -o $@ $<
359
360 ################################################################################
361 # Note on generic rules and dependancies
362 ################################################################################
363
364 # Note on dependancies: each .c file is associated with a .d file, which
365 # depends of it. The .o file associated with a .c file depends of the .d, of the 
366 # .c itself, and of Makefile. The .d files are stored in a separate dep/ 
367 # directory.
368 # The dep directory should be ignored by CVS.
369
370 # Note on inclusions: depending of the target, the dependancies files must 
371 # or must not be included. The problem is that if we ask make to include a file,
372 # and this file does not exist, it is made before it can be included. In a 
373 # general way, a .d file should be included if and only if the corresponding .o 
374 # needs to be re-made.
375
376 # Two makefiles are used: the main one (this one) has regular generic rules,
377 # except for .o files, for which it calls the object Makefile. Dependancies
378 # are not included in this file.
379 # The object Makefile known how to make a .o from a .c, and includes
380 # dependancies for the target, but only those required.