From e204b001cfa33e36eb06bc9d2437d75fc4efafe8 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 18 Nov 2014 12:43:09 -0500 Subject: Makefile: have perl scripts depend on NO_PERL setting If NO_PERL is not set, our perl scripts are built as usual. If it is set, then we build "dummy" versions that tell you git was built without perl support and exit gracefully. However, if you switch to NO_PERL in a directory with existing build artifacts, we do not notice that the files need rebuilt. We see only that they are newer than the "unimplemented.sh" wrapper and assume they are done. So doing: make make NO_PERL=Nope would result in a git-add--interactive script that uses perl (and running the test suite would make use of it). Instead, we should trigger a rebuild of the perl scripts anytime NO_PERL changes. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 9f984a9e55..4d1639ddc9 100644 --- a/Makefile +++ b/Makefile @@ -1801,6 +1801,9 @@ git.res: git.rc GIT-VERSION-FILE $(join -DMAJOR= -DMINOR=, $(wordlist 1,2,$(subst -, ,$(subst ., ,$(GIT_VERSION))))) \ -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" $< -o $@ +# This makes sure we depend on the NO_PERL setting itself. +$(patsubst %.perl,%,$(SCRIPT_PERL)): GIT-BUILD-OPTIONS + ifndef NO_PERL $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak -- cgit v1.2.3 From 64c07db9ad98fdeb43e739bdabd4cc423b10c272 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Tue, 18 Nov 2014 10:38:38 -0800 Subject: Makefile: simplify by using SCRIPT_{PERL,SH}_GEN macros SCRIPT_PERL_GEN is defined as $(patsubst %.perl,%,$(SCRIPT_PERL)) for use in targets like build-perl-script used by makefiles in subdirectories that override SCRIPT_PERL (see v1.8.2-rc0~17^2, "git-remote-mediawiki: use toplevel's Makefile", 2013-02-08). The same expression is used in the rules that actually write the generated perl scripts, and since these rules were introduced before SCRIPT_PERL_GEN, they use the longhand instead of that macro. Use the macro to make reading easier. Likewise for SCRIPT_SH_GEN. The Python rules already got the same simplification in v1.8.4-rc0~162^2~8 (2013-05-24). Signed-off-by: Jonathan Nieder Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 4d1639ddc9..dcaf824620 100644 --- a/Makefile +++ b/Makefile @@ -1787,7 +1787,7 @@ GIT-SCRIPT-DEFINES: FORCE fi -$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh GIT-SCRIPT-DEFINES +$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES $(QUIET_GEN)$(cmd_munge_script) && \ chmod +x $@+ && \ mv $@+ $@ @@ -1802,10 +1802,10 @@ git.res: git.rc GIT-VERSION-FILE -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" $< -o $@ # This makes sure we depend on the NO_PERL setting itself. -$(patsubst %.perl,%,$(SCRIPT_PERL)): GIT-BUILD-OPTIONS +$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS ifndef NO_PERL -$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak +$(SCRIPT_PERL_GEN): perl/perl.mak perl/perl.mak: perl/PM.stamp @@ -1818,7 +1818,7 @@ perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F) PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ) -$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE +$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE $(QUIET_GEN)$(RM) $@ $@+ && \ INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \ INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \ @@ -1852,7 +1852,7 @@ git-instaweb: git-instaweb.sh gitweb GIT-SCRIPT-DEFINES chmod +x $@+ && \ mv $@+ $@ else # NO_PERL -$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh +$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh $(QUIET_GEN)$(RM) $@ $@+ && \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \ -- cgit v1.2.3 From ca2051d6e3a7cf1d562d9dd1e465766d30093b0b Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Tue, 18 Nov 2014 10:43:47 -0800 Subject: Makefile: have python scripts depend on NO_PYTHON setting Like the perl scripts, python scripts need a dependency to ensure they are rebuilt when switching between the "dummy" versions that run without Python and the real thing. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index dcaf824620..e3cab52154 100644 --- a/Makefile +++ b/Makefile @@ -1861,6 +1861,9 @@ $(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh mv $@+ $@ endif # NO_PERL +# This makes sure we depend on the NO_PYTHON setting itself. +$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS + ifndef NO_PYTHON $(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS $(SCRIPT_PYTHON_GEN): % : %.py -- cgit v1.2.3