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