]> git.sesse.net Git - vlc/blobdiff - Makefile
- �a compile sous FreeBSD (mais �a ne tourne pas)
[vlc] / Makefile
index a401258f023f0e77f7d77d91e4c8062a2d4c0667..e20f48518203e7cd6f375152785f2905e71477f9 100644 (file)
--- a/Makefile
+++ b/Makefile
 # Configuration
 ################################################################################
 
-#CC = gcc
-#SHELL = /bin/sh
+# Environment
+CC=egcc
+#CC=gcc295
+SHELL=/bin/sh
+INSTALL=install
+PREFIX=/usr
+
+# Audio output settings
+AUDIO = dsp
+#AUDIO += esd
+# Not yet supported
+#AUDIO += alsa
+# Fallback method that should always work
+AUDIO += dummy
+
+# Video output settings
+VIDEO = x11
+#VIDEO += fb
+#VIDEO += ggi
+#VIDEO += glide
+# Not yet supported
+#VIDEO += beos
+#VIDEO += dga
+# Fallback method that should always work
+VIDEO += dummy
+
+# Target architecture
+ARCH=X86
+#ARCH=PPC
+#ARCH=SPARC
+
+# Target operating system
+SYS=LINUX
+#SYS=GNU
+#SYS=BSD
+#SYS=BEOS
+
+# For x86 architecture, choose MMX support
+ARCH += MMX
+# For x86 architecture, optimize for Pentium Pro
+# (choose NO if you get `Invalid instruction' errors)
+ARCH += PPRO
+
+# Decoder choice - ?? old decoder will be removed soon
+#DECODER=old
+DECODER=new
+
+# Debugging mode on or off (set to 1 to activate)
+DEBUG=0
+
+#----------------- do not change anything below this line ----------------------
 
 ################################################################################
-# Settings and other variables
+# Configuration pre-processing
+################################################################################
+
+# Program version and codename - may only be changed by the project leader
+PROGRAM_VERSION = 0.1.99
+PROGRAM_CODENAME = Onatopp
+
+# audio and video options
+AUDIO := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
+VIDEO := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
+
+# PROGRAM_OPTIONS is an identification string of the compilation options
+PROGRAM_OPTIONS = $(SYS) $(ARCH)
+ifeq ($(DEBUG),1)
+PROGRAM_OPTIONS += DEBUG
+endif
+
+# PROGRAM_BUILD is a complete identification of the build
+# ( we can't use fancy options with date since OSes like Solaris
+# or FreeBSD have strange date implementations )
+PROGRAM_BUILD = `date` $(USER)@`hostname`
+
+# DEFINE will contain some of the constants definitions decided in Makefile, 
+# including ARCH_xx and SYS_xx. It will be passed to C compiler.
+DEFINE += -DARCH_$(shell echo $(ARCH) | cut -f1 -d' ')
+DEFINE += -DSYS_$(SYS)
+DEFINE += -DPLUGIN_PATH="\"$(PREFIX)/lib/videolan/vlc\""
+DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
+DEFINE += -DPROGRAM_CODENAME="\"$(PROGRAM_CODENAME)\""
+DEFINE += -DPROGRAM_OPTIONS="\"$(shell echo $(PROGRAM_OPTIONS) | tr 'A-Z' 'a-z')\""
+DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
+ifeq ($(DEBUG),1)
+DEFINE += -DDEBUG
+endif
+
+################################################################################
+# Tuning and other variables - do not change anything except if you know
+# exactly what you are doing
 ################################################################################
 
 #
 # C headers directories
 #
-INCLUDE += -Iinclude
-INCLUDE += -I/usr/X11R6/include/X11
+INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
 
 #
 # Libraries
 #
-LIB += -L/usr/X11R6/lib
-LIB += -lX11
-LIB += -lXext 
-LIB += -lpthread
-LIB += -lXpm
+
+ifeq ($(SYS),GNU)
+LIB += -lthreads -ldl
+endif
+
+ifeq ($(SYS),BSD)
+LIB += -pthread -lgnugetopt
+LIB += -L/usr/local/lib
+endif
+
+ifeq ($(SYS),LINUX)
+LIB += -lpthread -ldl
+endif
+
+LIB += -lm
 
 #
 # C compiler flags: compilation
 #
