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