Makefile 1.67 KB
Newer Older
Laurent Aimar's avatar
Laurent Aimar committed
1
# Makefile: tuned for i386/MMX system only
2

3
# For FreeBSD, remove -DHAVE_MALLOC_H and add -DSYS_FREEBSD
Laurent Aimar's avatar
Laurent Aimar committed
4

5 6 7
# Uncomment this for Mac OS X
#SYS_MACOSX=1

8 9 10
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 \
Eric Petit's avatar
Typo  
Eric Petit committed
11 12 13
             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 x264.c
14 15 16

ifdef SYS_MACOSX
PFLAGS=-DARCH_PPC -DSYS_MACOSX -faltivec
17
SRCS= $(SRCS_COMMON) common/ppc/mc.c common/ppc/pixel.c
18 19
else
PFLAGS=-DARCH_X86 -DHAVE_MMXEXT -DHAVE_SSE2 -DHAVE_MALLOC_H
20 21
SRCS= $(SRCS_COMMON) common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c
ASMSRC= common/i386/dct.asm common/i386/cpu.asm common/i386/pixel.asm common/i386/mc.asm
22 23 24 25 26
OBJASM= $(ASMSRC:%.asm=%.o)
endif

CC=gcc
CFLAGS=-g -Wall -I. -DDEBUG -O4 -funroll-loops -D__X264__ $(PFLAGS)
Laurent Aimar's avatar
Laurent Aimar committed
27 28 29

AS= nasm
# for linux
Min Chen's avatar
Min Chen committed
30
ASFLAGS=-f elf $(PFLAGS)
Laurent Aimar's avatar
Laurent Aimar committed
31 32 33 34 35 36 37 38 39 40
# for cygwin
#ASFLAGS=-f gnuwin32 -DPREFIX

OBJS = $(SRCS:%.c=%.o)
DEP  = depend

default: $(DEP) x264

libx264.a: $(OBJS) $(OBJASM)
	ar rc libx264.a $(OBJS) $(OBJASM)
41
	ranlib libx264.a
Laurent Aimar's avatar
Laurent Aimar committed
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

x264: libx264.a x264.o
	$(CC) $(CFLAGS) -o x264 x264.o libx264.a -lm

checkasm: testing/checkasm.c libx264.a
	$(CC) $(CFLAGS) -o checkasm $< libx264.a -lm

%.o: %.asm
	$(AS) $(ASFLAGS) -o $@ $<

.depend: $(SRCS) x264.c
	$(CC) -MM $(CFLAGS) $(SRCS) x264.c 1> .depend

depend: .depend
ifneq ($(wildcard .depend),)
include .depend
endif

clean:
Måns Rullgård's avatar
Måns Rullgård committed
61
	rm -f $(OBJS) $(OBJASM) *.a x264.o .depend x264 TAGS
Laurent Aimar's avatar
Laurent Aimar committed
62

Måns Rullgård's avatar
Måns Rullgård committed
63
distclean: clean
Laurent Aimar's avatar
Laurent Aimar committed
64

Måns Rullgård's avatar
Måns Rullgård committed
65 66 67 68
etags: TAGS

TAGS:
	etags $(SRCS)