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