]> git.sesse.net Git - vlc/blob - Makefile.in
Added : alsa support
[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 # Debugging mode on or off (set to 1 to activate)
13 DEBUG=@DEBUG@
14 STATS=@STATS@
15 OPTIMS=@OPTIMS@
16
17 SYS=@SYS@
18 PLUGINS=@PLUGINS@
19 SNAPSHOTDIR=vlc-@VLC_VERSION@
20 INSTALL=@INSTALL@
21 ARCH=@ARCH@
22 prefix=@prefix@
23
24 #----------------- do not change anything below this line ----------------------
25
26 ################################################################################
27 # Configuration pre-processing
28 ################################################################################
29
30 # PROGRAM_OPTIONS is an identification string of the compilation options
31 PROGRAM_OPTIONS = $(SYS) $(ARCH)
32 ifeq ($(DEBUG),1)
33 PROGRAM_OPTIONS += DEBUG
34 DEFINE += -DDEBUG
35 endif
36 ifeq ($(STATS),1)
37 PROGRAM_OPTIONS += DEBUG
38 DEFINE += -DSTATS
39 endif
40
41 # PROGRAM_BUILD is a complete identification of the build
42 # ( we can't use fancy options with date since OSes like Solaris
43 # or FreeBSD have strange date implementations )
44 PROGRAM_BUILD = `date` $(USER)
45 # XXX: beos does not support hostname
46 #PROGRAM_BUILD = `date` $(USER)@`hostname`
47
48 # DEFINE will contain some of the constants definitions decided in Makefile, 
49 # including SYS_xx. It will be passed to C compiler.
50 DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z A-Z)
51
52 ################################################################################
53 # Tuning and other variables - do not change anything except if you know
54 # exactly what you are doing
55 ################################################################################
56
57 #
58 # C headers directories
59 #
60 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
61
62 #
63 # Libraries
64 #
65
66 ifeq ($(SYS),gnu)
67 LIB += -lthreads -ldl
68 endif
69
70 ifneq (,$(findstring bsd,$(SYS)))
71 LIB += -pthread -lgnugetopt
72 LIB += -L/usr/local/lib
73 endif
74
75 ifneq (,$(findstring linux,$(SYS)))
76 LIB += -lpthread -ldl
77 endif
78
79 ifeq ($(SYS),beos)
80 LIB += -lbe -lroot -lgame
81 else
82 LIB += -lm
83 endif
84
85 #
86 # C compiler flags: compilation
87 #
88 CFLAGS += $(DEFINE) $(INCLUDE)
89 CFLAGS += -Wall -Winline
90 CFLAGS += -D_REENTRANT
91 CFLAGS += -D_GNU_SOURCE
92
93 # flags needed for clean beos compilation
94 ifeq ($(SYS),beos)
95 CFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
96 endif
97
98 # Optimizations : don't compile debug versions with them
99 ifeq ($(OPTIMS),1)
100 CFLAGS += -O6
101 CFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
102 CFLAGS += -fomit-frame-pointer
103
104 # Optimizations for x86 familiy
105 ifneq (,$(findstring 86,$(ARCH)))
106 CFLAGS += -malign-double
107 # Optional Pentium Pro optimizations
108 ifneq (,$(findstring ppro,$(ARCH)))
109 ifneq ($(SYS), BSD)
110 CFLAGS += -march=pentiumpro
111 endif
112 else
113 CFLAGS += -march=pentium
114 endif
115 endif
116
117 # Optimizations for PowerPC
118 ifneq (,$(findstring powerpc,$(ARCH)))
119 # 604e
120 CFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
121 # G3
122 #CFLAGS += -mcpu=750 -mmultiple -mhard-float -mstring
123 # G4
124 #CFLAGS += -mcpu=7400 -mmultiple -mhard-float -mstring
125 endif
126
127 # Optimizations for Sparc
128 ifneq (,$(findstring sparc,$(ARCH)))
129 CFLAGS += -mhard-float
130 endif
131
132 # /debug
133 endif
134
135 # Optional MMX optimizations for x86
136 ifneq (,$(findstring mmx,$(ARCH)))
137 CFLAGS += -DHAVE_MMX
138 endif
139
140 # End of optimizations
141
142 #
143 # C compiler flags: dependancies
144 #
145 DCFLAGS += $(INCLUDE)
146 DCFLAGS += -MM
147
148 #
149 # C compiler flags: linking
150 #
151 LCFLAGS += $(LIB)
152 LCFLAGS += -Wall
153 #LCFLAGS += -s
154
155 #
156 # Additionnal debugging flags
157 #
158
159 # Debugging and profiling support
160 ifneq ($(OPTIMS),0)
161 CFLAGS += -g
162 endif
163
164 #################################################################################
165 # Objects and files
166 #################################################################################
167
168 #
169 # C Objects
170
171 interface_obj =         interface/main.o \
172                                 interface/interface.o \
173                                 interface/intf_msg.o \
174                                 interface/intf_cmd.o \
175                                 interface/intf_ctrl.o \
176                                 interface/intf_console.o
177
178 input_obj =             input/input_vlan.o \
179                                 input/input_file.o \
180                                 input/input_netlist.o \
181                                 input/input_network.o \
182                                 input/input_ctrl.o \
183                                 input/input_pcr.o \
184                                 input/input_psi.o \
185                                 input/input.o
186
187 audio_output_obj =      audio_output/audio_output.o
188
189 video_output_obj =      video_output/video_output.o \
190                                 video_output/video_text.o \
191                                 video_output/video_spu.o \
192                                 video_output/video_yuv.o
193
194 ac3_decoder_obj =       ac3_decoder/ac3_decoder_thread.o \
195                                 ac3_decoder/ac3_decoder.o \
196                                 ac3_decoder/ac3_parse.o \
197                                 ac3_decoder/ac3_exponent.o \
198                                 ac3_decoder/ac3_bit_allocate.o \
199                                 ac3_decoder/ac3_mantissa.o \
200                                 ac3_decoder/ac3_rematrix.o \
201                                 ac3_decoder/ac3_imdct.o \
202                                 ac3_decoder/ac3_downmix.o
203                                                 
204 lpcm_decoder_obj =      lpcm_decoder/lpcm_decoder_thread.o \
205                                 lpcm_decoder/lpcm_decoder.o
206
207 audio_decoder_obj =     audio_decoder/audio_decoder_thread.o \
208                                 audio_decoder/audio_decoder.o \
209                                 audio_decoder/audio_math.o
210
211 spu_decoder_obj =       spu_decoder/spu_decoder.o
212
213 #??generic_decoder_obj =                generic_decoder/generic_decoder.o
214 # remeber to add it to OBJ 
215
216 video_parser_obj =      video_parser/video_parser.o \
217                                 video_parser/vpar_headers.o \
218                                 video_parser/vpar_blocks.o \
219                                 video_parser/vpar_synchro.o \
220                                 video_parser/video_fifo.o
221
222 ifneq (,$(findstring mmx,$(ARCH)))
223         vdec_motion_inner = video_decoder/vdec_motion_inner_mmx.o
224 else
225         vdec_motion_inner = video_decoder/vdec_motion_inner.o
226 endif
227
228 video_decoder_obj =     video_decoder/video_decoder.o \
229                                 video_decoder/vdec_motion.o \
230                                 video_decoder/vdec_idct.o \
231                                 $(vdec_motion_inner)
232
233 misc_obj =              misc/mtime.o \
234                                 misc/tests.o \
235                                 misc/rsc_files.o \
236                                 misc/netutils.o \
237                                 misc/playlist.o \
238                                 misc/plugins.o \
239                                 misc/decoder_fifo.o
240
241
242 C_OBJ = $(interface_obj) \
243                 $(input_obj) \
244                 $(audio_output_obj) \
245                 $(video_output_obj) \
246                 $(ac3_decoder_obj) \
247                 $(lpcm_decoder_obj) \
248                 $(audio_decoder_obj) \
249                 $(spu_decoder_obj) \
250                 $(generic_decoder_obj) \
251                 $(video_parser_obj) \
252                 $(video_decoder_obj) \
253                 $(vlan_obj) \
254                 $(misc_obj)
255
256 ifeq ($(SYS),beos)
257 CPP_OBJ =                       misc/beos_specific.o
258 endif
259
260 #
261 # Assembler Objects
262
263 ifneq (,$(findstring 86,$(ARCH)))
264 ifneq (,$(findstring mmx,$(ARCH)))
265 ASM_OBJ =                       video_decoder/vdec_idctmmx.o \
266                                                 video_output/video_yuv_mmx.o
267 endif
268 endif
269
270 #
271 # Plugins
272 #
273 PLUGINS := $(PLUGINS:%=lib/%.so)
274
275 PLUGIN_BEOS   = plugins/beos/beos.o \
276                 plugins/beos/aout_beos.o \
277                 plugins/beos/intf_beos.o \
278                 plugins/beos/vout_beos.o
279
280 PLUGIN_DSP    = plugins/dsp/dsp.o \
281                 plugins/dsp/aout_dsp.o \
282
283 PLUGIN_DUMMY  = plugins/dummy/dummy.o \
284                 plugins/dummy/aout_dummy.o \
285                 plugins/dummy/intf_dummy.o \
286                 plugins/dummy/vout_dummy.o
287
288 PLUGIN_ESD    = plugins/esd/esd.o \
289                 plugins/esd/aout_esd.o
290
291 PLUGIN_FB     = plugins/fb/fb.o \
292                 plugins/fb/intf_fb.o \
293                 plugins/fb/vout_fb.o
294
295 PLUGIN_GGI    = plugins/ggi/ggi.o \
296                 plugins/ggi/intf_ggi.o \
297                 plugins/ggi/vout_ggi.o
298
299 PLUGIN_SDL    = plugins/sdl/sdl.o \
300                 plugins/sdl/intf_sdl.o \
301                 plugins/sdl/vout_sdl.o 
302 #               plugins/sdl/video_yuv.o \
303 #               plugins/sdl/video_yuvall.o
304
305
306 PLUGIN_GLIDE  = plugins/glide/glide.o \
307                 plugins/glide/intf_glide.o \
308                 plugins/glide/vout_glide.o
309
310 PLUGIN_GNOME  = plugins/gnome/gnome.o \
311                 plugins/gnome/intf_gnome.o \
312                 plugins/gnome/intf_gnome_callbacks.o \
313                 plugins/gnome/intf_gnome_interface.o \
314                 plugins/gnome/intf_gnome_support.o \
315                 plugins/gnome/vout_gnome.o
316
317 PLUGIN_MGA    = plugins/mga/mga.o \
318                 plugins/mga/intf_mga.o \
319                 plugins/mga/vout_mga.o
320
321 PLUGIN_X11    = plugins/x11/x11.o \
322                 plugins/x11/intf_x11.o \
323                 plugins/x11/vout_x11.o
324
325 PLUGIN_YUV    = plugins/yuv/yuv.o \
326                 plugins/yuv/video_yuv.o \
327                 plugins/yuv/video_yuv8.o \
328                 plugins/yuv/video_yuv15.o \
329                 plugins/yuv/video_yuv16.o \
330                 plugins/yuv/video_yuv24.o \
331                 plugins/yuv/video_yuv32.o
332
333
334 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
335                 plugins/yuvmmx/video_yuv.o \
336                 plugins/yuvmmx/video_yuv8.o \
337                 plugins/yuvmmx/video_yuv15.o \
338                 plugins/yuvmmx/video_yuv16.o \
339                 plugins/yuvmmx/video_yuv24.o \
340                 plugins/yuvmmx/video_yuv32.o
341
342 PLUGIN_ALSA = plugins/alsa/alsa.o \
343               plugins/alsa/aout_alsa.o
344
345 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
346                 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
347                 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX) \
348                 $(PLUGIN_SDL) $(PLUGIN_ALSA)
349 #
350 # Other lists of files
351 #
352 C_OBJ := $(C_OBJ:%.o=src/%.o)
353 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
354 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
355 sources_c := $(C_OBJ:%.o=%.c)
356 dependancies := $(sources_c:%.c=.dep/%.d)
357
358 # All symbols must be exported
359 export
360
361 ################################################################################
362 # Targets
363 ################################################################################
364
365 #
366 # Virtual targets
367 #
368 all: vlc @ALIASES@ plugins
369
370 clean:
371         rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
372         rm -f vlc @ALIASES@ lib/*.so
373
374 distclean: clean
375         rm -f src/*/*.o plugins/*/*.o **/*~ *.log
376         rm -f Makefile include/defs.h include/config.h
377         rm -f config.status config.cache config.log
378         rm -f gmon.out core build-stamp
379         rm -rf .dep
380         rm -rf debian/tmp debian/files debian/*.debhelper debian/*.substvars
381         find debian/* -type d -maxdepth 0 -name 'vlc-*' | xargs rm -rf
382
383 install:
384         mkdir -p $(prefix)/bin
385         $(INSTALL) vlc $(prefix)/bin
386         # ugly
387         for alias in "" @ALIASES@ ; do if test $$alias ; then ln -s vlc $(prefix)/bin/$$alias ; fi ; done
388         mkdir -p $(prefix)/lib/videolan/vlc
389         $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
390         mkdir -p $(prefix)/share/videolan
391         $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
392         $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
393
394 show:
395         @echo CC: $(CC)
396         @echo CFLAGS: $(CFLAGS)
397         @echo DCFLAGS: $(DCFLAGS)
398         @echo LCFLAGS: $(LCFLAGS)
399
400 # ugliest of all, but I have no time to do it -- sam
401 snapshot:
402         rm -rf /tmp/${SNAPSHOTDIR}
403         mkdir /tmp/${SNAPSHOTDIR}
404         cp -a * /tmp/${SNAPSHOTDIR}
405                 (cd /tmp/${SNAPSHOTDIR} ; \
406                 make distclean ; \
407                 find . -type d -name CVS | xargs rm -rf ; \
408                 find . -type f -name '.*.swp' | xargs rm -f ; \
409                 find . -type f -name '.cvsignore' | xargs rm -f ; \
410                 cd .. ; \
411                 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
412                 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
413         rm -rf /tmp/${SNAPSHOTDIR}
414         mv /tmp/${SNAPSHOTDIR}.tar.gz ..
415         mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
416         @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
417
418 FORCE:
419
420 #
421 # Real targets
422 #
423 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
424 ifeq ($(SYS),beos)
425         $(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
426         rm -f ./plugins/_APP_
427         ln -s ../vlc ./plugins/_APP_
428 else
429         $(CC) $(CFLAGS) $(LCFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)      
430 endif
431
432 #
433 # Gnome and Framebuffer aliases - don't add new aliases which could bloat
434 # the namespace
435 #
436 gvlc fbvlc: vlc
437         rm -f $@ && ln -s vlc $@
438
439 plugins: $(PLUGINS)
440
441 #
442 # Generic rules (see below)
443 #
444 $(dependancies): %.d: FORCE
445         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
446
447 $(C_OBJ): %.o: Makefile.dep
448 $(C_OBJ): %.o: .dep/%.d
449 $(C_OBJ): %.o: %.c
450         $(CC) $(CFLAGS) -c -o $@ $<
451
452 $(CPP_OBJ): %.o: %.cpp
453         $(CC) $(CFLAGS) -c -o $@ $<
454
455 $(ASM_OBJ): %.o: Makefile.dep
456 $(ASM_OBJ): %.o: %.S
457         $(CC) $(CFLAGS) -c -o $@ $<
458
459 #$(PLUGIN_OBJ): %.so: Makefile.dep
460 #$(PLUGIN_OBJ): %.so: .dep/%.d
461
462 lib/beos.so: $(PLUGIN_BEOS)
463         $(CC) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
464 $(PLUGIN_BEOS): %.o: %.cpp
465         $(CC) $(CFLAGS) -c -o $@ $<
466
467 lib/esd.so: $(PLUGIN_ESD)
468 ifneq (,$(findstring bsd,$(SYS)))
469         ld -shared -lesd -o $@ $^
470 else
471         ld -shared -laudiofile -lesd -o $@ $^
472 endif
473 $(PLUGIN_ESD): %.o: %.c
474         $(CC) $(CFLAGS) -c -o $@ $<
475
476 lib/dsp.so: $(PLUGIN_DSP)
477         ld -shared -o $@ $^
478 $(PLUGIN_DSP): %.o: %.c
479         $(CC) $(CFLAGS) -c -o $@ $<
480
481 lib/alsa.so: $(PLUGIN_ALSA)
482         ld -shared -o $@ $^
483 $(PLUGIN_ALSA): %.o: %.c
484         $(CC) $(CFLAGS) -c -o $@ $<
485
486 lib/dummy.so: $(PLUGIN_DUMMY)
487         ld -shared -o $@ $^
488 $(PLUGIN_DUMMY): %.o: %.c
489         $(CC) $(CFLAGS) -c -o $@ $<
490
491 lib/fb.so: $(PLUGIN_FB)
492         ld -shared -o $@ $^
493 $(PLUGIN_FB): %.o: %.c
494         $(CC) $(CFLAGS) -c -o $@ $<
495
496 lib/x11.so: $(PLUGIN_X11)
497         ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
498 $(PLUGIN_X11): %.o: %.c
499         $(CC) $(CFLAGS) -c -o $@ $<
500
501 lib/mga.so: $(PLUGIN_MGA)
502         ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
503 $(PLUGIN_MGA): %.o: %.c
504         $(CC) $(CFLAGS) -c -o $@ $<
505
506 lib/gnome.so: $(PLUGIN_GNOME)
507         ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
508 $(PLUGIN_GNOME): %.o: %.c
509         $(CC) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
510
511 lib/glide.so: $(PLUGIN_GLIDE)
512         ld -shared -lglide2x -o $@ $^
513 $(PLUGIN_GLIDE): %.o: %.c
514         $(CC) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
515
516 lib/ggi.so: $(PLUGIN_GGI)
517         ld -shared -lggi -o $@ $^
518 $(PLUGIN_GGI): %.o: %.c
519         $(CC) $(CFLAGS) -c -o $@ $<
520
521 lib/sdl.so: $(PLUGIN_SDL)
522         ld -shared -lSDL -o $@ $^
523 $(PLUGIN_SDL): %.o: %.c
524         $(CC) $(CFLAGS) -c -o $@ $<
525
526 lib/yuv.so: $(PLUGIN_YUV)
527 ifeq ($(SYS),beos)
528         $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
529 else
530         ld -shared -o $@ $^
531 endif
532 $(PLUGIN_YUV): %.o: %.c
533         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
534
535 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
536 ifeq ($(SYS),beos)
537         $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
538 else
539         ld -shared -o $@ $^
540 endif
541 $(PLUGIN_YUVMMX): %.o: %.c
542         $(CC) $(CFLAGS) -c -o $@ $<
543
544 ################################################################################
545 # Note on generic rules and dependancies
546 ################################################################################
547
548 # Note on dependancies: each .c file is associated with a .d file, which
549 # depends of it. The .o file associated with a .c file depends of the .d, of the
550 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
551 # directory.
552 # The dep directory should be ignored by CVS.
553
554 # Note on inclusions: depending of the target, the dependancies files must
555 # or must not be included. The problem is that if we ask make to include a file,
556 # and this file does not exist, it is made before it can be included. In a
557 # general way, a .d file should be included if and only if the corresponding .o
558 # needs to be re-made.
559
560 # Two makefiles are used: the main one (this one) has regular generic rules,
561 # except for .o files, for which it calls the object Makefile. Dependancies
562 # are not included in this file.
563 # The object Makefile known how to make a .o from a .c, and includes
564 # dependancies for the target, but only those required.