Makefile 1.89 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 21 22
endif

# AltiVec optims
ifeq ($(ARCH),PPC)
23
SRCS += common/ppc/mc.c common/ppc/pixel.c
24 25
endif

Laurent Aimar's avatar
Laurent Aimar committed
26 27 28
OBJS = $(SRCS:%.c=%.o)
DEP  = depend

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

Loren Merritt's avatar
Loren Merritt committed
31
libx264.a: .depend $(OBJS) $(OBJASM)
Laurent Aimar's avatar
Laurent Aimar committed
32
	ar rc libx264.a $(OBJS) $(OBJASM)
33
	ranlib libx264.a
Laurent Aimar's avatar
Laurent Aimar committed
34

Loren Merritt's avatar
Loren Merritt committed
35
x264$(EXE): libx264.a x264.o
Loren Merritt's avatar
Loren Merritt committed
36 37 38 39
	$(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
40

Eric Petit's avatar
Eric Petit committed
41
checkasm: testing/checkasm.o libx264.a
42
	$(CC) -o $@ $< libx264.a $(LDFLAGS)
Laurent Aimar's avatar
Laurent Aimar committed
43 44 45 46

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

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

52
config.h: $(wildcard .svn/entries */.svn/entries */*/.svn/entries)
53 54
	./version.sh

Laurent Aimar's avatar
Laurent Aimar committed
55 56 57 58 59 60
depend: .depend
ifneq ($(wildcard .depend),)
include .depend
endif

clean:
Loren Merritt's avatar
Loren Merritt committed
61 62
	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
63

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

Loren Merritt's avatar
Loren Merritt committed
67 68 69 70 71 72
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
73 74 75 76
etags: TAGS

TAGS:
	etags $(SRCS)