-CCFLAGS += $(INCLUDE)
+CCFLAGS += $(DEFINE) $(INCLUDE)
 CCFLAGS += -Wall
 CCFLAGS += -D_REENTRANT
 CCFLAGS += -D_GNU_SOURCE
@@ -42,22 +137,33 @@ CCFLAGS += -D_GNU_SOURCE
 # Optimizations : don't compile debug versions with them
 CCFLAGS += -O6
 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
-#CCFLAGS += -fomit-frame-pointer -s
-#LCFLAGS += -s
+CCFLAGS += -fomit-frame-pointer
 
-# Platform-specific optimizations
-# Optimizations for x86 familiy :
+# Optimizations for x86 familiy
+ifneq (,$(findstring X86,$(ARCH)))
 CCFLAGS += -malign-double
-CCFLAGS += -march=pentiumpro
 #CCFLAGS += -march=pentium
-
-# MMX support :
+# Eventual Pentium Pro optimizations
+ifneq (,$(findstring PPRO,$(ARCH)))
+ifneq ($(SYS), BSD)
+CCFLAGS += -march=pentiumpro
+endif
+endif
+# Eventual MMX optimizations for x86
+ifneq (,$(findstring MMX,$(ARCH)))
 CFLAGS += -DHAVE_MMX
-ASM_OBJ =   video_decoder_ref/idctmmx.o \
-                   video_decoder_ref/yuv12-rgb16.o
+endif
+endif
+
+# Optimizations for PowerPC
+ifneq (,$(findstring PPC,$(ARCH)))
+CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
+endif
 
-#Optimizations for PowerPC :
-#CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
+# Optimizations for Sparc
+ifneq (,$(findstring SPARC,$(ARCH)))
+CCFLAGS += -mhard-float
+endif
 
 #
 # C compiler flags: dependancies
@@ -70,58 +176,31 @@ DCFLAGS += -MM
 #
 LCFLAGS += $(LIB)
 LCFLAGS += -Wall
-
-#
-# C compiler flags: functions flow
-#
-FCFLAGS += $(INCLUDE)
-FCFLAGS += -A
-FCFLAGS += -P
-FCFLAGS += -v
-FCFLAGS        += -a
-FCFLAGS += -X errno.h
-FCFLAGS += -X fcntl.h
-FCFLAGS += -X signal.h
-FCFLAGS += -X stdio.h
-FCFLAGS += -X stdlib.h
-FCFLAGS += -X string.h
-FCFLAGS += -X unistd.h
-FCFLAGS += -X sys/ioctl.h
-FCFLAGS += -X sys/stat.h
-FCFLAGS += -X X11/Xlib.h
-FFILTER = grep -v "intf_.*Msg.*\.\.\."
-
-#
-# C compiler flags: common flags
-#
-# CFLAGS
+#LCFLAGS += -s
 
 #
 # Additionnal debugging flags
 #
-# Debugging settings: electric fence, debuging symbols and profiling support. 
-# Note that electric fence and accurate profiling are quite uncompatible.
-#CCFLAGS += -g
-#CCFLAGS += -pg
-#LCFLAGS += -g
-#LCFLAGS += -pg
-#LIB += -ldmalloc
-#LIB += -lefence
+
+# Debugging support
+ifeq ($(DEBUG),1)
+CFLAGS += -g
+#CFLAGS += -pg
+endif
 
 #################################################################################
 # Objects and files
 #################################################################################
 
 #
-# Objects
+# Objects
 # 
 interface_obj =                interface/main.o \
                                                interface/interface.o \
                                                interface/intf_msg.o \
                                                interface/intf_cmd.o \
                                                interface/intf_ctrl.o \
-                                               interface/control.o \
-                                               interface/xconsole.o 
+                                               interface/intf_console.o
 
 input_obj =                    input/input_vlan.o \
                                                input/input_file.o \
@@ -132,18 +211,32 @@ input_obj =                       input/input_vlan.o \
                                                input/input_psi.o \
                                                input/input.o
 
-audio_output_obj =             audio_output/audio_output.o \
-                                               audio_output/audio_dsp.o
+audio_output_obj =             audio_output/audio_output.o
 
 video_output_obj =             video_output/video_output.o \
