mmx deblocking.
[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 common/set.c \
8        common/quant.c \
9        encoder/analyse.c encoder/me.c encoder/ratecontrol.c \
10        encoder/set.c encoder/macroblock.c encoder/cabac.c \
11        encoder/cavlc.c encoder/encoder.c encoder/eval.c
12
13 # Visualization sources
14 ifeq ($(VIS),yes)
15 SRCS   += common/visualize.c common/display-x11.c
16 endif
17
18 # MMX/SSE optims
19 ifeq ($(ARCH),X86)
20 SRCS   += common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c
21 ASMSRC  = common/i386/dct-a.asm common/i386/cpu-a.asm \
22           common/i386/pixel-a.asm common/i386/mc-a.asm \
23           common/i386/mc-a2.asm common/i386/predict-a.asm \
24           common/i386/pixel-sse2.asm common/i386/quant-a.asm \
25           common/i386/deblock-a.asm
26 OBJASM  = $(ASMSRC:%.asm=%.o)
27 endif
28
29 # MMX/SSE optims
30 ifeq ($(ARCH),X86_64)
31 SRCS   += common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c
32 ASMSRC  = common/amd64/dct-a.asm common/amd64/cpu-a.asm \
33           common/amd64/pixel-a.asm common/amd64/mc-a.asm \
34           common/amd64/mc-a2.asm common/amd64/predict-a.asm \
35           common/amd64/pixel-sse2.asm common/amd64/quant-a.asm \
36           common/amd64/deblock-a.asm
37 OBJASM  = $(ASMSRC:%.asm=%.o)
38 ASFLAGS += -Icommon/amd64
39 endif
40
41 # AltiVec optims
42 ifeq ($(ARCH),PPC)
43 SRCS += common/ppc/mc.c common/ppc/pixel.c common/ppc/dct.c
44 endif
45
46 # VIS optims
47 ifeq ($(ARCH),UltraSparc)
48 ASMSRC += common/sparc/pixel.asm
49 OBJASM  = $(ASMSRC:%.asm=%.o)
50 endif
51
52 ifneq ($(HAVE_GETOPT_LONG),1)
53 SRCS += extras/getopt.c
54 CFLAGS += -DHAVE_GETOPT_LONG=0
55 else
56 CFLAGS += -DHAVE_GETOPT_LONG=1
57 endif
58
59 OBJS = $(SRCS:%.c=%.o)
60 DEP  = depend
61
62 default: $(DEP) x264$(EXE)
63
64 libx264.a: .depend $(OBJS) $(OBJASM)
65         ar rc libx264.a $(OBJS) $(OBJASM)
66         ranlib libx264.a
67
68 x264$(EXE): libx264.a x264.o matroska.o
69         $(CC) -o $@ x264.o matroska.o libx264.a $(LDFLAGS)
70
71 x264vfw.dll: libx264.a $(wildcard vfw/*.c vfw/*.h)
72         make -C vfw/build/cygwin
73
74 checkasm: tools/checkasm.o libx264.a
75         $(CC) -o $@ $< libx264.a $(LDFLAGS)
76
77 common/amd64/*.o: common/amd64/amd64inc.asm
78 %.o: %.asm
79         $(AS) $(ASFLAGS) -o $@ $<
80
81 .depend: config.mak config.h
82         rm -f .depend
83 # Hacky - because gcc 2.9x doesn't have -MT
84         $(foreach SRC, $(SRCS) x264.c matroska.c, ( echo -n "`dirname $(SRC)`/" && $(CC) $(CFLAGS) $(SRC) -MM -g0 ) 1>> .depend;)
85
86 config.h: $(wildcard .svn/entries */.svn/entries */*/.svn/entries)
87         ./version.sh
88
89 depend: .depend
90 ifneq ($(wildcard .depend),)
91 include .depend
92 endif
93
94 clean:
95         rm -f $(OBJS) $(OBJASM) config.h *.a x264.o matroska.o x264 x264.exe .depend TAGS
96         rm -f checkasm checkasm.exe tools/checkasm.o
97         rm -f tools/avc2avi tools/avc2avi.exe tools/avc2avi.o
98         rm -rf vfw/build/cygwin/bin
99
100 distclean: clean
101         rm -f config.mak vfw/build/cygwin/config.mak
102
103 install: x264
104         install -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
105         install -m 644 x264.h $(DESTDIR)$(includedir)
106         install -m 644 libx264.a $(DESTDIR)$(libdir)
107         install x264 $(DESTDIR)$(bindir)
108         ranlib $(DESTDIR)$(libdir)/libx264.a
109
110 etags: TAGS
111
112 TAGS:
113         etags $(SRCS)