From 8e44d938b225c0a4dabad257b471335fdd0fe18d Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Mon, 28 Nov 2005 00:29:10 +0000 Subject: [PATCH] `make fprofiled` to automate gcc -fprofile-generate/use git-svn-id: svn://svn.videolan.org/x264/trunk@378 df754926-b1dd-0310-bc7b-ec298dee348c --- Makefile | 28 +++++++++++++++++++++++++++- configure | 6 +++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 65b93c41..72befd9d 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,7 @@ endif OBJS = $(SRCS:%.c=%.o) DEP = depend +.PHONY: default fprofiled clean distclean install uninstall default: $(DEP) x264$(EXE) libx264.a: .depend $(OBJS) $(OBJASM) @@ -91,11 +92,37 @@ ifneq ($(wildcard .depend),) include .depend 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: 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 tools/avc2avi tools/avc2avi.exe tools/avc2avi.o 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 rm -f config.mak vfw/build/cygwin/config.mak @@ -109,7 +136,6 @@ install: x264 install x264 $(DESTDIR)$(bindir) ranlib $(DESTDIR)$(libdir)/libx264.a -.PHONY: uninstall uninstall: rm -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(libdir)/libx264.a rm -f $(DESTDIR)$(bindir)/x264 $(DESTDIR)$(libdir)/pkgconfig/x264.pc diff --git a/configure b/configure index 943ea2cf..c578b839 100755 --- a/configure +++ b/configure @@ -26,6 +26,7 @@ exec_prefix='${prefix}' bindir='${exec_prefix}/bin' libdir='${exec_prefix}/lib' includedir='${prefix}/include' +DEVNULL='/dev/null' avis_input="no" mp4_output="no" @@ -75,11 +76,13 @@ case "$UNAMES" in LDFLAGS="$LDFLAGS -mno-cygwin" ASFLAGS="-f win32 -DPREFIX" EXE=".exe" + DEVNULL="NUL" ;; MINGW*) SYS="MINGW" ASFLAGS="-f win32 -DPREFIX" EXE=".exe" + DEVNULL="NUL" ;; SunOS) SYS="SunOS" @@ -258,6 +261,7 @@ VFW=$vfw EXE=$EXE VIS=$vis HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG +DEVNULL=$DEVNULL EOF if [ "$vfw" = "yes" ]; then @@ -295,5 +299,5 @@ echo "debug: $debug" echo "gprof: $gprof" echo "visualize: $vis" echo -echo "You can run 'make' now." +echo "You can run 'make' or 'make fprofiled' now." -- 2.40.0