www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [OT] D in makefiles

reply Superstar64 <Hexagonalstar64 gmail.com> writes:
Makefiles allow custom shells. So with a small wrapper script we 
can use D in makefile. Here's my proof of concept: 
https://gist.github.com/Superstar64/8b896312ebe1a6e6240b1cba8aed2488.
Dec 16 2016
parent reply John Colvin <john.loughran.colvin gmail.com> writes:
On Saturday, 17 December 2016 at 02:00:34 UTC, Superstar64 wrote:
 Makefiles allow custom shells. So with a small wrapper script 
 we can use D in makefile. Here's my proof of concept: 
 https://gist.github.com/Superstar64/8b896312ebe1a6e6240b1cba8aed2488.
If you define SHELL = rdmd you might not need any wrapper script.
Dec 17 2016
parent reply Shachar Shemesh <shachar weka.io> writes:
On 17/12/16 10:06, John Colvin wrote:
 On Saturday, 17 December 2016 at 02:00:34 UTC, Superstar64 wrote:
 Makefiles allow custom shells. So with a small wrapper script we can
 use D in makefile. Here's my proof of concept:
 https://gist.github.com/Superstar64/8b896312ebe1a6e6240b1cba8aed2488.
If you define SHELL = rdmd you might not need any wrapper script.
Since newlines in make mean new execution, you will find it pretty hard to write a recipe that will be both usable and readable. This is, of course, assuming you overcome the fact that rdmd does not accept the program as a "-c" argument. Shachar
Dec 18 2016
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 12/18/16 2:47 PM, Shachar Shemesh wrote:
 On 17/12/16 10:06, John Colvin wrote:
 On Saturday, 17 December 2016 at 02:00:34 UTC, Superstar64 wrote:
 Makefiles allow custom shells. So with a small wrapper script we can
 use D in makefile. Here's my proof of concept:
 https://gist.github.com/Superstar64/8b896312ebe1a6e6240b1cba8aed2488.
If you define SHELL = rdmd you might not need any wrapper script.
Since newlines in make mean new execution, you will find it pretty hard to write a recipe that will be both usable and readable.
IIRC there is an option in gmake that allows one to run all commands within the same shell. https://www.gnu.org/software/make/manual/html_node/One-Shell.html. Anyway, it seems such usage of rdmd would be quite extreme. -- Andrei
Dec 18 2016
parent Shachar Shemesh <shachar weka.io> writes:
On 18/12/16 22:24, Andrei Alexandrescu wrote:
 IIRC there is an option in gmake that allows one to run all commands
 within the same shell.
 https://www.gnu.org/software/make/manual/html_node/One-Shell.html.
Was not aware of this. Thanks! Too bad it's an all or nothing thing. It would, otherwise, have been very useful to me in various make files I've written in the past. Shachar
Dec 19 2016