How can I import a list from YAML file, to use it in a GNU make file. The list contains a few c source files as shown below.
---
- file1.c
- file2.c
- file3.c
- file4.c
...
I don't see why it's easier to add the new source file to a yaml file than to just add it to the makefile.
But the direct answer to your question is, there's no already-existing support for yaml files in make. You'd have to write a set of shell commands or a script that could parse out the content then run it from your makefile with something like:
SOURCES := $(shell parsemy foo.yaml)
(implementation of the parsemy
script left as an exercise for the reader).
If you think the makefile is too complicated to edit you can put the source definition in a separate makefile and include
it:
$ cat sources.mk
SOURCES = \
foo.c \
bar.c \
biz.c
$ cat makefile
include sources.mk
... do other stuff ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With