Commit 6490f439 authored by Eric Petit's avatar Eric Petit

Added a configure to detect the platform/system/etc so people don't

 have to edit the Makefile (will work for Linux/OS X/BeOS/FreeBSD, feel
 free to modify for others), and we can now remove the Jamfile which
 was broken most of the time anyway.


git-svn-id: svn://svn.videolan.org/x264/trunk@191 df754926-b1dd-0310-bc7b-ec298dee348c
parent b12cb05a
.depend
x264
checkasm
# $Id: Jamfile,v 1.1 2004/06/03 19:27:06 fenrir Exp $
#
# Compilers
CC = gcc ;
AS = nasm ;
# Flags
# To profile: -fprofile-arcs
# Once done : -fbranch-probabilities
CCFLAGS = -g -Wall ;
# Globals defines
DEFINES = DEBUG __X264__ ARCH_$(OSPLAT) SYS_$(OS) ;
# Optims
OPTIM = -O3 -funroll-loops ;
# Headers rep
HDRS = . common common/i386 decoder encoder ;
SOURCES_C = common/mc.c common/predict.c common/pixel.c common/macroblock.c
common/frame.c common/dct.c common/cpu.c common/cabac.c
common/common.c common/mdate.c common/csp.c
encoder/analyse.c encoder/me.c encoder/ratecontrol.c
encoder/set.c encoder/macroblock.c encoder/cabac.c encoder/cavlc.c
encoder/encoder.c encoder/eval.c ;
SOURCES_X86 = common/i386/cpu-a.asm ;
SOURCES_MMX = common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c common/i386/dct-a.asm common/i386/pixel-a.asm common/i386/mc-a.asm ;
SOURCES_ALTIVEC = common/ppc/mc.c common/ppc/pixel.c ;
# libx264
SOURCES_X264 = $(SOURCES_C) ;
if $(OSPLAT) = X86
{
DEFINES += HAVE_MMXEXT HAVE_SSE2 ;
SOURCES_X264 += $(SOURCES_MMX) ;
SOURCES_X264 += $(SOURCES_X86) ;
ASFLAGS = -f elf ;
if $(OS) != BEOS
{
DEFINES += HAVE_STDINT_H ;
}
if $(OS) != FREEBSD
{
DEFINES += HAVE_MALLOC_H ;
}
# Don't ask
NOARUPDATE = false ;
}
if $(OSPLAT) = PPC
{
DEFINES += HAVE_STDINT_H ;
SOURCES_X264 += $(SOURCES_ALTIVEC) ;
OPTIM += -falign-loops=16 ;
if $(OS) = MACOSX
{
CCFLAGS += -faltivec ;
LINKLIBS += -lmx ;
}
if $(OS) = LINUX
{
CCFLAGS += -maltivec -mabi=altivec ;
}
}
Library libx264 : $(SOURCES_X264) ;
# x264
if $(OS) != BEOS
{
LINKLIBS += -lm ;
}
LinkLibraries x264 : libx264.a ;
Main x264 : x264.c ;
# checkasm
LinkLibraries checkasm : libx264.a ;
Main checkasm : testing/checkasm.c ;
# XXX Do not remove *.o files
actions quietly updated piecemeal together RmTemps
{
}
# Makefile
# Uncomment the line for your platform
ARCH=X86
#ARCH=PPC
# Uncomment the line for you operating system
SYS=LINUX
#SYS=MACOSX
#SYS=BEOS
#SYS=FREEBSD
SRCS_COMMON= common/mc.c common/predict.c common/pixel.c common/macroblock.c \
common/frame.c common/dct.c common/cpu.c common/cabac.c \
common/common.c common/mdate.c common/csp.c \
encoder/analyse.c encoder/me.c encoder/ratecontrol.c \
encoder/set.c encoder/macroblock.c encoder/cabac.c \
encoder/cavlc.c encoder/encoder.c encoder/eval.c
# Compiler, global flags
CC=gcc
CFLAGS=-Wall -I. -O4 -funroll-loops -D__X264__ -DARCH_$(ARCH) -DSYS_$(SYS)
ifdef NDEBUG
CFLAGS+=-s -DNDEBUG
else
CFLAGS+=-g -DDEBUG
endif
SRCS= $(SRCS_COMMON)
include config.mak
SRCS = common/mc.c common/predict.c common/pixel.c common/macroblock.c \
common/frame.c common/dct.c common/cpu.c common/cabac.c \
common/common.c common/mdate.c common/csp.c \
encoder/analyse.c encoder/me.c encoder/ratecontrol.c \
encoder/set.c encoder/macroblock.c encoder/cabac.c \
encoder/cavlc.c encoder/encoder.c encoder/eval.c
# MMX/SSE optims
ifeq ($(ARCH),X86)
CFLAGS+=-DHAVE_MMXEXT -DHAVE_SSE2
SRCS+= common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c
ASMSRC= common/i386/dct-a.asm common/i386/cpu-a.asm \
common/i386/pixel-a.asm common/i386/mc-a.asm \
common/i386/mc-a2.asm common/i386/predict-a.asm
OBJASM= $(ASMSRC:%.asm=%.o)
SRCS += common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c
ASMSRC = common/i386/dct-a.asm common/i386/cpu-a.asm \
common/i386/pixel-a.asm common/i386/mc-a.asm \
common/i386/mc-a2.asm common/i386/predict-a.asm
OBJASM = $(ASMSRC:%.asm=%.o)
endif
# AltiVec optims
ifeq ($(ARCH),PPC)
ifeq ($(SYS),MACOSX)
CFLAGS+=-faltivec
else
CFLAGS+=-maltivec -mabi=altivec
endif
SRCS+= common/ppc/mc.c common/ppc/pixel.c
endif
# stdint.h: everyone but BeOS
ifneq ($(SYS),BEOS)
CFLAGS+=-DHAVE_STDINT_H
endif
# malloc.h: everyone but OS X and FreeBSD
ifneq ($(SYS),MACOSX)
ifneq ($(SYS),FREEBSD)
CFLAGS+=-DHAVE_MALLOC_H
endif
endif
# Math libraries we have to link to
ifneq ($(SYS),BEOS)
MATHLIBS=-lm
endif
ifeq ($(SYS),MACOSX)
MATHLIBS+=-lmx
SRCS += common/ppc/mc.c common/ppc/pixel.c
endif
AS= nasm
# for linux
ASFLAGS=-f elf $(PFLAGS)
# for cygwin
#ASFLAGS=-f gnuwin32 -DPREFIX
OBJS = $(SRCS:%.c=%.o)
DEP = depend
......@@ -83,10 +33,10 @@ libx264.a: $(OBJS) $(OBJASM)
ranlib libx264.a
x264: libx264.a x264.o
$(CC) $(CFLAGS) -o x264 x264.o libx264.a $(MATHLIBS)
$(CC) -o $@ x264.o libx264.a $(LDFLAGS)
checkasm: testing/checkasm.c libx264.a
$(CC) $(CFLAGS) -o checkasm $< libx264.a $(MATHLIBS)
$(CC) -o $@ $< libx264.a $(LDFLAGS)
%.o: %.asm
$(AS) $(ASFLAGS) -o $@ $<
......
#! /bin/sh
CC="gcc"
CFLAGS="-Wall -I. -O4 -funroll-loops -D__X264__"
LDFLAGS=""
AS="nasm"
ASFLAGS="-f elf"
UNAMES="`uname -s`"
case "$UNAMES" in
BeOS)
SYS="BEOS"
CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
;;
Darwin)
SYS="MACOSX"
LDFLAGS="$LDFLAGS -lm -lmx"
;;
FreeBSD)
SYS="FREEBSD"
LDFLAGS="$LDFLAGS -lm"
;;
Linux)
SYS="LINUX"
CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
LDFLAGS="$LDFLAGS -lm"
;;
*)
echo "Unknown system $UNAMES, edit the configure"
exit 1
;;
esac
UNAMEM="`uname -m`"
case "$UNAMEM" in
i386|i486|i586|i686|BePC)
ARCH="X86"
CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
;;
"Power Macintosh"|ppc)
ARCH="PPC"
if [ $SYS = MACOSX ]
then
CFLAGS="$CFLAGS -faltivec"
else
CFLAGS="$CFLAGS -maltivec -mabi=altivec"
fi
;;
*)
echo "Unknown platform $UNAMEM, edit the configure"
exit 1
;;
esac
CFLAGS="$CFLAGS -DARCH_$ARCH -DSYS_$SYS"
rm -f config.mak
cat > config.mak << EOF
ARCH=$ARCH
SYS=$SYS
CC=$CC
CFLAGS=$CFLAGS
LDFLAGS=$LDFLAGS
AS=$AS
ASFLAGS=$ASFLAGS
EOF
echo "Platform: $ARCH"
echo "System: $SYS"
echo
echo "You can run 'make' now."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment