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