]> git.sesse.net Git - x264/blob - Makefile
x264.h: issue an explicit warning when neither stdint.h nor inttypes.h
[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        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 # VIS optims
41 ifeq ($(ARCH),UltraSparc)
42 ASMSRC += common/sparc/pixel.asm
43 OBJASM  = $(ASMSRC:%.asm=%.o)
44 endif
45
46 ifneq ($(HAVE_GETOPT_LONG),1)
47 SRCS += extras/getopt.c
48 CFLAGS += -DHAVE_GETOPT_LONG=0
49 else
50 CFLAGS += -DHAVE_GETOPT_LONG=1
51 endif
52
53 OBJS = $(SRCS:%.c=%.o)
54 DEP  = depend
55
56 default: $(DEP) x264$(EXE)
57
58 libx264.a: .depend $(OBJS) $(OBJASM)
59         ar rc libx264.a $(OBJS) $(OBJASM)
60         ranlib libx264.a
61
62 x264$(EXE): libx264.a x264.o matroska.o
63         $(CC) -o $@ x264.o matroska.o libx264.a $(LDFLAGS)
64
65 x264vfw.dll: libx264.a $(wildcard vfw/*.c vfw/*.h)
66         make -C vfw/build/cygwin
67
68 checkasm: testing/checkasm.o libx264.a
69         $(CC) -o $@ $< libx264.a $(LDFLAGS)
70
71 %.o: %.asm
72         $(AS) $(ASFLAGS) -o $@ $<
73
74 .depend: config.mak config.h
75         rm -f .depend
76 # Hacky - because gcc 2.9x doesn't have -MT
77         $(foreach SRC, $(SRCS) x264.c matroska.c, ( echo -n "`dirname $(SRC)`/" && $(CC) $(CFLAGS) $(SRC) -MM -g0 ) 1>> .depend;)
78
79 config.h: $(wildcard .svn/entries */.svn/entries */*/.svn/entries)
80         ./version.sh
81
82 depend: .depend
83 ifneq ($(wildcard .depend),)
84 include .depend
85 endif
86
87 clean:
88         rm -f $(OBJS) $(OBJASM) config.h *.a x264.o matroska.o x264 x264.exe .depend TAGS
89         rm -rf vfw/build/cygwin/bin
90
91 distclean: clean
92         rm -f config.mak vfw/build/cygwin/config.mak
93
94 install: x264
95         install -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
96         install -m 644 x264.h $(DESTDIR)$(includedir)
97         install -m 644 libx264.a $(DESTDIR)$(libdir)
98         install x264 $(DESTDIR)$(bindir)
99         ranlib $(DESTDIR)$(libdir)/libx264.a
100
101 etags: TAGS
102
103 TAGS:
104         etags $(SRCS)