amd64 asm patch, part2.
[x264/x264-sandbox.git] / Makefile
1 # Makefile
2
3 include config.mak
4
5 SRCS = common/mc.c common/predict.c common/pixel.c common/macroblock.c \
6        common/frame.c common/dct.c common/cpu.c common/cabac.c \
7        common/common.c common/mdate.c common/csp.c \
8        encoder/analyse.c encoder/me.c encoder/ratecontrol.c \
9        encoder/set.c encoder/macroblock.c encoder/cabac.c \
10        encoder/cavlc.c encoder/encoder.c encoder/eval.c
11
12 # MMX/SSE optims
13 ifeq ($(ARCH),X86)
14 SRCS   += common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c
15 ASMSRC  = common/i386/dct-a.asm common/i386/cpu-a.asm \
16           common/i386/pixel-a.asm common/i386/mc-a.asm \
17           common/i386/mc-a2.asm common/i386/predict-a.asm
18 OBJASM  = $(ASMSRC:%.asm=%.o)
19 endif
20
21 # MMX/SSE optims
22 ifeq ($(ARCH),X86_64)
23 SRCS   += common/amd64/mc-c.c common/amd64/dct-c.c common/amd64/predict.c
24 ASMSRC  = common/amd64/dct-a.asm common/amd64/cpu-a.asm \
25           common/amd64/pixel-a.asm common/amd64/mc-a.asm \
26           common/amd64/mc-a2.asm common/amd64/predict-a.asm
27 OBJASM  = $(ASMSRC:%.asm=%.o)
28 endif
29
30 # AltiVec optims
31 ifeq ($(ARCH),PPC)
32 SRCS += common/ppc/mc.c common/ppc/pixel.c
33 endif
34
35 OBJS = $(SRCS:%.c=%.o)
36 DEP  = depend
37
38 default: $(DEP) x264$(EXE)
39
40 libx264.a: .depend $(OBJS) $(OBJASM)
41         ar rc libx264.a $(OBJS) $(OBJASM)
42         ranlib libx264.a
43
44 x264$(EXE): libx264.a x264.o
45         $(CC) -o $@ x264.o libx264.a $(LDFLAGS)
46
47 x264vfw.dll: libx264.a $(wildcard vfw/*.c vfw/*.h)
48         make -C vfw/build/cygwin
49
50 checkasm: testing/checkasm.o libx264.a
51         $(CC) -o $@ $< libx264.a $(LDFLAGS)
52
53 %.o: %.asm
54         $(AS) $(ASFLAGS) -o $@ $<
55
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;)
60
61 config.h: $(wildcard .svn/entries */.svn/entries */*/.svn/entries)
62         ./version.sh
63
64 depend: .depend
65 ifneq ($(wildcard .depend),)
66 include .depend
67 endif
68
69 clean:
70         rm -f $(OBJS) $(OBJASM) config.h *.a x264.o x264 x264.exe .depend TAGS
71         rm -rf vfw/build/cygwin/bin
72
73 distclean: clean
74         rm -f config.mak vfw/build/cygwin/config.mak
75
76 DIR_INSTALL="/usr/local"
77 install: x264
78         install x264.h $(DIR_INSTALL)/include/
79         install libx264.a $(DIR_INSTALL)/lib/
80         install x264 $(DIR_INSTALL)/bin/
81
82 etags: TAGS
83
84 TAGS:
85         etags $(SRCS)