threads / patch / 2548

patchAdd option USE_INPLACE to Makefile

Subject: [PATCH] Add option USE_INPLACE to Makefile

## tl;dr

5 messages between Nov 16, 2005 and Nov 16, 2005. Diffs are folded; open one to read it.

replies: 4people: 2as markdown or json

Johannes Schindelin· Nov 16, 2005, 02:35 UTC · lore

If you plan on adding your current working directory to your PATH, you can do

	USE_INPLACE=1 make

and you no longer need to worry about setting variables like GIT_EXEC_PATH and GIT_PYTHON_PATH.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 Makefile |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

applies-to: 66be81f4755380a7c9da56aa5fbc600565ff78a8 07f60591a5e881b2a46885ac9b6ba61a4931ac86

Show changes to Makefile +13 −0
diff --git a/Makefile b/Makefile
index 55f4c6b..63c524d 100644
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,9 @@
 # Define USE_STDEV below if you want git to care about the underlying device
 # change being considered an inode change from the update-cache perspective.
 
+# Define USE_INPLACE if you do not plan to install git anywhere, but rather
+# want to add the working directory to your PATH.
+
 GIT_VERSION = 0.99.9.GIT
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
@@ -60,10 +63,16 @@ ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 
 prefix = $(HOME)
+ifdef USE_INPLACE
+bindir = `pwd`
+template_dir = `pwd`/templates
+GIT_PYTHON_DIR = `pwd`/compat
+else
 bindir = $(prefix)/bin
 template_dir = $(prefix)/share/git-core/templates/
 GIT_PYTHON_DIR = $(prefix)/share/git-core/python
 # DESTDIR=
+endif
 
 CC = gcc
 AR = ar
@@ -432,6 +441,8 @@ check:
 
 ### Installation rules
 
+ifndef USE_INPLACE
+
 install: $(PROGRAMS) $(SCRIPTS) git
 	$(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(bindir))
 	$(INSTALL) git $(PROGRAMS) $(SCRIPTS) $(call shellquote,$(DESTDIR)$(bindir))
@@ -468,6 +479,8 @@ deb: dist
 	dpkg-source -b $(GIT_TARNAME)
 	cd $(GIT_TARNAME) && fakeroot debian/rules binary
 
+endif
+
 ### Cleaning rules
 
 clean:
---
0.99.9.GIT
Junio C Hamano· Nov 16, 2005, 03:11 UTC · re: Johannes Schindelin · lore

Re: [PATCH] Add option USE_INPLACE to Makefile

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> and you no longer need to worry about setting variables like
> GIT_EXEC_PATH and GIT_PYTHON_PATH.

I think you can already do this in the config.mak mechanism added by, ... (goes and asks git-whatchanged about it),... *you*, no?

You know you are not installing things anyway if you do that, so I do not see much point hiding the install target and friends either.

Johannes Schindelin· Nov 16, 2005, 08:10 UTC · re: Junio C Hamano · lore

Re: [PATCH] Add option USE_INPLACE to Makefile

Hi,
On Tue, 15 Nov 2005, Junio C Hamano wrote:
Show 8 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > and you no longer need to worry about setting variables like
> > GIT_EXEC_PATH and GIT_PYTHON_PATH.
> 
> I think you can already do this in the config.mak mechanism
> added by, ... (goes and asks git-whatchanged about it),...
> *you*, no?
Yes.

But I imagined a programmer new to git. And then I looked at the situation I had yesterday after pulling to 97fc6c5f.. in which I was able to build just fine, but calls like "git diff" no longer worked.

Now, *I* know what I have to put into config.mak, but I would hate the project if I was new to it, tried to play around with it, and nothing would work in spite of being compiled with just one warning, thank you.

> You know you are not installing things anyway if you do that, so
> I do not see much point hiding the install target and friends
> either.

Just a safety measure for the price of two lines. When I check out a new project, I do "make", play around with it, and then do "make install". If I had to set "export USE_INPLACE=1", "make install" should barf, because the compiled programs are not meant to be used anywhere else.

Having said that, I probably should have called it an RFC, not a PATCH. Sorry.

Ciao, Dscho

Junio C Hamano· Nov 16, 2005, 08:36 UTC · re: Johannes Schindelin · lore

Re: [PATCH] Add option USE_INPLACE to Makefile

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Now, *I* know what I have to put into config.mak, but I would hate the 
> project if I was new to it, tried to play around with it, and nothing 
> would work in spite of being compiled with just one warning, thank you.

Hmph. That certainly sounds like what I might do. Especially the part "play around before installing", so I am *very* sympathetic.

OTOH, I do not particularly want to advertise/encourage in-place use. Once you built today's git ;-), wouldn't you cd somewhere else and use it for your real work? That would mean you have one location on your PATH that you keep the latest git build and I am not sure why being able to run in-place is such a big deal. Is it because $HOME is under a tight quota?

> Just a safety measure for the price of two lines. When I check out a new 
> project, I do "make", play around with it, and then do "make install". If 
> I had to set "export USE_INPLACE=1", "make install" should barf, because 
> the compiled programs are not meant to be used anywhere else.
OK.  That's sensible.
Johannes Schindelin· Nov 16, 2005, 11:04 UTC · re: Junio C Hamano · lore

Re: [PATCH] Add option USE_INPLACE to Makefile

Hi,
On Wed, 16 Nov 2005, Junio C Hamano wrote:
Show 16 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > Now, *I* know what I have to put into config.mak, but I would hate the 
> > project if I was new to it, tried to play around with it, and nothing 
> > would work in spite of being compiled with just one warning, thank you.
> 
> Hmph.  That certainly sounds like what I might do.  Especially
> the part "play around before installing", so I am *very*
> sympathetic.
> 
> OTOH, I do not particularly want to advertise/encourage in-place
> use.  Once you built today's git ;-), wouldn't you cd somewhere
> else and use it for your real work?  That would mean you have
> one location on your PATH that you keep the latest git build
> and I am not sure why being able to run in-place is such a big
> deal.  Is it because $HOME is under a tight quota?

Okay. So it would be better to provide a short snippet in INSTALL which can be copied into config.mak?

Show 6 quoted lines
> > Just a safety measure for the price of two lines. When I check out a new 
> > project, I do "make", play around with it, and then do "make install". If 
> > I had to set "export USE_INPLACE=1", "make install" should barf, because 
> > the compiled programs are not meant to be used anywhere else.
> 
> OK.  That's sensible.

Well, the patch was untested, and wrong (template_dir was bogus). But I agree that it might be a better idea to deprecate that behaviour.

I *will* learn to "make install" after "make", and not spend hours just to find that ./git called the old installed binaries.

Ciao, Dscho

← back to recent threads