]> git.sesse.net Git - x264/blob - Makefile
ec3f3dcb5fcc2d52f7eada2ba9487018bf374488
[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 \
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 # Visualization sources
13 ifeq ($(VIS),yes)
14 SRCS   += common/visualize.c common/display-x11.c
15 endif
16
17 # MMX/SSE optims
18 ifeq ($(ARCH),X86)
19 SRCS   += common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c
20 ASMSRC  = common/i386/dct-a.asm common/i386/cpu-a.asm \
21           common/i386/pixel-a.asm common/i386/mc-a.asm \
22           common/i386/mc-a2.asm common/i386/predict-a.asm
23 OBJASM  = $(ASMSRC:%.asm=%.o)
24 endif
25
26 # MMX/SSE optims
27 ifeq ($(ARCH),X86_64)
28 SRCS   += common/i386/mc-c.c common/i386/dct-c.c common/i386/predict.c
29 ASMSRC  = common/amd64/dct-a.asm common/amd64/cpu-a.asm \
30           common/amd64/pixel-a.asm common/amd64/mc-a.asm \
31           common/amd64/mc-a2.asm common/amd64/predict-a.asm
32 OBJASM  = $(ASMSRC:%.asm=%.o)
33 endif
34
35 # AltiVec optims
36 ifeq ($(ARCH),PPC)
37 SRCS += common/ppc/mc.c common/ppc/pixel.c common/ppc/dct.c
38 endif
39
40 OBJS = $(SRCS:%.c=%.o)
41 DEP  = depend
42
43 default: $(DEP) x264$(EXE)
44
45 libx264.a: .depend $(OBJS) $(OBJASM)
46         ar rc libx264.a $(OBJS) $(OBJASM)
47         ranlib libx264.a
48
49 x264$(EXE): libx264.a x264.o
50         $(CC) -o $@ x264.o libx264.a $(LDFLAGS)
51
52 x264vfw.dll: libx264.a $(wildcard vfw/*.c vfw/*.h)
53         make -C vfw/build/cygwin
54
55 checkasm: testing/checkasm.o libx264.a
56         $(CC) -o $@ $< libx264.a $(LDFLAGS)
57
58 %.o: %.asm
59         $(AS) $(ASFLAGS) -o $@ $<
60
61 .depend: config.mak config.h
62         rm -f .depend
63 # Hacky - because gcc 2.9x doesn't have -MT
64         $(foreach SRC, $(SRCS) x264.c, ( echo -n "`dirname $(SRC)`/" && $(CC) $(CFLAGS) $(SRC) -MM -g0 ) 1>> .depend;)
65
66 config.h: $(wildcard .svn/entries */.svn/entries */*/.svn/entries)
67         ./version.sh
68
69 depend: .depend
70 ifneq ($(wildcard .depend),)
71 include .depend
72 endif
73
74 clean:
75         rm -f $(OBJS) $(OBJASM) config.h *.a x264.o x264 x264.exe .depend TAGS
76         rm -rf vfw/build/cygwin/bin
77
78 distclean: clean
79         rm -f config.mak vfw/build/cygwin/config.mak
80
81 DIR_INSTALL="/usr/local"
82 install: x264
83         install -d $(DIR_INSTALL)/include $(DIR_INSTALL)/lib $(DIR_INSTALL)/bin
84         install x264.h $(DIR_INSTALL)/include/
85         install libx264.a $(DIR_INSTALL)/lib/
86         install x264 $(DIR_INSTALL)/bin/
87
88 etags: TAGS
89
90 TAGS:
91         etags $(SRCS)