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

Re: [PATCH v5 01/18] Makefile: pass CPPFLAGS through to fllow customization

From
GVGary V. Vaughan <git@mlists.thewrittenword.com>
Date
May 14, 2010, 10:58 UTC
Message-ID
<20100514105832.GB31921@thor.il.thewrittenword.com>
In-Reply-To
<robbat2-20100514T094909-157386852Z@orbis-terrarum.net>
Hi Robin,
On Fri, May 14, 2010 at 09:53:30AM +0000, Robin H. Johnson wrote:
Show 25 quoted lines
> On Fri, May 14, 2010 at 09:31:32AM +0000, Gary V. Vaughan wrote:
> > Without this patch there is no straight forward way to pass additional
> > CPPFLAGS at configure-time.  At TWW, everything non-vendor package is
> > installed to its own subdirectory, so we need the following to show
> > the preprocessor where the headers for the libraries we will link
> > later can be found:
> As a point of comparision, this is what we use in Gentoo, to allow us to
> override many of the variables:
> sed -i \
>     -e 's:^\(CFLAGS =\).*$:\1 $(OPTCFLAGS) -Wall:' \
>     -e 's:^\(LDFLAGS =\).*$:\1 $(OPTLDFLAGS):' \
>     -e 's:^\(CC = \).*$:\1$(OPTCC):' \
>     -e 's:^\(AR = \).*$:\1$(OPTAR):' \
>     Makefile || die "sed failed"
> 
> Which would be equivilent to changing the Makefile to have:
> CFLAGS = $(OPTCFLAGS) -Wall
> LDFLAGS = $(OPTLDFLAGS)
> CC = $(OPTCC)
> AR = $(OPTAR)
> 
> Thereafter, we pass in the relevant values for those variables.
> 
> CPPFLAGS is reserved for flags destined for ONLY the preprocessor, and we don't
> want to introduce for that reason.

Letting the user pass preprocessor flags to the preprocessor with CPPFLAGS at build and/or configure time is a *very* standard feature. Why would you want to stop a person who builds git from using it?

As a matter of fact, Automake even jumps through hoops with AM_CPPFLAGS to make sure that the package maintainer doesn't accidentally trample over the package builder's CPPFLAGS settings - I can't think of a scenario where the person who writes the build system for a package knows more about what CPPFLAGS the person who builds it will need that the person doing the actual building.

I'm pretty sure I'm missing the point though, since letting the package builder choose their own CPPFLAGS has been at the core of building Unix packages for as long as I can remember...

Cheers,
-- 
Gary V. Vaughan (gary@thewrittenword.com)
Previous: Robin H. JohnsonNext: Robin H. Johnson
Message 4 of 34 in “Portability patches for git-1.7.1”
  1. 00/18 Portability patches for git-1.7.1Gary V. Vaughan, May 14, 2010
  2. 01/18 Makefile: pass CPPFLAGS through to fllow customizationGary V. Vaughan, May 14, 2010
  3. Robin H. JohnsonMay 14, 2010
  4. Gary V. VaughanMay 14, 2010
  5. Robin H. JohnsonMay 14, 2010
  6. Gary V. VaughanMay 14, 2010
  7. 02/18 Rewrite dynamic structure initializations to runtime assignmentGary V. Vaughan, May 14, 2010
  8. Junio C HamanoJun 2, 2010
  9. 03/18 Makefile: -lpthread may still be necessary when libc has only pthread stubsGary V. Vaughan, May 14, 2010
  10. 04/18 enums: omit trailing comma for portabilityGary V. Vaughan, May 14, 2010
  11. 05/18 Do not use "diff" found on PATH while building and installingGary V. Vaughan, May 14, 2010
  12. Junio C HamanoJun 2, 2010
  13. 06/18 tests: use "test_cmp", not "diff", when verifying the resultGary V. Vaughan, May 14, 2010
  14. Junio C HamanoJun 2, 2010
  15. 07/18 test_cmp: do not use "diff -u" on platforms that lack oneGary V. Vaughan, May 14, 2010
  16. 08/18 git-compat-util.h: some platforms with mmap() lack MAP_FAILED definitionGary V. Vaughan, May 14, 2010
  17. 09/18 Makefile: some platforms do not have hstrerror anywhereGary V. Vaughan, May 14, 2010
  18. 10/18 Make NO_{INET_NTOP,INET_PTON} configured independentlyGary V. Vaughan, May 14, 2010
  19. 11/18 Some platforms lack socklen_t typeGary V. Vaughan, May 14, 2010
  20. 12/18 Allow disabling "inline"Gary V. Vaughan, May 14, 2010
  21. 13/18 inline declaration does not work on AIXGary V. Vaughan, May 14, 2010
  22. 14/18 Makefile: SunOS 5.6 portability fixGary V. Vaughan, May 14, 2010
  23. 15/18 git-compat-util.h: Irix 6.5 defines sgi but not __sgi.Gary V. Vaughan, May 14, 2010
  24. git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIXBrandon Casey, Jun 2, 2010
  25. Gary V. VaughanJun 2, 2010
  26. Tor ArntsenJun 2, 2010
  27. 16/18 Makefile: HPUX11 portability fixes.Gary V. Vaughan, May 14, 2010
  28. 17/18 Makefile: HP-UX 10.20 portability fixes.Gary V. Vaughan, May 14, 2010
  29. 18/18 Makefile: Tru64 portability fixGary V. Vaughan, May 14, 2010
  30. Gary V. VaughanMay 26, 2010
  31. Gary V. VaughanJun 7, 2010
  32. Junio C HamanoJun 7, 2010
  33. Tor ArntsenJun 9, 2010
  34. Junio C HamanoJun 11, 2010

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.