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