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