-                                               video_output/video_x11.o \
-                                               video_output/video_graphics.o 
+                                               video_output/video_text.o \
+                                               video_output/video_yuv.o
+
+ac3_decoder_obj =              ac3_decoder/ac3_decoder_thread.o \
+                                               ac3_decoder/ac3_decoder.o \
+                                               ac3_decoder/ac3_parse.o \
+                                               ac3_decoder/ac3_exponent.o \
+                                               ac3_decoder/ac3_bit_allocate.o \
+                                               ac3_decoder/ac3_mantissa.o \
+                                               ac3_decoder/ac3_rematrix.o \
+                                               ac3_decoder/ac3_imdct.o \
+                                               ac3_decoder/ac3_downmix.o
 
 audio_decoder_obj =            audio_decoder/audio_decoder.o \
                                                audio_decoder/audio_math.o
 
-#generic_decoder_obj =         generic_decoder/generic_decoder.o
+spu_decoder_obj =              spu_decoder/spu_decoder.o
+
+#??generic_decoder_obj =               generic_decoder/generic_decoder.o
+# remeber to add it to OBJ 
 
+ifeq ($(DECODER),old)
+CFLAGS += -DOLD_DECODER
 video_decoder_obj =            video_decoder_ref/video_decoder.o \
                                                video_decoder_ref/display.o \
                                                video_decoder_ref/getblk.o \
@@ -155,27 +248,67 @@ video_decoder_obj =               video_decoder_ref/video_decoder.o \
                                                video_decoder_ref/mpeg2dec.o \
                                                video_decoder_ref/recon.o \
                                                video_decoder_ref/spatscal.o
+else
+video_parser_obj =             video_parser/video_parser.o \
+                                               video_parser/vpar_headers.o \
+                                               video_parser/vpar_blocks.o \
+                                               video_parser/vpar_synchro.o \
+                                               video_parser/video_fifo.o
+
+video_decoder_obj =            video_decoder/video_decoder.o \
+                                               video_decoder/vdec_motion.o \
+                                               video_decoder/vdec_motion_inner.o \
+                                               video_decoder/vdec_idct.o
+endif
 
 misc_obj =                     misc/mtime.o \
-                                               misc/xutils.o \
                                                misc/rsc_files.o \
-                                               misc/netutils.o
+                                               misc/netutils.o \
+                                               misc/plugins.o \
+                                               misc/decoder_fifo.o
 
 C_OBJ = $(interface_obj) \
                $(input_obj) \
                $(audio_output_obj) \
                $(video_output_obj) \
+               $(ac3_decoder_obj) \
                $(audio_decoder_obj) \
+               $(spu_decoder_obj) \
                $(generic_decoder_obj) \
+               $(video_parser_obj) \
                $(video_decoder_obj) \
                $(vlan_obj) \
-               $(misc_obj) \
+               $(misc_obj)
+
+#
+# Assembler Objects
+# 
+ifneq (,$(findstring X86,$(ARCH)))
+ifneq (,$(findstring MMX,$(ARCH)))
+ifeq ($(DECODER),new)
+ASM_OBJ =                      video_decoder/vdec_idctmmx.o \
+                                               video_output/video_yuv_mmx.o
+else
+ASM_OBJ =                      video_decoder_ref/vdec_idctmmx.o \
+                                               video_output/video_yuv_mmx.o
+endif
+endif
+endif
+
+#
+# Plugins
+#
+interface_plugin =     $(VIDEO:%=interface/intf_%.so)
+audio_plugin =         $(AUDIO:%=audio_output/aout_%.so)
+video_plugin =                 $(VIDEO:%=video_output/vout_%.so)
+
+PLUGIN_OBJ = $(interface_plugin) $(audio_plugin) $(video_plugin)
 
 #
 # Other lists of files
 #
-sources := $(C_OBJ:%.o=%.c)
-dependancies := $(sources:%.c=dep/%.d)
+sources := $(C_OBJ:%.o=%.c) $(PLUGIN_OBJ:%.so=%.c)
+dependancies := $(sources:%.c=.dep/%.d)
 
 # All symbols must be exported
 export
@@ -190,51 +323,99 @@ export
 all: vlc
 
 clean:
