git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH 1/4] Makefile: extract perl-related rules to make them available from other dirs
Date: Wed,  6 Feb 2013 19:11:29 +0100	[thread overview]
Message-ID: <1360174292-14793-2-git-send-email-Matthieu.Moy@imag.fr> (raw)
In-Reply-To: <1360174292-14793-1-git-send-email-Matthieu.Moy@imag.fr>

The final goal is to make it easy to write Git commands in perl in the
contrib/ directory. It is currently possible to do so, but without the
benefits of Git's Makefile: adapt first line with $(PERL_PATH),
hardcode the path to Git.pm, ...

We make the perl-related part of the Makefile available from directories
other than the toplevel so that:

* Developers can include it, to avoid code duplication

* Users can get a consistent behavior of "make install"

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 Makefile | 46 +---------------------------------------------
 perl.mak | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 45 deletions(-)
 create mode 100644 perl.mak

diff --git a/Makefile b/Makefile
index 731b6a8..f39d4a9 100644
--- a/Makefile
+++ b/Makefile
@@ -573,14 +573,10 @@ BINDIR_PROGRAMS_NO_X += git-cvsserver
 ifndef SHELL_PATH
 	SHELL_PATH = /bin/sh
 endif
-ifndef PERL_PATH
-	PERL_PATH = /usr/bin/perl
-endif
 ifndef PYTHON_PATH
 	PYTHON_PATH = /usr/bin/python
 endif
 
-export PERL_PATH
 export PYTHON_PATH
 
 LIB_FILE = libgit.a
@@ -1441,10 +1437,6 @@ ifeq ($(TCLTK_PATH),)
 NO_TCLTK = NoThanks
 endif
 
-ifeq ($(PERL_PATH),)
-NO_PERL = NoThanks
-endif
-
 ifeq ($(PYTHON_PATH),)
 NO_PYTHON = NoThanks
 endif
@@ -1522,7 +1514,6 @@ prefix_SQ = $(subst ','\'',$(prefix))
 gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
 
 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
-PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
 PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
 TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
 DIFF_SQ = $(subst ','\'',$(DIFF))
@@ -1715,9 +1706,6 @@ $(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
 	$(QUIET_GEN)$(cmd_munge_script) && \
 	mv $@+ $@
 
-ifndef NO_PERL
-$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
-
 perl/perl.mak: perl/PM.stamp
 
 perl/PM.stamp: FORCE
@@ -1728,39 +1716,7 @@ perl/PM.stamp: FORCE
 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)
 
