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