-       rm -f $(C_OBJ) $(ASM_OBJ)
+       rm -f $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
 
 distclean: clean
-       rm -f **/*.o **/*~ *.log
-       rm -f vlc gmon.out core Documentation/cflow
-       rm -rf dep
+       rm -f **/*.o **/*.so **/*~ *.log
+       rm -f vlc gmon.out core
+       rm -rf .dep
+
+install:
+       $(INSTALL) vlc $(PREFIX)/bin
+       mkdir -p $(PREFIX)/lib/videolan/vlc
+       $(INSTALL) $(PLUGIN_OBJ) $(PREFIX)/lib/videolan/vlc
+
+show:
+       @echo "Command line for C objects:"
+       @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
+       @echo
+       @echo "Command line for assembler objects:"
+       @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
 
 FORCE:
 
 #
 # Real targets
 #
-vlc: $(C_OBJ) $(ASM_OBJ)
-       $(CC) $(LCFLAGS) $(CFLAGS) -o $@ $(C_OBJ) $(ASM_OBJ)
-
-Documentation/cflow: $(sources)
-       cflow $(FCFLAGS) $(CFLAGS) $(sources) | $(FFILTER) > $@
+vlc: $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
+       $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(ASM_OBJ)      
 
 #
 # Generic rules (see below)
 #
 $(dependancies): %.d: FORCE
-       @make -s --no-print-directory -f Makefile.dep $@
-
-$(C_OBJ): %.o: dep/%.d
+       @$(MAKE) -s --no-print-directory -f Makefile.dep $@
 
+$(C_OBJ): %.o: Makefile.dep
+$(C_OBJ): %.o: .dep/%.d
 $(C_OBJ): %.o: %.c
-       $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
+       @echo "compiling $*.o from $*.c"
+       @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
+
+$(ASM_OBJ): %.o: Makefile.dep
 $(ASM_OBJ): %.o: %.S
-       $(CC) -c -o $@ $<
+       @echo "assembling $*.o from $*.S"
+       @$(CC) $(CFLAGS) -c -o $@ $<
+
+$(PLUGIN_OBJ): %.so: Makefile.dep
+$(PLUGIN_OBJ): %.so: .dep/%.d
+
+# audio plugins
+audio_output/aout_dummy.so audio_output/aout_dsp.so: %.so: %.c
+               @echo "compiling $*.so from $*.c"
+               @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
+
+audio_output/aout_esd.so: %.so: %.c
+               @echo "compiling $*.so from $*.c"
+ifeq ($(SYS), BSD)
+               @$(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
+else
+               @$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
+endif
+
+# video plugins
+interface/intf_dummy.so video_output/vout_dummy.so \
+       interface/intf_fb.so video_output/vout_fb.so: %.so: %.c
+               @echo "compiling $*.so from $*.c"
+               @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
+
+interface/intf_x11.so video_output/vout_x11.so: %.so: %.c
+               @echo "compiling $*.so from $*.c"
+               @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
+
+interface/intf_glide.so video_output/vout_glide.so: %.so: %.c
+               @echo "compiling $*.so from $*.c"
+               @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
+
+interface/intf_ggi.so video_output/vout_ggi.so: %.so: %.c
+               @echo "compiling $*.so from $*.c"
+               @$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
+
 
 ################################################################################
 # Note on generic rules and dependancies
 ################################################################################
 
 # Note on dependancies: each .c file is associated with a .d file, which
-# depends of it. The .o file associated with a .c file depends of the .d, of the 
-# .c itself, and of Makefile. The .d files are stored in a separate dep/ 
+# depends of it. The .o file associated with a .c file depends of the .d, of the
+# .c itself, and of Makefile. The .d files are stored in a separate .dep/
 # directory.
 # The dep directory should be ignored by CVS.
 
-# Note on inclusions: depending of the target, the dependancies files must 
+# Note on inclusions: depending of the target, the dependancies files must
 # or must not be included. The problem is that if we ask make to include a file,
-# and this file does not exist, it is made before it can be included. In a 
-# general way, a .d file should be included if and only if the corresponding .o 
+# and this file does not exist, it is made before it can be included. In a
+# general way, a .d file should be included if and only if the corresponding .o
 # needs to be re-made.
 
 # Two makefiles are used: the main one (this one) has regular generic rules,