help-make
[Top][All Lists]
Advanced

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

Cleansing the environment automatically


From: David Wuertele
Subject: Cleansing the environment automatically
Date: Sat, 19 Jan 2008 01:09:55 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

As I work on various people's build systems, one pet peeve of mine is that they
let too much of the environment leak into their command scripts.  If a user
finds that setting a variable makes his build work in some specific way, often
that information is not communicated to all the engineers, and they find strange
discrepancies in the way their builds behave.

I always try to create a more strict configuration hygiene by cleansing the
environment using "env -i" at the beginning of each command.  But this is
tedious for me, hard to read for others, and prone to me forgetting to do it.  I
would like to make it the default behavior.

For example, I commonly write rules something like this:

GCC := /path/to/specific/gcc
SOMETHING_ELSE := variable_specific_value
TAILORED_ENVIRONMENT := GCC=$(GCC) SOMETHING_ELSE=$(SOMETHING_ELSE)

compile:
        env -i $(TAILORED_ENVIRONMENT) /path/to/some_command_here

I'm not tied to this syntax, or to using env.  I just want to have total control
over the environment for every command in my makefile.  Any suggestions?

Dave






reply via email to

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