-$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl GIT-VERSION-FILE
-	$(QUIET_GEN)$(RM) $@ $@+ && \
-	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
-	sed -e '1{' \
-	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
-	    -e '	h' \
-	    -e '	s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'"));=' \
-	    -e '	H' \
-	    -e '	x' \
-	    -e '}' \
-	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-	    $@.perl >$@+ && \
-	chmod +x $@+ && \
-	mv $@+ $@
-
-
-.PHONY: gitweb
-gitweb:
-	$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
-
-git-instaweb: git-instaweb.sh gitweb GIT-SCRIPT-DEFINES
-	$(QUIET_GEN)$(cmd_munge_script) && \
-	chmod +x $@+ && \
-	mv $@+ $@
-else # NO_PERL
-$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
-	$(QUIET_GEN)$(RM) $@ $@+ && \
-	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-	    -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
-	    unimplemented.sh >$@+ && \
-	chmod +x $@+ && \
-	mv $@+ $@
-endif # NO_PERL
+include perl.mak
 
 ifndef NO_PYTHON
 $(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
diff --git a/perl.mak b/perl.mak
new file mode 100644
index 0000000..8bbeef3
--- /dev/null
+++ b/perl.mak
@@ -0,0 +1,49 @@
+# Rules to build Git commands written in perl
+
+ifndef PERL_PATH
+	PERL_PATH = /usr/bin/perl
+endif
+export PERL_PATH
+PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
+
+ifeq ($(PERL_PATH),)
+NO_PERL = NoThanks
+endif
+
+ifndef NO_PERL
+$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
+
+
+$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl GIT-VERSION-FILE
+	$(QUIET_GEN)$(RM) $@ $@+ && \
+	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
+	sed -e '1{' \
+	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	    -e '	h' \
+	    -e '	s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'"));=' \
+	    -e '	H' \
+	    -e '	x' \
+	    -e '}' \
+	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+	    $@.perl >$@+ && \
+	chmod +x $@+ && \
+	mv $@+ $@
+
+
+.PHONY: gitweb
+gitweb:
+	$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
+
+git-instaweb: git-instaweb.sh gitweb GIT-SCRIPT-DEFINES
+	$(QUIET_GEN)$(cmd_munge_script) && \
+	chmod +x $@+ && \
+	mv $@+ $@
+else # NO_PERL
+$(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
+	$(QUIET_GEN)$(RM) $@ $@+ && \
+	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
+	    -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+	    unimplemented.sh >$@+ && \
+	chmod +x $@+ && \
+	mv $@+ $@
+endif # NO_PERL
-- 
1.8.1.2.526.gf51a757

  reply	other threads:[~2013-02-06 18:12 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 19:13 [PATCH] git-send-email: add ~/.authinfo parsing Michal Nazarewicz
2013-01-29 19:53 ` Junio C Hamano
2013-01-29 21:08   ` [PATCHv2] " Michal Nazarewicz
2013-01-29 22:38     ` Junio C Hamano
2013-01-30  0:03       ` [PATCHv3] " Michal Nazarewicz
2013-01-30  0:34         ` Junio C Hamano
2013-01-30  7:43   ` [PATCH] " Jeff King
2013-01-30 15:57     ` Junio C Hamano
2013-01-31 15:23       ` Ted Zlatanov
2013-01-31 19:38         ` Jeff King
2013-02-02 11:57           ` Ted Zlatanov
2013-02-03 19:41             ` Jeff King
2013-02-04 16:40               ` Ted Zlatanov
2013-02-04 16:42               ` [PATCH 1/3] Add contrib/credentials/netrc with GPG support Ted Zlatanov
2013-02-04 16:57                 ` Ted Zlatanov
2013-02-04 17:24                 ` Junio C Hamano
2013-02-04 18:33                   ` Ted Zlatanov
2013-02-04 19:06                     ` Junio C Hamano
2013-02-04 19:40                       ` Ted Zlatanov
2013-02-04 23:10                         ` Junio C Hamano
2013-02-06 15:10                           ` CodingGuidelines Perl amendment (was: [PATCH 1/3] Add contrib/credentials/netrc with GPG support) Ted Zlatanov
2013-02-06 16:29                             ` CodingGuidelines Perl amendment Junio C Hamano
2013-02-06 17:45                               ` demerphq
2013-02-06 18:08                                 ` Ted Zlatanov
2013-02-06 18:14                                 ` Junio C Hamano
2013-02-06 18:18                                   ` demerphq
2013-02-06 17:55                               ` [PATCH] Update CodingGuidelines for Perl 5 Ted Zlatanov
2013-02-06 18:05                               ` CodingGuidelines Perl amendment Ted Zlatanov
2013-02-06 18:16                                 ` Junio C Hamano
2013-02-06 18:27                                   ` Ted Zlatanov
2013-02-06 18:25                                 ` demerphq
2013-02-06 18:35                                   ` Ted Zlatanov
2013-02-06 18:44                                     ` demerphq
2013-02-06 18:54                                       ` Ted Zlatanov
2013-02-06 19:37                                         ` Junio C Hamano
2013-02-06 19:49                                           ` [PATCH v2] Update CodingGuidelines for Perl 5 Ted Zlatanov
2013-02-04 16:42               ` [PATCH 2/3] Skip blank and commented lines in contrib/credentials/netrc Ted Zlatanov
2013-02-04 16:43               ` [PATCH 3/3] Fix contrib/credentials/netrc minor issues: exit quietly; use 3-parameter open; etc Ted Zlatanov
2013-02-04 17:27                 ` Junio C Hamano
2013-02-04 18:41                   ` Ted Zlatanov
2013-02-04 16:33     ` [PATCH] git-send-email: add ~/.authinfo parsing Michal Nazarewicz
2013-02-04 17:00       ` Ted Zlatanov
2013-02-04 20:10         ` Jeff King
2013-02-04 20:28           ` Ted Zlatanov
2013-02-04 20:59             ` Jeff King
2013-02-04 21:08               ` Ted Zlatanov
2013-02-04 21:22                 ` Jeff King
2013-02-04 21:41                   ` Ted Zlatanov
2013-02-05 23:10     ` Junio C Hamano
2013-02-06  8:11       ` Matthieu Moy
2013-02-06 14:53         ` Ted Zlatanov
2013-02-06 15:10           ` Matthieu Moy
2013-02-06 15:58             ` Ted Zlatanov
2013-02-06 16:41               ` Matthieu Moy
2013-02-06 17:40                 ` Ted Zlatanov
2013-02-06 18:11                 ` [PATCH 0/4] Allow contrib/ to use Git's Makefile for perl code Matthieu Moy
2013-02-06 18:11                   ` Matthieu Moy [this message]
2013-02-07 19:16                     ` [PATCH 1/4] Makefile: extract perl-related rules to make them available from other dirs Junio C Hamano
2013-02-06 18:11                   ` [PATCH 2/4] perl.mak: introduce $(GIT_ROOT_DIR) to allow inclusion from other directories Matthieu Moy
2013-02-06 18:11                   ` [PATCH 3/4] Makefile: factor common configuration in git-default-config.mak Matthieu Moy
2013-02-07 19:28                     ` Junio C Hamano
2013-02-08 17:05                       ` Matthieu Moy
2013-02-08 17:31                         ` [PATCH 1/2] Makefile: make script-related rules usable from subdirectories Matthieu Moy
2013-02-08 17:31                           ` [PATCH 2/2] git-remote-mediawiki: use toplevel's Makefile Matthieu Moy
2013-02-06 18:11                   ` [PATCH 4/4] git-remote-mediawiki: use Git's Makefile to build the script Matthieu Moy
2013-02-07 19:28                     ` Junio C Hamano
2013-02-08  4:28                       ` Jeff King
2013-02-08 17:34                         ` Matthieu Moy
2013-02-08 17:43                           ` Jeff King
2013-02-08 18:13                             ` Junio C Hamano
2013-02-08 18:15                               ` Jeff King
2013-02-06 21:57               ` [PATCH] git-send-email: add ~/.authinfo parsing Jeff King
2013-02-06 23:12                 ` Ted Zlatanov
2013-02-07  7:08                   ` Matthieu Moy
2013-02-07 14:30                     ` Ted Zlatanov
2013-02-06 13:26       ` Michal Nazarewicz
2013-02-06 14:47         ` Ted Zlatanov
2013-01-30 15:03   ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360174292-14793-2-git-send-email-Matthieu.Moy@imag.fr \
    --to=matthieu.moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).