Makefile 2.21 KB
Newer Older
1
# Makefile
2

3 4 5 6 7 8 9 10
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
Laurent Aimar's avatar
Laurent Aimar committed
11

12 13
# MMX/SSE optims
ifeq ($(ARCH),X86)
14 15 16 17 18
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)
19 20
endif

Loren Merritt's avatar
Loren Merritt committed
21 22
# MMX/SSE optims
ifeq ($(ARCH),X86_64)
Loren Merritt's avatar
Loren Merritt committed
23
SRCS   += common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c
Loren Merritt's avatar
Loren Merritt committed
24 25 26 27 28 29
ASMSRC  = common/amd64/dct-a.asm common/amd64/cpu-a.asm \
          common/amd64/pixel-a.asm common/amd64/mc-a.asm \
          common/amd64/mc-a2.asm common/amd64/predict-a.asm
OBJASM  = $(ASMSRC:%.asm=%.o)
endif

30 31
# AltiVec optims
ifeq ($(ARCH),PPC)
32
SRCS += common/ppc/mc.c common/ppc/pixel.c
33 34
endif

Laurent Aimar's avatar
Laurent Aimar committed
35 36 37
OBJS = $(SRCS:%.c=%.o)
DEP  = depend

Loren Merritt's avatar
Loren Merritt committed
38
default: $(DEP) x264$(EXE)
Laurent Aimar's avatar
Laurent Aimar committed
39

Loren Merritt's avatar
Loren Merritt committed
40
libx264.a: .depend $(OBJS) $(OBJASM)
Laurent Aimar's avatar
Laurent Aimar committed
41
	ar rc libx264.a $(OBJS) $(OBJASM)
42
	ranlib libx264.a
Laurent Aimar's avatar
Laurent Aimar committed
43

Loren Merritt's avatar
Loren Merritt committed
44
x264$(EXE): libx264.a x264.o
Loren Merritt's avatar
Loren Merritt committed
45 46 47 48
	$(CC) -o $@ x264.o libx264.a $(LDFLAGS)

x264vfw.dll: libx264.a $(wildcard vfw/*.c vfw/*.h)
	make -C vfw/build/cygwin
Laurent Aimar's avatar
Laurent Aimar committed
49

Eric Petit's avatar
Eric Petit committed
50
checkasm: testing/checkasm.o libx264.a
51
	$(CC) -o $@ $< libx264.a $(LDFLAGS)
Laurent Aimar's avatar
Laurent Aimar committed
52 53 54 55

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

Loren Merritt's avatar
Loren Merritt committed
56
.depend: config.mak config.h
57
	rm -f .depend
58
# Hacky - because gcc 2.9x doesn't have -MT
59
	$(foreach SRC, $(SRCS) x264.c, ( echo -n "`dirname $(SRC)`/" && $(CC) $(CFLAGS) $(SRC) -MM -g0 ) 1>> .depend;)
Laurent Aimar's avatar
Laurent Aimar committed
60

61
config.h: $(wildcard .svn/entries */.svn/entries */*/.svn/entries)
62 63
	./version.sh

Laurent Aimar's avatar
Laurent Aimar committed
64 65 66 67 68 69
depend: .depend
ifneq ($(wildcard .depend),)
include .depend
endif

clean:
Loren Merritt's avatar
Loren Merritt committed
70 71
	rm -f $(OBJS) $(OBJASM) config.h *.a x264.o x264 x264.exe .depend TAGS
	rm -rf vfw/build/cygwin/bin
Laurent Aimar's avatar
Laurent Aimar committed
72

Måns Rullgård's avatar
Måns Rullgård committed
73
distclean: clean
Loren Merritt's avatar
Loren Merritt committed
74
	rm -f config.mak vfw/build/cygwin/config.mak
Laurent Aimar's avatar
Laurent Aimar committed
75

Loren Merritt's avatar
Loren Merritt committed
76 77 78 79 80 81
DIR_INSTALL="/usr/local"
install: x264
	install x264.h $(DIR_INSTALL)/include/
	install libx264.a $(DIR_INSTALL)/lib/
	install x264 $(DIR_INSTALL)/bin/

Måns Rullgård's avatar
Måns Rullgård committed
82 83 84 85
etags: TAGS

TAGS:
	etags $(SRCS)