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