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