git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Teach Makefile to respect external variables: CFLAGS and others.

From
EREygene Ryabinkin <rea-git@codelabs.ru>
Date
Jun 13, 2007, 05:42 UTC
Message-ID
<20070613054229.GM86872@void.codelabs.ru>

If one is not using the configure script, then there is no way to redefine variables CFLAGS, LFLAGS, CC, AR, TAR, INSTALL, RPMBUILD, TCL_PATCH and TCLTK_PATH. This shouldn't be so, since these variables can be manually set by user and we should respect them.

The patch originates from the FreeBSD port and was originally made by Ed Schouten, ed at fxq dot nl.

Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>
---
 Makefile |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
index 30a4052..6cd9ea2 100644
--- a/Makefile
+++ b/Makefile
@@ -135,8 +135,8 @@ uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
-CFLAGS = -g -O2 -Wall
-LDFLAGS =
+CFLAGS ?= -g -O2 -Wall
+LDFLAGS ?=
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
@@ -172,13 +172,13 @@ GITWEB_SITE_FOOTER =
 
 export prefix bindir gitexecdir sharedir template_dir sysconfdir
 
-CC = gcc
-AR = ar
-TAR = tar
-INSTALL = install
-RPMBUILD = rpmbuild
-TCL_PATH = tclsh
-TCLTK_PATH = wish
+CC ?= gcc
+AR ?= ar
+TAR ?= tar
+INSTALL ?= install
+RPMBUILD ?= rpmbuild
+TCL_PATH ?= tclsh
+TCLTK_PATH ?= wish
 
 export TCL_PATH TCLTK_PATH
 
-- 
1.5.2.1
Next: Junio C Hamano
Message 1 of 7 in “Teach Makefile to respect external variables: CFLAGS and others.”
  1. Teach Makefile to respect external variables: CFLAGS and others.Eygene Ryabinkin, Jun 13, 2007
  2. Junio C HamanoJun 13, 2007
  3. Eygene RyabinkinJun 13, 2007
  4. Junio C HamanoJun 13, 2007
  5. Eygene RyabinkinJun 13, 2007
  6. Matthias LederhoferJun 13, 2007
  7. Sam RavnborgJun 13, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.