Commit 8e44d938 authored by Loren Merritt's avatar Loren Merritt

`make fprofiled` to automate gcc -fprofile-generate/use



git-svn-id: svn://svn.videolan.org/x264/trunk@378 df754926-b1dd-0310-bc7b-ec298dee348c
parent 71b75efe
...@@ -59,6 +59,7 @@ endif ...@@ -59,6 +59,7 @@ endif
OBJS = $(SRCS:%.c=%.o) OBJS = $(SRCS:%.c=%.o)
DEP = depend DEP = depend
.PHONY: default fprofiled clean distclean install uninstall
default: $(DEP) x264$(EXE) default: $(DEP) x264$(EXE)
libx264.a: .depend $(OBJS) $(OBJASM) libx264.a: .depend $(OBJS) $(OBJASM)
...@@ -91,11 +92,37 @@ ifneq ($(wildcard .depend),) ...@@ -91,11 +92,37 @@ ifneq ($(wildcard .depend),)
include .depend include .depend
endif endif
SRC2 = $(SRCS) x264.c matroska.c
# These should cover most of the important codepaths
OPT0 = --crf 30 -b1 -m1 -r1 --me dia --no-cabac
OPT1 = --crf 18 -b2 -m3 -r3 --me hex -8 --cqm jvt --direct spatial
OPT2 = --crf 24 -b3 -m6 -r6 --me umh -8 -w -t1 -A all --b-pyramid --b-rdo --mixed-refs
ifeq (,$(VIDS))
fprofiled:
@echo 'usage: make fprofiled VIDS="infile1 infile2 ..."'
@echo 'where infiles are anything that x264 understands,'
@echo 'i.e. YUV with resolution in the filename, or avisynth.'
else
fprofiled:
make clean
sed -i -e 's/CFLAGS.*/& -fprofile-generate/; s/LDFLAGS.*/& -fprofile-generate/' config.mak
make x264$(EXE)
$(foreach V, $(VIDS), $(foreach I, 0 1 2, ./x264$(EXE) $(OPT$I) $(V) --progress -o $(DEVNULL) ;))
rm -f $(SRC2:%.c=%.o)
sed -i -e 's/-fprofile-generate/-fprofile-use/' config.mak
make
rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno)
sed -i -e 's/ *-fprofile-\(generate\|use\)//g' config.mak
endif
clean: clean:
rm -f $(OBJS) $(OBJASM) config.h *.a x264.o matroska.o x264 x264.exe .depend TAGS x264.pc rm -f $(OBJS) $(OBJASM) config.h *.a x264.o matroska.o x264 x264.exe .depend TAGS x264.pc
rm -f checkasm checkasm.exe tools/checkasm.o rm -f checkasm checkasm.exe tools/checkasm.o
rm -f tools/avc2avi tools/avc2avi.exe tools/avc2avi.o rm -f tools/avc2avi tools/avc2avi.exe tools/avc2avi.o
rm -rf vfw/build/cygwin/bin rm -rf vfw/build/cygwin/bin
rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno)
- sed -i -e 's/ *-fprofile-\(generate\|use\)//g' config.mak
distclean: clean distclean: clean
rm -f config.mak vfw/build/cygwin/config.mak rm -f config.mak vfw/build/cygwin/config.mak
...@@ -109,7 +136,6 @@ install: x264 ...@@ -109,7 +136,6 @@ install: x264
install x264 $(DESTDIR)$(bindir) install x264 $(DESTDIR)$(bindir)
ranlib $(DESTDIR)$(libdir)/libx264.a ranlib $(DESTDIR)$(libdir)/libx264.a
.PHONY: uninstall
uninstall: uninstall:
rm -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(libdir)/libx264.a rm -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(libdir)/libx264.a
rm -f $(DESTDIR)$(bindir)/x264 $(DESTDIR)$(libdir)/pkgconfig/x264.pc rm -f $(DESTDIR)$(bindir)/x264 $(DESTDIR)$(libdir)/pkgconfig/x264.pc
......
...@@ -26,6 +26,7 @@ exec_prefix='${prefix}' ...@@ -26,6 +26,7 @@ exec_prefix='${prefix}'
bindir='${exec_prefix}/bin' bindir='${exec_prefix}/bin'
libdir='${exec_prefix}/lib' libdir='${exec_prefix}/lib'
includedir='${prefix}/include' includedir='${prefix}/include'
DEVNULL='/dev/null'
avis_input="no" avis_input="no"
mp4_output="no" mp4_output="no"
...@@ -75,11 +76,13 @@ case "$UNAMES" in ...@@ -75,11 +76,13 @@ case "$UNAMES" in
LDFLAGS="$LDFLAGS -mno-cygwin" LDFLAGS="$LDFLAGS -mno-cygwin"
ASFLAGS="-f win32 -DPREFIX" ASFLAGS="-f win32 -DPREFIX"
EXE=".exe" EXE=".exe"
DEVNULL="NUL"
;; ;;
MINGW*) MINGW*)
SYS="MINGW" SYS="MINGW"
ASFLAGS="-f win32 -DPREFIX" ASFLAGS="-f win32 -DPREFIX"
EXE=".exe" EXE=".exe"
DEVNULL="NUL"
;; ;;
SunOS) SunOS)
SYS="SunOS" SYS="SunOS"
...@@ -258,6 +261,7 @@ VFW=$vfw ...@@ -258,6 +261,7 @@ VFW=$vfw
EXE=$EXE EXE=$EXE
VIS=$vis VIS=$vis
HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
DEVNULL=$DEVNULL
EOF EOF
if [ "$vfw" = "yes" ]; then if [ "$vfw" = "yes" ]; then
...@@ -295,5 +299,5 @@ echo "debug: $debug" ...@@ -295,5 +299,5 @@ echo "debug: $debug"
echo "gprof: $gprof" echo "gprof: $gprof"
echo "visualize: $vis" echo "visualize: $vis"
echo echo
echo "You can run 'make' now." echo "You can run 'make' or 'make fprofiled' now."
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment