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