Merge branch 'tt/profile-build-fix'
* tt/profile-build-fix: Makefile: fix syntax for older make Fix build problems related to profile-directed optimizationmaint
commit
6ff63d9f87
17
INSTALL
17
INSTALL
|
@ -28,16 +28,25 @@ set up install paths (via config.mak.autogen), so you can write instead
|
||||||
If you're willing to trade off (much) longer build time for a later
|
If you're willing to trade off (much) longer build time for a later
|
||||||
faster git you can also do a profile feedback build with
|
faster git you can also do a profile feedback build with
|
||||||
|
|
||||||
$ make profile-all
|
$ make prefix=/usr PROFILE=BUILD all
|
||||||
# make prefix=... install
|
# make prefix=/usr PROFILE=BUILD install
|
||||||
|
|
||||||
This will run the complete test suite as training workload and then
|
This will run the complete test suite as training workload and then
|
||||||
rebuild git with the generated profile feedback. This results in a git
|
rebuild git with the generated profile feedback. This results in a git
|
||||||
which is a few percent faster on CPU intensive workloads. This
|
which is a few percent faster on CPU intensive workloads. This
|
||||||
may be a good tradeoff for distribution packagers.
|
may be a good tradeoff for distribution packagers.
|
||||||
|
|
||||||
Note that the profile feedback build stage currently generates
|
Or if you just want to install a profile-optimized version of git into
|
||||||
a lot of additional compiler warnings.
|
your home directory, you could run:
|
||||||
|
|
||||||
|
$ make PROFILE=BUILD install
|
||||||
|
|
||||||
|
As a caveat: a profile-optimized build takes a *lot* longer since the
|
||||||
|
git tree must be built twice, and in order for the profiling
|
||||||
|
measurements to work properly, ccache must be disabled and the test
|
||||||
|
suite has to be run using only a single CPU. In addition, the profile
|
||||||
|
feedback build stage currently generates a lot of additional compiler
|
||||||
|
warnings.
|
||||||
|
|
||||||
Issues of note:
|
Issues of note:
|
||||||
|
|
||||||
|
|
55
Makefile
55
Makefile
|
@ -1777,6 +1777,26 @@ ifdef ASCIIDOC7
|
||||||
export ASCIIDOC7
|
export ASCIIDOC7
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
### profile feedback build
|
||||||
|
#
|
||||||
|
|
||||||
|
# Can adjust this to be a global directory if you want to do extended
|
||||||
|
# data gathering
|
||||||
|
PROFILE_DIR := $(CURDIR)
|
||||||
|
|
||||||
|
ifeq ("$(PROFILE)","GEN")
|
||||||
|
CFLAGS += -fprofile-generate=$(PROFILE_DIR) -DNO_NORETURN=1
|
||||||
|
EXTLIBS += -lgcov
|
||||||
|
export CCACHE_DISABLE=t
|
||||||
|
V=1
|
||||||
|
else
|
||||||
|
ifneq ("$(PROFILE)","")
|
||||||
|
CFLAGS += -fprofile-use=$(PROFILE_DIR) -fprofile-correction -DNO_NORETURN=1
|
||||||
|
export CCACHE_DISABLE=t
|
||||||
|
V=1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# Shell quote (do not use $(call) to accommodate ancient setups);
|
# Shell quote (do not use $(call) to accommodate ancient setups);
|
||||||
|
|
||||||
SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
|
SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
|
||||||
|
@ -1833,7 +1853,17 @@ export DIFF TAR INSTALL DESTDIR SHELL_PATH
|
||||||
|
|
||||||
SHELL = $(SHELL_PATH)
|
SHELL = $(SHELL_PATH)
|
||||||
|
|
||||||
all:: shell_compatibility_test $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
|
all:: shell_compatibility_test
|
||||||
|
|
||||||
|
ifeq "$(PROFILE)" "BUILD"
|
||||||
|
ifeq ($(filter all,$(MAKECMDGOALS)),all)
|
||||||
|
all:: profile-clean
|
||||||
|
$(MAKE) PROFILE=GEN all
|
||||||
|
$(MAKE) PROFILE=GEN -j1 test
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
all:: $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
|
||||||
ifneq (,$X)
|
ifneq (,$X)
|
||||||
$(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
|
$(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
|
||||||
endif
|
endif
|
||||||
|
@ -2581,7 +2611,11 @@ distclean: clean
|
||||||
$(RM) configure
|
$(RM) configure
|
||||||
$(RM) po/git.pot
|
$(RM) po/git.pot
|
||||||
|
|
||||||
clean:
|
profile-clean:
|
||||||
|
$(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
|
||||||
|
$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
|
||||||
|
|
||||||
|
clean: profile-clean
|
||||||
$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
|
$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
|
||||||
builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
|
builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
|
||||||
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
|
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
|
||||||
|
@ -2611,7 +2645,7 @@ ifndef NO_TCLTK
|
||||||
endif
|
endif
|
||||||
$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
|
$(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-LDFLAGS GIT-GUI-VARS GIT-BUILD-OPTIONS
|
||||||
|
|
||||||
.PHONY: all install clean strip
|
.PHONY: all install profile-clean clean strip
|
||||||
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
|
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
|
||||||
.PHONY: FORCE cscope
|
.PHONY: FORCE cscope
|
||||||
|
|
||||||
|
@ -2721,18 +2755,3 @@ cover_db: coverage-report
|
||||||
cover_db_html: cover_db
|
cover_db_html: cover_db
|
||||||
cover -report html -outputdir cover_db_html cover_db
|
cover -report html -outputdir cover_db_html cover_db
|
||||||
|
|
||||||
### profile feedback build
|
|
||||||
#
|
|
||||||
.PHONY: profile-all profile-clean
|
|
||||||
|
|
||||||
PROFILE_GEN_CFLAGS := $(CFLAGS) -fprofile-generate -DNO_NORETURN=1
|
|
||||||
PROFILE_USE_CFLAGS := $(CFLAGS) -fprofile-use -fprofile-correction -DNO_NORETURN=1
|
|
||||||
|
|
||||||
profile-clean:
|
|
||||||
$(RM) $(addsuffix *.gcda,$(object_dirs))
|
|
||||||
$(RM) $(addsuffix *.gcno,$(object_dirs))
|
|
||||||
|
|
||||||
profile-all: profile-clean
|
|
||||||
$(MAKE) CFLAGS="$(PROFILE_GEN_CFLAGS)" all
|
|
||||||
$(MAKE) CFLAGS="$(PROFILE_GEN_CFLAGS)" -j1 test
|
|
||||||
$(MAKE) CFLAGS="$(PROFILE_USE_CFLAGS)" all
|
|
||||||
|
|
Loading…
Reference in New Issue