1 ################################################################################
2 # vlc (VideoLAN Client) main makefile
4 ################################################################################
5 # This makefile is the main makefile for the VideoLAN client.
6 ################################################################################
8 ################################################################################
10 ################################################################################
12 # Audio output settings
17 # Fallback method that should always work
20 # Video output settings
28 # Fallback method that should always work
39 # Fallback method that should always work
47 # Target operating system
53 # For x86 architecture, choose MMX support
55 # For x86 architecture, optimize for Pentium Pro
56 # (choose NO if you get `Invalid instruction' errors)
59 # Decoder choice - ?? old decoder will be removed soon
63 # Debugging mode on or off (set to 1 to activate)
66 #----------------- do not change anything below this line ----------------------
68 ################################################################################
69 # Configuration pre-processing
70 ################################################################################
72 # Program version and codename - may only be changed by the project leader
73 PROGRAM_VERSION = 0.1.99
74 PROGRAM_CODENAME = Onatopp
76 # audio and video options
77 AUDIO := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
78 VIDEO := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
80 # PROGRAM_OPTIONS is an identification string of the compilation options
81 PROGRAM_OPTIONS = $(SYS) $(ARCH)
83 PROGRAM_OPTIONS += DEBUG
86 # PROGRAM_BUILD is a complete identification of the build
87 # ( we can't use fancy options with date since OSes like Solaris
88 # or FreeBSD have strange date implementations )
89 PROGRAM_BUILD = `date` $(USER)
90 # XXX: beos does not support hostname
91 #PROGRAM_BUILD = `date` $(USER)@`hostname`
93 # DEFINE will contain some of the constants definitions decided in Makefile,
94 # including ARCH_xx and SYS_xx. It will be passed to C compiler.
95 DEFINE += -DARCH_$(shell echo $(ARCH) | cut -f1 -d' ')
96 DEFINE += -DSYS_$(SYS)
97 DEFINE += -DPLUGIN_PATH="\"$(PREFIX)/lib/videolan/vlc\""
98 DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
99 DEFINE += -DPROGRAM_CODENAME="\"$(PROGRAM_CODENAME)\""
100 DEFINE += -DPROGRAM_OPTIONS="\"$(shell echo $(PROGRAM_OPTIONS) | tr 'A-Z' 'a-z')\""
101 DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
106 ################################################################################
107 # Tuning and other variables - do not change anything except if you know
108 # exactly what you are doing
109 ################################################################################
112 # C headers directories
114 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
121 LIB += -lthreads -ldl
125 LIB += -pthread -lgnugetopt
126 LIB += -L/usr/local/lib
130 LIB += -lpthread -ldl
134 LIB += -llibroot -llibgame -llibbe
140 # C compiler flags: compilation
142 CCFLAGS += $(DEFINE) $(INCLUDE)
144 CCFLAGS += -D_REENTRANT
145 CCFLAGS += -D_GNU_SOURCE
147 # Optimizations : don't compile debug versions with them
149 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
150 CCFLAGS += -fomit-frame-pointer
152 # Optimizations for x86 familiy
153 ifneq (,$(findstring X86,$(ARCH)))
154 CCFLAGS += -malign-double
155 #CCFLAGS += -march=pentium
156 # Eventual Pentium Pro optimizations
157 ifneq (,$(findstring PPRO,$(ARCH)))
159 CCFLAGS += -march=pentiumpro
162 # Eventual MMX optimizations for x86
163 ifneq (,$(findstring MMX,$(ARCH)))
168 # Optimizations for PowerPC
169 ifneq (,$(findstring PPC,$(ARCH)))
170 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
173 # Optimizations for Sparc
174 ifneq (,$(findstring SPARC,$(ARCH)))
175 CCFLAGS += -mhard-float
179 # C compiler flags: dependancies
181 DCFLAGS += $(INCLUDE)
185 # C compiler flags: linking
192 # Additionnal debugging flags
201 #################################################################################
203 #################################################################################
208 interface_obj = interface/main.o \
209 interface/interface.o \
210 interface/intf_msg.o \
211 interface/intf_cmd.o \
212 interface/intf_ctrl.o \
213 interface/intf_console.o
215 input_obj = input/input_vlan.o \
217 input/input_netlist.o \
218 input/input_network.o \
224 audio_output_obj = audio_output/audio_output.o
226 video_output_obj = video_output/video_output.o \
227 video_output/video_text.o \
228 video_output/video_yuv.o
230 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
231 ac3_decoder/ac3_decoder.o \
232 ac3_decoder/ac3_parse.o \
233 ac3_decoder/ac3_exponent.o \
234 ac3_decoder/ac3_bit_allocate.o \
235 ac3_decoder/ac3_mantissa.o \
236 ac3_decoder/ac3_rematrix.o \
237 ac3_decoder/ac3_imdct.o \
238 ac3_decoder/ac3_downmix.o
240 audio_decoder_obj = audio_decoder/audio_decoder.o \
241 audio_decoder/audio_math.o
243 spu_decoder_obj = spu_decoder/spu_decoder.o
245 #??generic_decoder_obj = generic_decoder/generic_decoder.o
246 # remeber to add it to OBJ
248 ifeq ($(DECODER),old)
249 CFLAGS += -DOLD_DECODER
250 video_decoder_obj = video_decoder_ref/video_decoder.o \
251 video_decoder_ref/display.o \
252 video_decoder_ref/getblk.o \
253 video_decoder_ref/gethdr.o \
254 video_decoder_ref/getpic.o \
255 video_decoder_ref/getvlc.o \
256 video_decoder_ref/idct.o \
257 video_decoder_ref/motion.o \
258 video_decoder_ref/mpeg2dec.o \
259 video_decoder_ref/recon.o \
260 video_decoder_ref/spatscal.o
262 video_parser_obj = video_parser/video_parser.o \
263 video_parser/vpar_headers.o \
264 video_parser/vpar_blocks.o \
265 video_parser/vpar_synchro.o \
266 video_parser/video_fifo.o
268 video_decoder_obj = video_decoder/video_decoder.o \
269 video_decoder/vdec_motion.o \
270 video_decoder/vdec_motion_inner.o \
271 video_decoder/vdec_idct.o
274 misc_obj = misc/mtime.o \
280 C_OBJ = $(interface_obj) \
282 $(audio_output_obj) \
283 $(video_output_obj) \
285 $(audio_decoder_obj) \
287 $(generic_decoder_obj) \
288 $(video_parser_obj) \
289 $(video_decoder_obj) \
296 ifneq (,$(findstring X86,$(ARCH)))
297 ifneq (,$(findstring MMX,$(ARCH)))
298 ifeq ($(DECODER),new)
299 ASM_OBJ = video_decoder/vdec_idctmmx.o \
300 video_output/video_yuv_mmx.o
302 ASM_OBJ = video_decoder_ref/vdec_idctmmx.o \
303 video_output/video_yuv_mmx.o
311 intf_plugin = $(INTF:%=plugins/intf/intf_%.so)
312 aout_plugin = $(AOUT:%=plugins/aout/aout_%.so)
313 vout_plugin = $(VOUT:%=plugins/vout/vout_%.so)
315 PLUGIN_OBJ = $(intf_plugin) $(aout_plugin) $(vout_plugin)
318 # Other lists of files
320 C_OBJ := $(C_OBJ:%.o=src/%.o)
321 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
322 sources := $(C_OBJ:%.o=%.c) $(PLUGIN_OBJ:%.so=%.c)
323 dependancies := $(sources:%.c=.dep/%.d)
325 # All symbols must be exported
328 ################################################################################
330 ################################################################################
338 rm -f $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
341 rm -f **/*.o **/*.so **/*~ *.log
342 rm -f Makefile include/defs.h config.cache config.log
343 rm -f vlc gmon.out core
347 $(INSTALL) vlc $(PREFIX)/bin
348 mkdir -p $(PREFIX)/lib/videolan/vlc
349 $(INSTALL) $(PLUGIN_OBJ) $(PREFIX)/lib/videolan/vlc
352 @echo "Command line for C objects:"
353 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
355 @echo "Command line for assembler objects:"
356 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
363 vlc: $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
364 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(ASM_OBJ)
367 # Generic rules (see below)
369 $(dependancies): %.d: FORCE
370 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
372 $(C_OBJ): %.o: Makefile.dep
373 $(C_OBJ): %.o: .dep/%.d
375 @echo "compiling $*.o from $*.c"
376 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
378 $(ASM_OBJ): %.o: Makefile.dep
380 @echo "assembling $*.o from $*.S"
381 @$(CC) $(CFLAGS) -c -o $@ $<
383 $(PLUGIN_OBJ): %.so: Makefile.dep
384 $(PLUGIN_OBJ): %.so: .dep/%.d
387 plugins/aout/aout_dummy.so plugins/aout/aout_dsp.so: %.so: %.c
388 @echo "compiling $*.so from $*.c"
389 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
391 plugins/aout/aout_esd.so: %.so: %.c
392 @echo "compiling $*.so from $*.c"
394 @$(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
396 @$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
400 plugins/intf/intf_dummy.so plugins/vout/vout_dummy.so \
401 plugins/intf/intf_fb.so plugins/vout/vout_fb.so: %.so: %.c
402 @echo "compiling $*.so from $*.c"
403 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
405 plugins/intf/intf_x11.so plugins/vout/vout_x11.so: %.so: %.c
406 @echo "compiling $*.so from $*.c"
407 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
409 plugins/intf/intf_glide.so plugins/vout/vout_glide.so: %.so: %.c
410 @echo "compiling $*.so from $*.c"
411 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
413 plugins/intf/intf_ggi.so plugins/vout/vout_ggi.so: %.so: %.c
414 @echo "compiling $*.so from $*.c"
415 @$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
418 ################################################################################
419 # Note on generic rules and dependancies
420 ################################################################################
422 # Note on dependancies: each .c file is associated with a .d file, which
423 # depends of it. The .o file associated with a .c file depends of the .d, of the
424 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
426 # The dep directory should be ignored by CVS.
428 # Note on inclusions: depending of the target, the dependancies files must
429 # or must not be included. The problem is that if we ask make to include a file,
430 # and this file does not exist, it is made before it can be included. In a
431 # general way, a .d file should be included if and only if the corresponding .o
432 # needs to be re-made.
434 # Two makefiles are used: the main one (this one) has regular generic rules,
435 # except for .o files, for which it calls the object Makefile. Dependancies
436 # are not included in this file.
437 # The object Makefile known how to make a .o from a .c, and includes
438 # dependancies for the target, but only those required.