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