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