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