grame-cncm / faust

Functional programming language for signal processing and sound synthesis
http://faust.grame.fr
Other
2.58k stars 322 forks source link

can `faust` output dependency file, for easier integration with `make`? #248

Closed giuliomoro closed 5 years ago

giuliomoro commented 5 years ago

You can pass to gcc or clang something like -MMD -MP -MF"$(@:%.o=%.d)" to generate a .d file that explicitly declares dependencies. So for instance if you compile file a.cpp that includes file a.h, you get in a.d:

a.cpp: a.h

Is it, or would it be, possible for faust to output a similar file, clearly showing what dsp files and libraries are being used whenever you pass a given .dsp file as the input of a faust command? This way it would be easier for a make-based build system to find out when changes to the .dsp files are made that would require running the faust command again.

sletz commented 5 years ago

faust -json foo.dsp produces a foo.dsp.json file with this information in the "library_list" key. Is this OK for your need ?

giuliomoro commented 5 years ago

right, I guess I can parse that (as long as it's guaranteed not to contain line breaks!). However, this generates the .json file in the same folder as the source .dsp file. Is this expected? Is there a way to change the place it is generated, so that it can go in a temp folder, or in the destination folder of the .cpp file?

sletz commented 5 years ago

Yes, use -O, like: faust -O tmp -json noise.dsp -o noise.cpp

giuliomoro commented 5 years ago

ok, this should do the trick:

echo render.cpp: `{ grep library_list virtualAnalog.dsp.json | sed "s/.*\[//" | sed "s/\].*//" | sed "s/,/ /g"; }` > mkfile.inc