]> git.sesse.net Git - vlc/blob - Makefile.in
cdd81337a8ac45f1e542af43ae243ae7e8208d46
[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 -lposix4 -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 -fargument-noalias-global
111 CFLAGS += -funroll-all-loops -fstrict-aliasing
112 CFLAGS += -fomit-frame-pointer
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 ifneq (,$(findstring solaris,$(SYS)))
154 PCFLAGS += -fPIC
155 endif
156
157 #
158 # C compiler flags: dependancies
159 #
160 DCFLAGS += $(INCLUDE)
161 DCFLAGS += -MM
162
163 #
164 # C compiler flags: linking
165 #
166 LCFLAGS += $(LIB)
167 LCFLAGS += -Wall
168 #LCFLAGS += -s
169
170 #
171 # Debugging and profiling support (unless optimisations are active)
172 #
173 ifneq ($(OPTIMS),1)
174 CFLAGS += -g
175 endif
176
177 #################################################################################
178 # Objects and files
179 #################################################################################
180
181 #
182 # C Objects
183
184 INTERFACE =     src/interface/main.o \
185                 src/interface/interface.o \
186                 src/interface/intf_msg.o \
187                 src/interface/intf_cmd.o \
188                 src/interface/intf_ctrl.o \
189                 src/interface/intf_console.o
190
191 INPUT =         src/input/input_ps.o \
192                 src/input/input_ts.o \
193                 src/input/mpeg_system.o \
194                 src/input/input_ext-dec.o \
195                 src/input/input_dec.o \
196                 src/input/input_programs.o \
197                 src/input/input_netlist.o \
198                 src/input/input.o
199
200 AUDIO_OUTPUT =  src/audio_output/audio_output.o
201
202 VIDEO_OUTPUT =  src/video_output/video_output.o \
203                 src/video_output/video_text.o \
204                 src/video_output/video_spu.o \
205                 src/video_output/video_yuv.o
206
207 AC3_DECODER =   src/ac3_decoder/ac3_decoder_thread.o \
208                 src/ac3_decoder/ac3_decoder.o \
209                 src/ac3_decoder/ac3_parse.o \
210                 src/ac3_decoder/ac3_exponent.o \
211                 src/ac3_decoder/ac3_bit_allocate.o \
212                 src/ac3_decoder/ac3_mantissa.o \
213                 src/ac3_decoder/ac3_rematrix.o \
214                 src/ac3_decoder/ac3_imdct.o \
215                 src/ac3_decoder/ac3_downmix.o
216
217 LPCM_DECODER =  src/lpcm_decoder/lpcm_decoder_thread.o \
218                 src/lpcm_decoder/lpcm_decoder.o
219
220 AUDIO_DECODER = src/audio_decoder/audio_decoder.o \
221                 src/audio_decoder/adec_generic.o \
222                 src/audio_decoder/adec_layer1.o \
223                 src/audio_decoder/adec_layer2.o \
224                 src/audio_decoder/adec_math.o
225
226 SPU_DECODER =   src/spu_decoder/spu_decoder.o
227
228 #GEN_DECODER =  src/generic_decoder/generic_decoder.o
229
230
231 VIDEO_PARSER =  src/video_parser/video_parser.o \
232                 src/video_parser/vpar_headers.o \
233                 src/video_parser/vpar_blocks.o \
234                 src/video_parser/vpar_synchro.o \
235                 src/video_parser/video_fifo.o
236
237 ifneq (,$(findstring mmx,$(ARCH)))
238         vdec_motion_inner = src/video_decoder/vdec_motion_inner_mmx.o
239 else
240         vdec_motion_inner = src/video_decoder/vdec_motion_inner.o
241 endif
242
243 VIDEO_DECODER = src/video_decoder/video_decoder.o \
244                 src/video_decoder/vdec_motion.o \
245                 src/video_decoder/vdec_idct.o \
246                 $(vdec_motion_inner)
247
248 MISC =          src/misc/mtime.o \
249                 src/misc/tests.o \
250                 src/misc/rsc_files.o \
251                 src/misc/modules.o \
252                 src/misc/netutils.o \
253                 src/misc/playlist.o \
254                 src/misc/plugins.o
255
256
257 C_OBJ =         $(INTERFACE) \
258                 $(INPUT) \
259                 $(VIDEO_OUTPUT) \
260                 $(AUDIO_OUTPUT) \
261                 $(AC3_DECODER) \
262                 $(LPCM_DECODER) \
263                 $(AUDIO_DECODER) \
264                 $(SPU_DECODER) \
265                 $(GEN_DECODER) \
266                 $(VIDEO_PARSER) \
267                 $(VIDEO_DECODER) \
268                 $(MISC)
269
270
271 #
272 # CPP Objects
273
274 ifeq ($(SYS),beos)
275 CPP_OBJ =       src/misc/beos_specific.o
276 endif
277
278 #
279 # Assembler Objects
280
281 ifneq (,$(findstring 86,$(ARCH)))
282 ifneq (,$(findstring mmx,$(ARCH)))
283 ASM_OBJ =       src/video_decoder/vdec_idctmmx.o \
284                 src/video_output/video_yuv_mmx.o
285 endif
286 endif
287
288 #
289 # Plugins
290 #
291 PLUGIN_BEOS =   plugins/beos/beos.o \
292                 plugins/beos/aout_beos.o \
293                 plugins/beos/intf_beos.o \
294                 plugins/beos/vout_beos.o
295
296 PLUGIN_DSP =    plugins/dsp/dsp.o \
297                 plugins/dsp/aout_dsp.o \
298
299 PLUGIN_DUMMY =  plugins/dummy/dummy.o \
300                 plugins/dummy/aout_dummy.o \
301                 plugins/dummy/intf_dummy.o \
302                 plugins/dummy/vout_dummy.o
303
304 PLUGIN_ESD =    plugins/esd/esd.o \
305                 plugins/esd/aout_esd.o
306
307 PLUGIN_FB =     plugins/fb/fb.o \
308                 plugins/fb/intf_fb.o \
309                 plugins/fb/vout_fb.o
310
311 PLUGIN_GGI =    plugins/ggi/ggi.o \
312                 plugins/ggi/intf_ggi.o \
313                 plugins/ggi/vout_ggi.o
314
315 PLUGIN_SDL =    plugins/sdl/sdl.o \
316                 plugins/sdl/intf_sdl.o \
317                 plugins/sdl/vout_sdl.o 
318 #               plugins/sdl/video_yuv.o \
319 #               plugins/sdl/video_yuvall.o
320
321 PLUGIN_NULL =   plugins/null/null.o
322
323 PLUGIN_GLIDE =  plugins/glide/glide.o \
324                 plugins/glide/intf_glide.o \
325                 plugins/glide/vout_glide.o
326
327 PLUGIN_GNOME =  plugins/gnome/gnome.o \
328                 plugins/gnome/intf_gnome.o \
329                 plugins/gnome/intf_gnome_callbacks.o \
330                 plugins/gnome/intf_gnome_interface.o \
331                 plugins/gnome/intf_gnome_support.o \
332                 plugins/gnome/vout_gnome.o
333
334 PLUGIN_MGA =    plugins/mga/mga.o \
335                 plugins/mga/intf_mga.o \
336                 plugins/mga/vout_mga.o
337
338 PLUGIN_X11=     plugins/x11/x11.o \
339                 plugins/x11/intf_x11.o \
340                 plugins/x11/vout_x11.o
341
342 PLUGIN_YUV =    plugins/yuv/yuv.o \
343                 plugins/yuv/video_yuv.o \
344                 plugins/yuv/video_yuv8.o \
345                 plugins/yuv/video_yuv15.o \
346                 plugins/yuv/video_yuv16.o \
347                 plugins/yuv/video_yuv24.o \
348                 plugins/yuv/video_yuv32.o
349
350 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
351                 plugins/yuvmmx/video_yuv.o \
352                 plugins/yuvmmx/video_yuv8.o \
353                 plugins/yuvmmx/video_yuv15.o \
354                 plugins/yuvmmx/video_yuv16.o \
355                 plugins/yuvmmx/video_yuv24.o \
356                 plugins/yuvmmx/video_yuv32.o
357
358 PLUGIN_ALSA =   plugins/alsa/alsa.o \
359                 plugins/alsa/aout_alsa.o
360
361 STD_PLUGIN_OBJ =$(PLUGIN_BEOS) \
362                 $(PLUGIN_DSP) \
363                 $(PLUGIN_DUMMY) \
364                 $(PLUGIN_ESD) \
365                 $(PLUGIN_FB) \
366                 $(PLUGIN_GGI) \
367                 $(PLUGIN_MGA) \
368                 $(PLUGIN_X11) \
369                 $(PLUGIN_YUV) \
370                 $(PLUGIN_YUVMMX) \
371                 $(PLUGIN_SDL) \
372                 $(PLUGIN_ALSA) \
373                 $(PLUGIN_NULL)
374
375 #
376 # Other lists of files
377 #
378 objects := $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(STD_PLUGIN_OBJ)
379 dependancies := $(objects:%.o=.dep/%.d)
380
381 # All symbols must be exported
382 export
383
384 ################################################################################
385 # Targets
386 ################################################################################
387
388 #
389 # Virtual targets
390 #
391 all: vlc @ALIASES@ plugins
392
393 clean:
394         rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(STD_PLUGIN_OBJ)
395         rm -f vlc @ALIASES@ lib/*.so
396
397 distclean: clean
398         rm -f src/*/*.o plugins/*/*.o **/*~ *.log
399         rm -f Makefile include/defs.h include/config.h
400         rm -f config.status config.cache config.log
401         rm -f gmon.out core build-stamp
402         rm -rf .dep
403         rm -rf debian/tmp debian/files debian/*.debhelper debian/*.substvars
404         find debian/* -type d -maxdepth 0 -name 'vlc-*' | xargs rm -rf
405
406 install:
407         mkdir -p $(prefix)/bin
408         $(INSTALL) vlc $(prefix)/bin
409 # ugly
410         for alias in "" @ALIASES@ ; do if test $$alias ; then ln -s vlc $(prefix)/bin/$$alias ; fi ; done
411         mkdir -p $(prefix)/lib/videolan/vlc
412         $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
413         mkdir -p $(prefix)/share/videolan
414         $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
415         $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
416
417 show:
418         @echo CC: $(CC)
419         @echo CFLAGS: $(CFLAGS)
420         @echo DCFLAGS: $(DCFLAGS)
421         @echo LCFLAGS: $(LCFLAGS)
422
423 # ugliest of all, but I have no time to do it -- sam
424 snapshot:
425         rm -rf /tmp/${SNAPSHOTDIR}
426         mkdir /tmp/${SNAPSHOTDIR}
427         cp -a * /tmp/${SNAPSHOTDIR}
428                 (cd /tmp/${SNAPSHOTDIR} ; \
429                 make distclean ; \
430                 find . -type d -name CVS | xargs rm -rf ; \
431                 find . -type f -name '.*.swp' | xargs rm -f ; \
432                 find . -type f -name '.cvsignore' | xargs rm -f ; \
433                 cd .. ; \
434                 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
435                 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
436         rm -rf /tmp/${SNAPSHOTDIR}
437         mv /tmp/${SNAPSHOTDIR}.tar.gz ..
438         mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
439         @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
440
441 plugins: $(PLUGINS:%=lib/%.so)
442
443 FORCE:
444
445 #
446 # Gnome and Framebuffer aliases - don't add new aliases which could bloat
447 # the namespace
448 #
449 gvlc fbvlc: vlc
450         rm -f $@ && ln -s vlc $@
451
452
453 #
454 # Generic rules (see below)
455 #
456 $(dependancies): %.d: FORCE
457         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
458
459 $(C_OBJ): %.o: Makefile.dep
460 $(C_OBJ): %.o: .dep/%.d
461 $(C_OBJ): %.o: %.c
462         $(CC) $(CFLAGS) -c -o $@ $<
463
464 $(CPP_OBJ): %.o: %.cpp
465         $(CC) $(CFLAGS) -c -o $@ $<
466
467 $(ASM_OBJ): %.o: Makefile.dep
468 $(ASM_OBJ): %.o: %.S
469         $(CC) $(CFLAGS) -c -o $@ $<
470
471 $(STD_PLUGIN_OBJ): %.o: Makefile.dep
472 $(STD_PLUGIN_OBJ): %.o: .dep/%.d
473 $(STD_PLUGIN_OBJ): %.o: %.c
474         $(CC) $(CFLAGS) $(PCFLAGS) -c -o $@ $<
475
476 $(PLUGIN_GNOME): %.o: Makefile.dep
477 $(PLUGIN_GNOME): %.o: %.c
478         $(CC) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
479
480 $(PLUGIN_GLIDE): %.o: Makefile.dep
481 $(PLUGIN_GLIDE): %.o: %.c
482         $(CC) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
483
484 #
485 # Real targets
486 #
487 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
488 ifeq ($(SYS),beos)
489         $(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
490         rm -f ./plugins/_APP_
491         ln -s ../vlc ./plugins/_APP_
492 else
493         $(CC) $(CFLAGS) $(LCFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)      
494 endif
495
496 lib/beos.so: $(PLUGIN_BEOS)
497         $(CC) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
498
499 lib/esd.so: $(PLUGIN_ESD)
500 ifneq (,$(findstring bsd,$(SYS)))
501         $(CC) $(LCFLAGS) -shared -lesd -o $@ $^
502 else
503         $(CC) $(LCFLAGS) -shared -laudiofile -lesd -o $@ $^
504 endif
505
506 lib/dsp.so: $(PLUGIN_DSP)
507         $(CC) $(LCFLAGS) -shared -o $@ $^
508
509 lib/alsa.so: $(PLUGIN_ALSA)
510         $(CC) $(LCFLAGS) -shared -o $@ $^
511
512 lib/null.so: $(PLUGIN_NULL)
513         $(CC) $(LCFLAGS) -shared -o $@ $^
514
515 lib/dummy.so: $(PLUGIN_DUMMY)
516         $(CC) $(LCFLAGS) -shared -o $@ $^
517
518 lib/fb.so: $(PLUGIN_FB)
519         $(CC) $(LCFLAGS) -shared -o $@ $^
520
521 lib/x11.so: $(PLUGIN_X11)
522         $(CC) $(LCFLAGS) -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
523
524 lib/mga.so: $(PLUGIN_MGA)
525         $(CC) $(LCFLAGS) -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
526
527 lib/gnome.so: $(PLUGIN_GNOME)
528         $(CC) $(LCFLAGS) -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
529
530 lib/glide.so: $(PLUGIN_GLIDE)
531         $(CC) $(LCFLAGS) -shared $(LIB_GLIDE) -o $@ $^
532
533 lib/ggi.so: $(PLUGIN_GGI)
534         $(CC) $(LCFLAGS) -shared $(LIB_GGI) -o $@ $^
535
536 lib/sdl.so: $(PLUGIN_SDL)
537         $(CC) $(LCFLAGS) -shared $(LIB_SDL) -o $@ $^
538
539 lib/yuv.so: $(PLUGIN_YUV)
540 ifeq ($(SYS),beos)
541         $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
542 else
543         $(CC) $(LCFLAGS) -shared -o $@ $^
544 endif
545
546 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
547 ifeq ($(SYS),beos)
548         $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
549 else
550         $(CC) $(LCFLAGS) -shared -o $@ $^
551 endif
552
553 ################################################################################
554 # Note on generic rules and dependancies
555 ################################################################################
556
557 # Note on dependancies: each .c file is associated with a .d file, which
558 # depends of it. The .o file associated with a .c file depends of the .d, of the
559 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
560 # directory.
561 # The dep directory should be ignored by CVS.
562
563 # Note on inclusions: depending of the target, the dependancies files must
564 # or must not be included. The problem is that if we ask make to include a file,
565 # and this file does not exist, it is made before it can be included. In a
566 # general way, a .d file should be included if and only if the corresponding .o
567 # needs to be re-made.
568
569 # Two makefiles are used: the main one (this one) has regular generic rules,
570 # except for .o files, for which it calls the object Makefile. Dependancies
571 # are not included in this file.
572 # The object Makefile known how to make a .o from a .c, and includes
573 # dependancies for the target, but only those required.