--- Makefile 2002/06/15 22:32:29 1.3 +++ Makefile 2003/02/09 19:32:52 1.4 @@ -1,77 +1,144 @@ -#/************************************************************************** -# * -# * linux makefile -# * -# * nasm args: -# * -f fmt elf (linux), coff (djgpp) -# * -DPREFIX add '_' prefix to symbol names -# * -# * libso: -# * (-lm not neccessary if using -ffast-math) -# * -# *************************************************************************/ - - -include Makefile.inc - -CC = gcc -#CC=icc -#CC = /opt/experimental/bin/gcc # that's where SuSE installs gcc3 - -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/ - -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 -# CFLAGS += -march=k6 -mcpu=k6 - - CFLAGS += -Wall -O3 -funroll-loops -ffast-math - CFLAGS += -fstrict-aliasing -fomit-frame-pointer -endif +############################################################################## +# +# - Unified Makefile for XviD for *nix environments - +# +# Copyright(C) 2003 Edouard Gomez +# +# +# Description: +# This Makefile allows building XviD sources to obtain a shared library +# and a static library. This Makefie uses variables defined in the +# platform.inc file. This platform.inc file is usually created by the +# ./configure script whenever a unix shell is available. +# +# Nota Bene for mingw32/djgpp users: +# However if you provide a platform.inc file adapted to your OS, then +# change the include platform.inc to include yourfile.inc and it should +# work too. +# +# +############################################################################## -AS = nasm -AFLAGS = -f elf - -%.o: %.asm - $(AS) $(AFLAGS) $< -o $@ +include sources.inc +include platform.inc RM = rm -rf +############################################################################## +# +# Build rules +# +############################################################################## + +# Our main targets +STATIC_LIB=libxvidcore.$(STATIC_EXTENSION) +SHARED_LIB=libxvidcore.$(SHARED_EXTENSION) + +# Their Objects +OBJECTS=$(GENERIC_OBJECTS) +OBJECTS+=$(DIVX4COMPAT_OBJECTS) +OBJECTS+=$(ASSEMBLY_OBJECTS) + +#----------------------------------------------------------------------------- +# The default rule +#----------------------------------------------------------------------------- + +.SUFFIXES: .$(OBJECT_EXTENSION) .$(ASSEMBLY_EXTENSION) .c + +all: platform.inc $(STATIC_LIB) $(SHARED_LIB) + +#----------------------------------------------------------------------------- +# Generic assembly rule +#----------------------------------------------------------------------------- -all: $(LIB) $(LIBSO) - - -$(LIB): $(SRC:.c=.o) $(SRC_INTEL:.asm=.o) - ar rcs $@ $^ - - -$(LIBSO): $(SRC:.c=.o) $(SRC_INTEL:.asm=.o) - $(CC) $(CFLAGS) $^ -shared -lc -lm -o $@ - - -clean: - $(RM) `find $(SRCDIR) -name "*.o"` - -remove-all: - $(RM) $(DIRS) - $(RM) $(DIRS_INTEL) - $(RM) $(LIB) - $(RM) $(LIBSO) - +.$(ASSEMBLY_EXTENSION).$(OBJECT_EXTENSION): + $(AS) $(AFLAGS) $< -o $@ -install: libxvidcore.so - cp libxvidcore.so $(LIBDIR) # you have to bee root for this - /sbin/ldconfig +#----------------------------------------------------------------------------- +# Generic C rule +#----------------------------------------------------------------------------- + +.c.$(OBJECT_EXTENSION): + $(CC) -c $(CFLAGS) $< -o $@ + +#----------------------------------------------------------------------------- +# Static Library +#----------------------------------------------------------------------------- + +$(STATIC_LIB): $(OBJECTS) + ar rc $(STATIC_LIB) $(OBJECTS) + +#----------------------------------------------------------------------------- +# Shared Library +#----------------------------------------------------------------------------- + +$(SHARED_LIB): $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(SHARED_LIB) $(OS_LDFLAGS) + +#----------------------------------------------------------------------------- +# Installation +#----------------------------------------------------------------------------- + +install: all + @echo + @echo "+---------- Installing XviD libraries in $(libdir) ----------+" + @echo + $(INSTALL) -m 755 $(SHARED_LIB) $(libdir)/$(SHARED_LIB) + $(INSTALL) -m 755 $(STATIC_LIB) $(libdir)/$(STATIC_LIB) + @echo + @echo "+---------- Installing XviD header in $(includedir) ----------+" + @echo + $(INSTALL) -m 644 $(SRCDIR)/xvid.h $(includedir)/xvid.h + @echo + +#----------------------------------------------------------------------------- +# Platorm specific file -- dumb rule for people executing make before +# ./configure +#----------------------------------------------------------------------------- + +platform.inc: platform.inc.in + ./configure + +#----------------------------------------------------------------------------- +# .PHONY targets +#----------------------------------------------------------------------------- + +.PHONY: distclean clean info list-objects list-targets list-install-path + +clean: + $(RM) $(OBJECTS) + $(RM) $(SHARED_LIB) + $(RM) $(STATIC_LIB) + +distclean: clean + $(RM) config.log + $(RM) platform.inc + $(RM) autom4te.cache + +list-objects: + @echo + @echo "Object files used for this build" + @echo "---------------------------------------------------------------" + @echo + @echo $(OBJECTS) + @echo + +list-targets: + @echo + @echo "Target Libraries" + @echo "---------------------------------------------------------------" + @echo + @echo Shared library: $(SHARED_LIB) + @echo Static library: $(STATIC_LIB) + @echo + +list-install-path: + @echo + @echo "Install Paths" + @echo "---------------------------------------------------------------" + @echo + @echo Include: $(includedir) + @echo Library: $(libdir) + @echo -install-test: libxvidcore.so # if you don't want to overwrite previous compile - cp libxvidcore.so $(LIBDIR)/libtestcore.so - /sbin/ldconfig +info: list-objects list-targets list-install-path