help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is 'make -e' "not recommended practice"?


From: Darin Johnson
Subject: Re: Why is 'make -e' "not recommended practice"?
Date: Fri, 8 Jul 2005 15:00:01 -0400 (EDT)

Different projects will have different requirements for CFLAGS, plus
more than one user may try to compile a project.  So you could end up
with an environment variable working correctly with one project but
breaking another, or one user will build the project correctly while
another can't.  So it's best to put all the required information for
compiling into the Makefile, and not into a user's login script.

If you have to override a variable, because you can't modify the
Makefile or just want a temporary change, then you can do this on the
command line, as "make CFLAGS=-g".

A common option is to break up CFLAGS into multiple parts.  Then the
user can override some of the parts without breaking the build.  As in:

   INCLUDES = -Idir1/includes -Idir2/includes
   DEFINES = -DVERSION=1
   OPT = -O2
   CFLAGS = $(INCLUDES) $(DEFINES) $(OPT)

Then a user wanting a debug build could do:  "make OPT=-g".





reply via email to

[Prev in Thread] Current Thread [Next in Thread]