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/set.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
13
SRCCLI = x264.c matroska.c muxers.c
15
# Visualization sources
17
SRCS += common/visualize.c common/display-x11.c
23
SRCS += common/i386/mc-c.c common/i386/predict-c.c
24
ASMSRC = common/i386/dct-a.asm common/i386/cpu-a.asm \
25
common/i386/pixel-a.asm common/i386/mc-a.asm \
26
common/i386/mc-a2.asm common/i386/predict-a.asm \
27
common/i386/pixel-sse2.asm common/i386/quant-a.asm \
28
common/i386/deblock-a.asm
29
OBJASM = $(ASMSRC:%.asm=%.o)
30
ASFLAGS += -Icommon/i386/
37
SRCS += common/i386/mc-c.c common/i386/predict-c.c
38
ASMSRC = common/amd64/dct-a.asm common/amd64/cpu-a.asm \
39
common/amd64/pixel-a.asm common/amd64/mc-a.asm \
40
common/amd64/mc-a2.asm common/amd64/predict-a.asm \
41
common/amd64/pixel-sse2.asm common/amd64/quant-a.asm \
42
common/amd64/deblock-a.asm
43
OBJASM = $(ASMSRC:%.asm=%.o)
44
ASFLAGS += -Icommon/amd64
50
ALTIVECSRC += common/ppc/mc.c common/ppc/pixel.c common/ppc/dct.c \
51
common/ppc/quant.c common/ppc/deblock.c \
54
$(ALTIVECSRC:%.c=%.o): CFLAGS += $(ALTIVECFLAGS)
58
ifeq ($(ARCH),UltraSparc)
59
ASMSRC += common/sparc/pixel.asm
60
OBJASM = $(ASMSRC:%.asm=%.o)
63
ifneq ($(HAVE_GETOPT_LONG),1)
64
SRCS += extras/getopt.c
67
OBJS = $(SRCS:%.c=%.o)
68
OBJCLI = $(SRCCLI:%.c=%.o)
71
.PHONY: all default fprofiled clean distclean install install-gtk uninstall dox test testclean
74
default: $(DEP) x264$(EXE)
76
libx264.a: .depend $(OBJS) $(OBJASM)
77
ar rc libx264.a $(OBJS) $(OBJASM)
80
$(SONAME): .depend $(OBJS) $(OBJASM)
81
$(CC) -shared -o $@ $(OBJS) $(OBJASM) -Wl,-soname,$(SONAME) $(LDFLAGS)
83
x264$(EXE): $(OBJCLI) libx264.a
84
$(CC) -o $@ $+ $(LDFLAGS)
86
libx264gtk.a: muxers.o libx264.a
89
checkasm: tools/checkasm.o libx264.a
90
$(CC) -o $@ $+ $(LDFLAGS)
92
common/amd64/*.o: common/amd64/amd64inc.asm
93
common/i386/*.o: common/i386/i386inc.asm
95
$(AS) $(ASFLAGS) -o $@ $<
96
# delete local/anonymous symbols, so they don't show up in oprofile
101
# Hacky - because gcc 2.9x doesn't have -MT
102
$(foreach SRC, $(SRCS) $(SRCCLI), ( $(ECHON) "`dirname $(SRC)`/" && $(CC) $(CFLAGS) $(ALTIVECFLAGS) $(SRC) -MM -g0 ) 1>> .depend;)
104
config.mak: $(wildcard .svn/entries */.svn/entries */*/.svn/entries)
105
./configure $(CONFIGURE_ARGS)
108
ifneq ($(wildcard .depend),)
112
SRC2 = $(SRCS) $(SRCCLI)
113
# These should cover most of the important codepaths
114
OPT0 = --crf 30 -b1 -m1 -r1 --me dia --no-cabac --pre-scenecut --direct temporal --no-ssim --no-psnr
115
OPT1 = --crf 16 -b2 -m3 -r3 --me hex -8 --direct spatial --no-dct-decimate
116
OPT2 = --crf 26 -b2 -m5 -r2 --me hex -8 -w --cqm jvt --nr 100
117
OPT3 = --crf 18 -b3 -m7 -r5 --me umh -8 -t1 -A all --mixed-refs --b-rdo -w --b-pyramid --direct auto --bime --no-fast-pskip
118
OPT4 = --crf 22 -b3 -m6 -r3 --me esa -8 -t2 -A all --mixed-refs --b-rdo --bime
122
@echo 'usage: make fprofiled VIDS="infile1 infile2 ..."'
123
@echo 'where infiles are anything that x264 understands,'
124
@echo 'i.e. YUV with resolution in the filename, y4m, or avisynth.'
128
mv config.mak config.mak2
129
sed -e 's/CFLAGS.*/& -fprofile-generate/; s/LDFLAGS.*/& -fprofile-generate/' config.mak2 > config.mak
131
$(foreach V, $(VIDS), $(foreach I, 0 1 2 3 4, ./x264$(EXE) $(OPT$I) $(V) --progress -o $(DEVNULL) ;))
132
rm -f $(SRC2:%.c=%.o)
133
sed -e 's/CFLAGS.*/& -fprofile-use/; s/LDFLAGS.*/& -fprofile-use/' config.mak2 > config.mak
135
rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno)
136
mv config.mak2 config.mak
140
rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(SONAME) *.a x264 x264.exe .depend TAGS
141
rm -f checkasm checkasm.exe tools/checkasm.o
142
rm -f tools/avc2avi tools/avc2avi.exe tools/avc2avi.o
143
rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno)
144
- sed -e 's/ *-fprofile-\(generate\|use\)//g' config.mak > config.mak2 && mv config.mak2 config.mak
148
rm -f config.mak config.h x264.pc
150
$(MAKE) -C gtk distclean
152
install: x264 $(SONAME)
153
install -d $(DESTDIR)$(bindir) $(DESTDIR)$(includedir)
154
install -d $(DESTDIR)$(libdir) $(DESTDIR)$(libdir)/pkgconfig
155
install -m 644 x264.h $(DESTDIR)$(includedir)
156
install -m 644 libx264.a $(DESTDIR)$(libdir)
157
install -m 644 x264.pc $(DESTDIR)$(libdir)/pkgconfig
158
install x264 $(DESTDIR)$(bindir)
159
ranlib $(DESTDIR)$(libdir)/libx264.a
160
$(if $(SONAME), ln -sf $(SONAME) $(DESTDIR)$(libdir)/libx264.so)
161
$(if $(SONAME), install -m 755 $(SONAME) $(DESTDIR)$(libdir))
163
install-gtk: libx264gtk.a
164
$(MAKE) -C gtk install
167
rm -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(libdir)/libx264.a
168
rm -f $(DESTDIR)$(bindir)/x264 $(DESTDIR)$(libdir)/pkgconfig/x264.pc
169
$(if $(SONAME), rm -f $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.so)
170
$(MAKE) -C gtk uninstall
182
@echo 'usage: make test VIDS="infile1 infile2 ..."'
183
@echo 'where infiles are anything that x264 understands,'
184
@echo 'i.e. YUV with resolution in the filename, y4m, or avisynth.'
187
perl tools/regression-test.pl --version=head,current --options='$(OPT0)' --options='$(OPT1)' --options='$(OPT2)' $(VIDS:%=--input=%)
191
rm -f test/*.log test/*.264
192
$(foreach DIR, $(wildcard test/x264-r*/), cd $(DIR) ; make clean ; cd ../.. ;)