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