1 ################################################################################
2 # vlc (VideoLAN Client) main makefile
4 ################################################################################
5 # This makefile is the main makefile for the VideoLAN client.
6 ################################################################################
8 ################################################################################
10 ################################################################################
12 # Debugging mode on or off (set to 1 to activate)
19 SNAPSHOTDIR=vlc-@VLC_VERSION@
27 #----------------- do not change anything below this line ----------------------
29 ################################################################################
30 # Configuration pre-processing
31 ################################################################################
33 # PROGRAM_OPTIONS is an identification string of the compilation options
34 PROGRAM_OPTIONS = $(SYS) $(ARCH)
36 PROGRAM_OPTIONS += DEBUG
40 PROGRAM_OPTIONS += DEBUG
44 # PROGRAM_BUILD is a complete identification of the build
45 # ( we can't use fancy options with date since OSes like Solaris
46 # or FreeBSD have strange date implementations )
47 PROGRAM_BUILD = `date` $(USER)
48 # XXX: beos does not support hostname
49 #PROGRAM_BUILD = `date` $(USER)@`hostname`
51 # DEFINE will contain some of the constants definitions decided in Makefile,
52 # including SYS_xx. It will be passed to C compiler.
53 DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z A-Z)
55 ################################################################################
56 # Tuning and other variables - do not change anything except if you know
57 # exactly what you are doing
58 ################################################################################
61 # C headers directories
63 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
72 ifneq (,$(findstring bsd,$(SYS)))
73 LIB += -pthread -lgnugetopt
74 LIB += -L/usr/local/lib
77 ifneq (,$(findstring linux,$(SYS)))
81 ifneq (,$(findstring solaris,$(SYS)))
82 LIB += -ldl -lsocket -lnsl -lposix4 -lpthread
86 LIB += -lbe -lroot -lgame
92 # C compiler flags: mainstream compilation
94 CFLAGS += $(DEFINE) $(INCLUDE)
95 CFLAGS += -Wall -Winline
96 CFLAGS += -D_REENTRANT
97 CFLAGS += -D_GNU_SOURCE
99 # flags needed for clean beos compilation
101 CFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
104 # Optimizations : don't compile debug versions with them
107 CFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
108 CFLAGS += -funroll-all-loops -fstrict-aliasing
109 CFLAGS += -fomit-frame-pointer
111 # Optimizations for x86 familiy
112 ifneq (,$(findstring 86,$(ARCH)))
113 CFLAGS += -malign-double
114 # Optional Pentium Pro optimizations
115 ifneq (,$(findstring ppro,$(ARCH)))
117 CFLAGS += -march=pentiumpro
120 CFLAGS += -march=pentium
124 # Optimizations for PowerPC
125 ifneq (,$(findstring powerpc,$(ARCH)))
127 CFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
129 #CFLAGS += -mcpu=750 -mmultiple -mhard-float -mstring
131 #CFLAGS += -mcpu=7400 -mmultiple -mhard-float -mstring
134 # Optimizations for Sparc
135 ifneq (,$(findstring sparc,$(ARCH)))
136 CFLAGS += -mhard-float
139 #end of optimisations
142 # Optional MMX optimizations for x86
143 ifneq (,$(findstring mmx,$(ARCH)))
148 # C compiler flags: plugin compilation
150 ifneq (,$(findstring solaris,$(SYS)))
155 # C compiler flags: dependancies
157 DCFLAGS += $(INCLUDE)
161 # C compiler flags: linking
168 # Debugging and profiling support (unless optimisations are active)
174 #################################################################################
176 #################################################################################
181 INTERFACE = src/interface/main.o \
182 src/interface/interface.o \
183 src/interface/intf_msg.o \
184 src/interface/intf_cmd.o \
185 src/interface/intf_ctrl.o \
186 src/interface/intf_console.o
188 INPUT = src/input/input_ps.o \
189 src/input/input_ts.o \
190 src/input/mpeg_system.o \
191 src/input/input_ext-dec.o \
192 src/input/input_dec.o \
193 src/input/input_programs.o \
194 src/input/input_netlist.o \
197 AUDIO_OUTPUT = src/audio_output/audio_output.o
199 VIDEO_OUTPUT = src/video_output/video_output.o \
200 src/video_output/video_text.o \
201 src/video_output/video_spu.o \
202 src/video_output/video_yuv.o
204 AC3_DECODER = src/ac3_decoder/ac3_decoder_thread.o \
205 src/ac3_decoder/ac3_decoder.o \
206 src/ac3_decoder/ac3_parse.o \
207 src/ac3_decoder/ac3_exponent.o \
208 src/ac3_decoder/ac3_bit_allocate.o \
209 src/ac3_decoder/ac3_mantissa.o \
210 src/ac3_decoder/ac3_rematrix.o \
211 src/ac3_decoder/ac3_imdct.o \
212 src/ac3_decoder/ac3_downmix.o
214 LPCM_DECODER = src/lpcm_decoder/lpcm_decoder_thread.o \
215 src/lpcm_decoder/lpcm_decoder.o
217 AUDIO_DECODER = src/audio_decoder/audio_decoder.o \
218 src/audio_decoder/adec_generic.o \
219 src/audio_decoder/adec_layer1.o \
220 src/audio_decoder/adec_layer2.o \
221 src/audio_decoder/adec_math.o
223 SPU_DECODER = src/spu_decoder/spu_decoder.o
225 #GEN_DECODER = src/generic_decoder/generic_decoder.o
228 VIDEO_PARSER = src/video_parser/video_parser.o \
229 src/video_parser/vpar_headers.o \
230 src/video_parser/vpar_blocks.o \
231 src/video_parser/vpar_synchro.o \
232 src/video_parser/video_fifo.o
234 ifneq (,$(findstring mmx,$(ARCH)))
235 vdec_motion_inner = src/video_decoder/vdec_motion_inner_mmx.o
237 vdec_motion_inner = src/video_decoder/vdec_motion_inner.o
240 VIDEO_DECODER = src/video_decoder/video_decoder.o \
241 src/video_decoder/vdec_motion.o \
242 src/video_decoder/vdec_idct.o \
245 MISC = src/misc/mtime.o \
247 src/misc/rsc_files.o \
249 src/misc/netutils.o \
250 src/misc/playlist.o \
254 C_OBJ = $(INTERFACE) \
272 CPP_OBJ = src/misc/beos_specific.o
278 ifneq (,$(findstring 86,$(ARCH)))
279 ifneq (,$(findstring mmx,$(ARCH)))
280 ASM_OBJ = src/video_decoder/vdec_idctmmx.o \
281 src/video_output/video_yuv_mmx.o
288 PLUGIN_BEOS = plugins/beos/beos.o \
289 plugins/beos/aout_beos.o \
290 plugins/beos/intf_beos.o \
291 plugins/beos/vout_beos.o
293 PLUGIN_DSP = plugins/dsp/dsp.o \
294 plugins/dsp/aout_dsp.o \
296 PLUGIN_DUMMY = plugins/dummy/dummy.o \
297 plugins/dummy/aout_dummy.o \
298 plugins/dummy/intf_dummy.o \
299 plugins/dummy/vout_dummy.o
301 PLUGIN_ESD = plugins/esd/esd.o \
302 plugins/esd/aout_esd.o
304 PLUGIN_FB = plugins/fb/fb.o \
305 plugins/fb/intf_fb.o \
308 PLUGIN_GGI = plugins/ggi/ggi.o \
309 plugins/ggi/intf_ggi.o \
310 plugins/ggi/vout_ggi.o
312 PLUGIN_SDL = plugins/sdl/sdl.o \
313 plugins/sdl/intf_sdl.o \
314 plugins/sdl/vout_sdl.o
315 # plugins/sdl/video_yuv.o \
316 # plugins/sdl/video_yuvall.o
318 PLUGIN_NULL = plugins/null/null.o
320 PLUGIN_GLIDE = plugins/glide/glide.o \
321 plugins/glide/intf_glide.o \
322 plugins/glide/vout_glide.o
324 PLUGIN_GNOME = plugins/gnome/gnome.o \
325 plugins/gnome/intf_gnome.o \
326 plugins/gnome/intf_gnome_callbacks.o \
327 plugins/gnome/intf_gnome_interface.o \
328 plugins/gnome/intf_gnome_support.o \
329 plugins/gnome/vout_gnome.o
331 PLUGIN_MGA = plugins/mga/mga.o \
332 plugins/mga/intf_mga.o \
333 plugins/mga/vout_mga.o
335 PLUGIN_X11= plugins/x11/x11.o \
336 plugins/x11/intf_x11.o \
337 plugins/x11/vout_x11.o
339 PLUGIN_YUV = plugins/yuv/yuv.o \
340 plugins/yuv/video_yuv.o \
341 plugins/yuv/video_yuv8.o \
342 plugins/yuv/video_yuv15.o \
343 plugins/yuv/video_yuv16.o \
344 plugins/yuv/video_yuv24.o \
345 plugins/yuv/video_yuv32.o
347 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
348 plugins/yuvmmx/video_yuv.o \
349 plugins/yuvmmx/video_yuv8.o \
350 plugins/yuvmmx/video_yuv15.o \
351 plugins/yuvmmx/video_yuv16.o \
352 plugins/yuvmmx/video_yuv24.o \
353 plugins/yuvmmx/video_yuv32.o
355 PLUGIN_ALSA = plugins/alsa/alsa.o \
356 plugins/alsa/aout_alsa.o
358 STD_PLUGIN_OBJ =$(PLUGIN_BEOS) \
373 # Other lists of files
375 objects := $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(STD_PLUGIN_OBJ)
376 dependancies := $(objects:%.o=.dep/%.d)
378 # All symbols must be exported
381 ################################################################################
383 ################################################################################
388 all: vlc @ALIASES@ plugins
391 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(STD_PLUGIN_OBJ)
392 rm -f vlc @ALIASES@ lib/*.so
395 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
396 rm -f Makefile include/defs.h include/config.h
397 rm -f config.status config.cache config.log
398 rm -f gmon.out core build-stamp
400 rm -rf debian/tmp debian/files debian/*.debhelper debian/*.substvars
401 find debian/* -type d -maxdepth 0 -name 'vlc-*' | xargs rm -rf
404 mkdir -p $(prefix)/bin
405 $(INSTALL) vlc $(prefix)/bin
407 for alias in "" @ALIASES@ ; do if test $$alias ; then ln -s vlc $(prefix)/bin/$$alias ; fi ; done
408 mkdir -p $(prefix)/lib/videolan/vlc
409 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
410 mkdir -p $(prefix)/share/videolan
411 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
412 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
416 @echo CFLAGS: $(CFLAGS)
417 @echo DCFLAGS: $(DCFLAGS)
418 @echo LCFLAGS: $(LCFLAGS)
420 # ugliest of all, but I have no time to do it -- sam
422 rm -rf /tmp/${SNAPSHOTDIR}
423 mkdir /tmp/${SNAPSHOTDIR}
424 cp -a * /tmp/${SNAPSHOTDIR}
425 (cd /tmp/${SNAPSHOTDIR} ; \
427 find . -type d -name CVS | xargs rm -rf ; \
428 find . -type f -name '.*.swp' | xargs rm -f ; \
429 find . -type f -name '.cvsignore' | xargs rm -f ; \
431 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
432 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
433 rm -rf /tmp/${SNAPSHOTDIR}
434 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
435 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
436 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
438 plugins: $(PLUGINS:%=lib/%.so)
443 # Gnome and Framebuffer aliases - don't add new aliases which could bloat
447 rm -f $@ && ln -s vlc $@
451 # Generic rules (see below)
453 $(dependancies): %.d: FORCE
454 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
456 $(C_OBJ): %.o: Makefile.dep
457 $(C_OBJ): %.o: .dep/%.d
459 $(CC) $(CFLAGS) -c -o $@ $<
461 $(CPP_OBJ): %.o: %.cpp
462 $(CC) $(CFLAGS) -c -o $@ $<
464 $(ASM_OBJ): %.o: Makefile.dep
466 $(CC) $(CFLAGS) -c -o $@ $<
468 $(STD_PLUGIN_OBJ): %.o: Makefile.dep
469 $(STD_PLUGIN_OBJ): %.o: .dep/%.d
470 $(STD_PLUGIN_OBJ): %.o: %.c
471 $(CC) $(CFLAGS) $(PCFLAGS) -c -o $@ $<
473 $(PLUGIN_GNOME): %.o: Makefile.dep
474 $(PLUGIN_GNOME): %.o: %.c
475 $(CC) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
477 $(PLUGIN_GLIDE): %.o: Makefile.dep
478 $(PLUGIN_GLIDE): %.o: %.c
479 $(CC) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
484 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
486 $(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
487 rm -f ./plugins/_APP_
488 ln -s ../vlc ./plugins/_APP_
490 $(CC) $(CFLAGS) $(LCFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
493 lib/beos.so: $(PLUGIN_BEOS)
494 $(CC) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
496 lib/esd.so: $(PLUGIN_ESD)
497 ifneq (,$(findstring bsd,$(SYS)))
498 $(CC) -shared -lesd -o $@ $^
500 $(CC) -shared -laudiofile -lesd -o $@ $^
503 lib/dsp.so: $(PLUGIN_DSP)
504 $(CC) -shared -o $@ $^
506 lib/alsa.so: $(PLUGIN_ALSA)
507 $(CC) -shared -o $@ $^
509 lib/null.so: $(PLUGIN_NULL)
510 $(CC) -shared -o $@ $^
512 lib/dummy.so: $(PLUGIN_DUMMY)
513 $(CC) -shared -o $@ $^
515 lib/fb.so: $(PLUGIN_FB)
516 $(CC) -shared -o $@ $^
518 lib/x11.so: $(PLUGIN_X11)
519 $(CC) -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
521 lib/mga.so: $(PLUGIN_MGA)
522 $(CC) -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
524 lib/gnome.so: $(PLUGIN_GNOME)
525 $(CC) -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
527 lib/glide.so: $(PLUGIN_GLIDE)
528 $(CC) -shared -lglide2x -o $@ $^
530 lib/ggi.so: $(PLUGIN_GGI)
531 $(CC) -shared -lggi -o $@ $^
533 lib/sdl.so: $(PLUGIN_SDL)
534 $(CC) -shared -lSDL -o $@ $^
536 lib/yuv.so: $(PLUGIN_YUV)
538 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
540 $(CC) -shared -o $@ $^
543 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
545 $(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
547 $(CC) $(LCFLAGS) -shared -o $@ $^
550 ################################################################################
551 # Note on generic rules and dependancies
552 ################################################################################
554 # Note on dependancies: each .c file is associated with a .d file, which
555 # depends of it. The .o file associated with a .c file depends of the .d, of the
556 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
558 # The dep directory should be ignored by CVS.
560 # Note on inclusions: depending of the target, the dependancies files must
561 # or must not be included. The problem is that if we ask make to include a file,
562 # and this file does not exist, it is made before it can be included. In a
563 # general way, a .d file should be included if and only if the corresponding .o
564 # needs to be re-made.
566 # Two makefiles are used: the main one (this one) has regular generic rules,
567 # except for .o files, for which it calls the object Makefile. Dependancies
568 # are not included in this file.
569 # The object Makefile known how to make a .o from a .c, and includes
570 # dependancies for the target, but only those required.