Skip to contentSkip to conversation

Include Makefile.localdef in Makefile, if it exists.

PATCH In review Jason Riedy 3 participants 5 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Include Makefile.localdef in Makefile, if it exists.

Makefile.localdef is just a hook for local definitions. Users can track their definitions in a branch and not worry about merge conflicts.

---

 Makefile |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

applies-to: b93e1c78095bf4ace0806ab70295931f6da28174 65e5d3d6d31af3dda6d5cfd4e0745f34118955c3

Makefile +9 -6
index df3c6eb..dc7581d 100644
@@ -64,18 +64,21 @@ LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 
-prefix = $(HOME)
-bindir = $(prefix)/bin
-template_dir = $(prefix)/share/git-core/templates/
-GIT_PYTHON_DIR = $(prefix)/share/git-core/python
-# DESTDIR=
-
 CC = gcc
 AR = ar
 TAR = tar
 INSTALL = install
 RPMBUILD = rpmbuild
 
+# Include local definitions, if any.
+-include Makefile.localdef
+
+prefix ?= $(HOME)
+bindir ?= $(prefix)/bin
+template_dir ?= $(prefix)/share/git-core/templates/
+GIT_PYTHON_DIR ?= $(prefix)/share/git-core/python
+# DESTDIR=
+
 # sparse is architecture-neutral, which means that we need to tell it
 # explicitly what architecture to check for. Fix this up for yours..
 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__

---
0.99.9h

#1 lore raw

Hi,

Quoted 3 lines · Jason Riedy

Makefile.localdef is just a hook for local definitions. Users can track their definitions in a branch and not worry about merge conflicts.

I wonder why you do not just override them in config.mak, which was introduced just for that purpose...

Hth,
Dscho

#2 lore raw

And Johannes Schindelin writes:
- I wonder why you do not just override them in config.mak, which was
- introduced just for that purpose...

'Cause I'm a git and didn't notice it, thanks. The prefix stuff probably ought to be moved below the -include config.mak so someone need only change $(prefix) and not the rest. I might send along such a patch, along with a note about config.mak in INSTALL...

Jason

#3 lore raw
Quoted 3 lines · Jason Riedy

... I might
send along such a patch, along with a note about config.mak in INSTALL...

Please don't, unless you are confident your change can satisfy _everybody_.

People with makefile needs that are more "advanced" (that is, something a simple "-include config.mak" cannot easily satisfy) can do any number of things without touching Makefile I ship. Examples include:

- have own makefile, include Makefile.

- have onw Make script, run "make -f Makefile" with preset "bindir=HERE NO_XXX=NoThanks" to reduce typing.

- have own makefile, whose build target depends on Make.file and runs "make -f Make.file", with a build rule for Make.file to munge Makefile using custom perl/sed into it.

#4 lore raw
In reply to Jason Riedy

Hi,

Quoted 5 lines · Jason Riedy

And Johannes Schindelin writes:
- I wonder why you do not just override them in config.mak, which was
- introduced just for that purpose...

'Cause I'm a git and didn't notice it, thanks.

Nopraw.

Quoted 4 lines

The prefix stuff probably ought to be moved below the -include config.mak so someone need only change $(prefix) and not the rest. I might send along such a patch, along with a note about config.mak in INSTALL...

Actually, it is a feature that you can override prefix and template_dir independently.

Hth,
Dscho