--- trunk/xvidcore/build/generic/Makefile.linux 2002/06/09 11:23:13 190 +++ trunk/xvidcore/build/generic/Makefile.linux 2002/06/09 12:18:23 191 @@ -1,44 +1,125 @@ -#/************************************************************************** -# * -# * linux makefile -# * -# * nasm args: -# * -f fmt elf (linux), coff (djgpp) -# * -DPREFIX add '_' prefix to symbol names -# * -# * libso: -# * (-lm not neccessary if using -ffast-math) -# * -# *************************************************************************/ - +############################################################################# +# +# GNU/Linux Makefile +# +# Edit this file to enable/disable optimizations +# +# $Id: Makefile.linux,v 1.2 2002-06-09 12:18:23 edgomez Exp $ +# +############################################################################# include Makefile.inc -CC = gcc -#CC=icc -#CC = /opt/experimental/bin/gcc # that's where SuSE installs gcc3 +# You can set/add options to CC and CFLAGS without editing this Makefile +# You have just to export an environment CC/CFLAGS variable before running +# make. +# +# Examples : +# $ export CC='gcc-3.1' +# $ export CFLAGS='-maccumulate-outgoing-args' +# $ make +# ... + +# You can choose a specific compiler here removing the sharp symbol +# - Default is 'cc' which is a symlink to your default distro gcc + + +# CC = gcc +# CC = gcc-3.1 +# CC = icc + +# Assembler +AS = nasm +AFLAGS = -f elf + +# Constants which should not be modified +CFLAGS += -DARCH_X86 +CFLAGS += -DLINUX + +# Enable some experimental/debugging code +# (Use only if you know what you're doing !) +# CFLAGS += -D_DEBUG +# CFLAGS += -DBFRAMES -CFLAGS = -DARCH_X86 -DLINUX LIBDIR = /usr/local/lib ifeq ($(CC),icc) - CFLAGS+= -O3 -ip -tpp6 -xM # -tpp7 might be faster (P4 optmization)... - CFLAGS+= -I/opt/intel/compiler50/ia32/include -I/opt/intel/compiler50/ia32/substitute_headers/ + + # -tpp7 might be faster (P4 optmization)... + CFLAGS += -O3 -ip -tpp6 -xM + CFLAGS += -I/opt/intel/compiler50/ia32/include + CFLAGS += -I/opt/intel/compiler50/ia32/substitute_headers/ else -# CFLAGS += -funroll-loops -ffast-math -fstrict-aliasing -fomit-frame-pointer -# CFLAGS += -fPIC -# CFLAGS += -m486 -# CFLAGS += -march=pentium -mcpu=pentium -# CFLAGS += -march=pentiumpro -mcpu=pentiumpro + # Warning level options + # Shows all warnings + CFLAGS += -Wall + # To detect non ANSI C code (xvid is not ANSI C (yet?)) + # CFLAGS += -pedantic + + # General Optimization options + # Optimize code for size (implies -O2) + CFLAGS += -Os + # Unroll loops code, this might speed up loops + CFLAGS += -funroll-loops + # Generates FPU math code + CFLAGS += -ffast-math + # ??? (man gcc) + CFLAGS += -fstrict-aliasing + # Omit the x86 push ebp; mov ebp, esp function + # header and its corresponding function tailer + CFLAGS += -fomit-frame-pointer + # Generates Position Independant Code depending on your nasm version, + # this could generate shared libraries that segfault because of a nasm + # bug + # CFLAGS += -fPIC + + + # Architecture options : Valid for every gcc version + # Uncomment the one which you want to compile for + + # CFLAGS += -march=i386 -mcpu=i386 + # CFLAGS += -march=i486 -mcpu=i486 + # CFLAGS += -march=i586 -mcpu=i586 + # CFLAGS += -march=i686 -mcpu=i686 + + # Architecture options : Valid for every gcc >= 3.1 + # Uncomment the one which you want to compile for + + # CFLAGS += -march=pentium-mmx -mcpu=pentium-mmx + # CFLAGS += -march=pentium3 -mcpu=pentium3 + # CFLAGS += -march=pentium4 -mcpu=pentium4 + # CFLAGS += -march=athlon -mcpu=athlon + # CFLAGS += -march=k6 -mcpu=k6 + # CFLAGS += -march=k6-2 -mcpu=k6-2 + # CFLAGS += -march=k6-3 -mcpu=k6-3 + # CFLAGS += -march=athlon-tbird -mcpu=athlon-tbird + # CFLAGS += -march=athlon-xp -mcpu=athlon-xp + # CFLAGS += -march=athlon-mp -mcpu=athlon-mp + + # Architecture specific optimization for every gcc + # Aligns the stack to 2^4=16bytes boundaries in each function + # Local variables should be aligned and make the code faster + # some gcc versions (3.0.4) have problems with this option + # we can't really trust gcc output :-( You're warned. + CFLAGS += -mpreferred-stack-boundary=4 + + # Architecture specific optimization available in gcc >= 3.1 + # generates floating point sse code (for >= pentium 3) + # CFLAGS += -mfpmath=sse + # generates both floating point sse and 387 code, this double the amount + # of fp registers and could make the code faster + # (Still experimental in gcc 3.1.0) + # CFLAGS += -mfpmath=sse,387 - CFLAGS += -Wall -O3 -funroll-loops -ffast-math -march=pentiumpro -mcpu=pentiumpro - CFLAGS += -fstrict-aliasing -fomit-frame-pointer endif -AS = nasm -AFLAGS = -f elf +############################################################################# +# +# Makefile rules +# +############################################################################# %.o: %.asm $(AS) $(AFLAGS) $< -o $@ @@ -59,14 +140,9 @@ clean: $(RM) `find $(SRCDIR) -name "*.o"` - -remove-all: - $(RM) $(DIRS) - $(RM) $(DIRS_INTEL) $(RM) $(LIB) $(RM) $(LIBSO) - install: libxvidcore.so cp libxvidcore.so $(LIBDIR) # you have to bee root for this /sbin/ldconfig