1 ################################################################################
2 # vlc (VideoLAN Client) main makefile
4 ################################################################################
5 # This makefile is the main makefile for the VideoLAN client.
6 ################################################################################
8 ################################################################################
10 ################################################################################
19 # Audio output settings
24 # Fallback method that should always work
27 # Video output settings
35 # Fallback method that should always work
43 # Target operating system
49 # For x86 architecture, choose MMX support
51 # For x86 architecture, optimize for Pentium Pro
52 # (choose NO if you get `Invalid instruction' errors)
55 # Decoder choice - ?? old decoder will be removed soon
59 # Debugging mode on or off (set to 1 to activate)
62 #----------------- do not change anything below this line ----------------------
64 ################################################################################
65 # Configuration pre-processing
66 ################################################################################
68 # Program version and codename - may only be changed by the project leader
69 PROGRAM_VERSION = 0.1.99
70 PROGRAM_CODENAME = Onatopp
72 # audio and video options
73 AUDIO := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
74 VIDEO := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
76 # PROGRAM_OPTIONS is an identification string of the compilation options
77 PROGRAM_OPTIONS = $(SYS) $(ARCH)
79 PROGRAM_OPTIONS += DEBUG
82 # PROGRAM_BUILD is a complete identification of the build
83 # ( we can't use fancy options with date since OSes like Solaris
84 # or FreeBSD have strange date implementations )
85 PROGRAM_BUILD = `date` $(USER)
86 # XXX: beos does not support hostname
87 #PROGRAM_BUILD = `date` $(USER)@`hostname`
89 # DEFINE will contain some of the constants definitions decided in Makefile,
90 # including ARCH_xx and SYS_xx. It will be passed to C compiler.
91 DEFINE += -DARCH_$(shell echo $(ARCH) | cut -f1 -d' ')
92 DEFINE += -DSYS_$(SYS)
93 DEFINE += -DPLUGIN_PATH="\"$(PREFIX)/lib/videolan/vlc\""
94 DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
95 DEFINE += -DPROGRAM_CODENAME="\"$(PROGRAM_CODENAME)\""
96 DEFINE += -DPROGRAM_OPTIONS="\"$(shell echo $(PROGRAM_OPTIONS) | tr 'A-Z' 'a-z')\""
97 DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
102 ################################################################################
103 # Tuning and other variables - do not change anything except if you know
104 # exactly what you are doing
105 ################################################################################
108 # C headers directories
110 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
117 LIB += -lthreads -ldl
121 LIB += -pthread -lgnugetopt
122 LIB += -L/usr/local/lib
126 LIB += -lpthread -ldl
130 LIB += -llibroot -llibgame -llibbe
136 # C compiler flags: compilation
138 CCFLAGS += $(DEFINE) $(INCLUDE)
140 CCFLAGS += -D_REENTRANT
141 CCFLAGS += -D_GNU_SOURCE
143 # Optimizations : don't compile debug versions with them
145 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
146 CCFLAGS += -fomit-frame-pointer
148 # Optimizations for x86 familiy
149 ifneq (,$(findstring X86,$(ARCH)))
150 CCFLAGS += -malign-double
151 #CCFLAGS += -march=pentium
152 # Eventual Pentium Pro optimizations
153 ifneq (,$(findstring PPRO,$(ARCH)))
155 CCFLAGS += -march=pentiumpro
158 # Eventual MMX optimizations for x86
159 ifneq (,$(findstring MMX,$(ARCH)))
164 # Optimizations for PowerPC
165 ifneq (,$(findstring PPC,$(ARCH)))
166 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
169 # Optimizations for Sparc
170 ifneq (,$(findstring SPARC,$(ARCH)))
171 CCFLAGS += -mhard-float
175 # C compiler flags: dependancies
177 DCFLAGS += $(INCLUDE)
181 # C compiler flags: linking
188 # Additionnal debugging flags
197 #################################################################################
199 #################################################################################
204 interface_obj = interface/main.o \
205 interface/interface.o \
206 interface/intf_msg.o \
207 interface/intf_cmd.o \
208 interface/intf_ctrl.o \
209 interface/intf_console.o
211 input_obj = input/input_vlan.o \
213 input/input_netlist.o \
214 input/input_network.o \
220 audio_output_obj = audio_output/audio_output.o
222 video_output_obj = video_output/video_output.o \
223 video_output/video_text.o \
224 video_output/video_yuv.o
226 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
227 ac3_decoder/ac3_decoder.o \
228 ac3_decoder/ac3_parse.o \
229 ac3_decoder/ac3_exponent.o \
230 ac3_decoder/ac3_bit_allocate.o \
231 ac3_decoder/ac3_mantissa.o \
232 ac3_decoder/ac3_rematrix.o \
233 ac3_decoder/ac3_imdct.o \
234 ac3_decoder/ac3_downmix.o
236 audio_decoder_obj = audio_decoder/audio_decoder.o \
237 audio_decoder/audio_math.o
239 spu_decoder_obj = spu_decoder/spu_decoder.o
241 #??generic_decoder_obj = generic_decoder/generic_decoder.o
242 # remeber to add it to OBJ
244 ifeq ($(DECODER),old)
245 CFLAGS += -DOLD_DECODER
246 video_decoder_obj = video_decoder_ref/video_decoder.o \
247 video_decoder_ref/display.o \
248 video_decoder_ref/getblk.o \
249 video_decoder_ref/gethdr.o \
250 video_decoder_ref/getpic.o \
251 video_decoder_ref/getvlc.o \
252 video_decoder_ref/idct.o \
253 video_decoder_ref/motion.o \
254 video_decoder_ref/mpeg2dec.o \
255 video_decoder_ref/recon.o \
256 video_decoder_ref/spatscal.o
258 video_parser_obj = video_parser/video_parser.o \
259 video_parser/vpar_headers.o \
260 video_parser/vpar_blocks.o \
261 video_parser/vpar_synchro.o \
262 video_parser/video_fifo.o
264 video_decoder_obj = video_decoder/video_decoder.o \
265 video_decoder/vdec_motion.o \
266 video_decoder/vdec_motion_inner.o \
267 video_decoder/vdec_idct.o
270 misc_obj = misc/mtime.o \
276 C_OBJ = $(interface_obj) \
278 $(audio_output_obj) \
279 $(video_output_obj) \
281 $(audio_decoder_obj) \
283 $(generic_decoder_obj) \
284 $(video_parser_obj) \
285 $(video_decoder_obj) \
292 ifneq (,$(findstring X86,$(ARCH)))
293 ifneq (,$(findstring MMX,$(ARCH)))
294 ifeq ($(DECODER),new)
295 ASM_OBJ = video_decoder/vdec_idctmmx.o \
296 video_output/video_yuv_mmx.o
298 ASM_OBJ = video_decoder_ref/vdec_idctmmx.o \
299 video_output/video_yuv_mmx.o
307 interface_plugin = $(VIDEO:%=interface/intf_%.so)
308 audio_plugin = $(AUDIO:%=audio_output/aout_%.so)
309 video_plugin = $(VIDEO:%=video_output/vout_%.so)
311 PLUGIN_OBJ = $(interface_plugin) $(audio_plugin) $(video_plugin)
314 # Other lists of files
316 sources := $(C_OBJ:%.o=%.c) $(PLUGIN_OBJ:%.so=%.c)
317 dependancies := $(sources:%.c=.dep/%.d)
319 # All symbols must be exported
322 ################################################################################
324 ################################################################################
332 rm -f $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
335 rm -f **/*.o **/*.so **/*~ *.log
336 rm -f vlc gmon.out core
340 $(INSTALL) vlc $(PREFIX)/bin
341 mkdir -p $(PREFIX)/lib/videolan/vlc
342 $(INSTALL) $(PLUGIN_OBJ) $(PREFIX)/lib/videolan/vlc
345 @echo "Command line for C objects:"
346 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
348 @echo "Command line for assembler objects:"
349 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
356 vlc: $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
357 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(ASM_OBJ)
360 # Generic rules (see below)
362 $(dependancies): %.d: FORCE
363 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
365 $(C_OBJ): %.o: Makefile.dep
366 $(C_OBJ): %.o: .dep/%.d
368 @echo "compiling $*.o from $*.c"
369 @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
371 $(ASM_OBJ): %.o: Makefile.dep
373 @echo "assembling $*.o from $*.S"
374 @$(CC) $(CFLAGS) -c -o $@ $<
376 $(PLUGIN_OBJ): %.so: Makefile.dep
377 $(PLUGIN_OBJ): %.so: .dep/%.d
380 audio_output/aout_dummy.so audio_output/aout_dsp.so: %.so: %.c
381 @echo "compiling $*.so from $*.c"
382 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
384 audio_output/aout_esd.so: %.so: %.c
385 @echo "compiling $*.so from $*.c"
387 @$(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
389 @$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
393 interface/intf_dummy.so video_output/vout_dummy.so \
394 interface/intf_fb.so video_output/vout_fb.so: %.so: %.c
395 @echo "compiling $*.so from $*.c"
396 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
398 interface/intf_x11.so video_output/vout_x11.so: %.so: %.c
399 @echo "compiling $*.so from $*.c"
400 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
402 interface/intf_glide.so video_output/vout_glide.so: %.so: %.c
403 @echo "compiling $*.so from $*.c"
404 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
406 interface/intf_ggi.so video_output/vout_ggi.so: %.so: %.c
407 @echo "compiling $*.so from $*.c"
408 @$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
411 ################################################################################
412 # Note on generic rules and dependancies
413 ################################################################################
415 # Note on dependancies: each .c file is associated with a .d file, which
416 # depends of it. The .o file associated with a .c file depends of the .d, of the
417 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
419 # The dep directory should be ignored by CVS.
421 # Note on inclusions: depending of the target, the dependancies files must
422 # or must not be included. The problem is that if we ask make to include a file,
423 # and this file does not exist, it is made before it can be included. In a
424 # general way, a .d file should be included if and only if the corresponding .o
425 # needs to be re-made.
427 # Two makefiles are used: the main one (this one) has regular generic rules,
428 # except for .o files, for which it calls the object Makefile. Dependancies
429 # are not included in this file.
430 # The object Makefile known how to make a .o from a .c, and includes
431 # dependancies for the target, but only those required.