bug-make
[Top][All Lists]
Advanced

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

[bug #62595] Add ability to read .env files into make and


From: Paul D. Smith
Subject: [bug #62595] Add ability to read .env files into make and
Date: Sat, 11 Jun 2022 10:36:32 -0400 (EDT)

Follow-up Comment #7, bug #62595 (project make):

Thanks for the pointer to the spec, that's very helpful.  I agree that this
would be possible to implement.

I'm not interested in a flag like --envfile, that doesn't sound very useful. 
I would anticipate that most build systems would want to always include the
content of the file, and not require the user to add an option to the command
line.

I'm also not sure I agree that the right behavior is to always export every
variable in the file.  But these are details: the first thing is to decide
whether this needs to be added at all.

I was thinking about alternatives to adding new syntax, and the problem is
that there's not a very straightforward way in GNU make today to evaluate the
output of a program as a makefile.

We can run a program using $(shell ...), but the results are modified by
removing newlines and so this is not useful.

The only way to do it is to run $(shell ...) and have it write to a temporary
file, then include the temporary file.  Of course you can also use the re-exec
feature of make to write a rule to generate the include file then you have the
full power of a recipe.

Is that sufficient?  It would be something like:


include env.mk

env.mk: env.env
        env2make < $< > $@


for some putative *env2make* conversion tool.

An alternative would be to invent some new type of function which would either
preserve newlines in the result, which could then be passed to the *eval*
function, or create an alternative to include which would run a program and
"include" the output, or something like that.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62595>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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