# [PATCH] Allow CFLAGS to be overridden while preserving VERSION

2 messages from 2007-06-02 to 2007-06-02. Participants: James Bowes, Jonas Fonseca.
Thread: https://gitlist.dev/t/8399

## James Bowes, 2007-06-02 17:14

Subject: [PATCH] Allow CFLAGS to be overridden while preserving VERSION
Message-ID: <118080449045-git-send-email-jbowes@dangerouslyinc.com>
URL: https://gitlist.dev/e/118080449045-git-send-email-jbowes%40dangerouslyinc.com

```
If someone defined their own CFLAGS, they would have to include a -DVERSION=
as well (or else get unknown-version as the version).

Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
---
 Makefile |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 61fc86b..91cb097 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ endif
 RPM_VERSION = $(subst -,.,$(VERSION))
 
 LDLIBS	= -lcurses
-CFLAGS	= -Wall -O2 '-DVERSION="$(VERSION)"'
+CFLAGS	= -Wall -O2
 DFLAGS	= -g -DDEBUG -Werror
 PROGS	= tig
 MANDOC	= tig.1 tigrc.5
@@ -28,6 +28,8 @@ HTMLDOC = tig.1.html tigrc.5.html manual.html README.html
 ALLDOC	= $(MANDOC) $(HTMLDOC) manual.html-chunked manual.pdf
 TARNAME	= tig-$(RPM_VERSION)
 
+override CFLAGS += '-DVERSION="$(VERSION)"'
+
 all: $(PROGS)
 all-debug: $(PROGS)
 all-debug: CFLAGS += $(DFLAGS)
-- 
1.5.2.888.g96a5e

```

## Jonas Fonseca, 2007-06-02 18:35

Subject: Re: [PATCH] Allow CFLAGS to be overridden while preserving VERSION
Message-ID: <20070602183517.GD19952@diku.dk>
URL: https://gitlist.dev/e/20070602183517.GD19952%40diku.dk
In-Reply-To: <118080449045-git-send-email-jbowes@dangerouslyinc.com>

```
James Bowes <jbowes@dangerouslyinc.com> wrote Sat, Jun 02, 2007:
> If someone defined their own CFLAGS, they would have to include a -DVERSION=
> as well (or else get unknown-version as the version).

Thank you, applied and pushed out.

-- 
Jonas Fonseca

```
