Attention is currently required from: Sam McNally, Xiang Wang, Stefan Reinauer. Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49599 )
Change subject: flashrom.c: automatic generated programmer_enum.h ......................................................................
Patch Set 6:
(1 comment)
File Makefile:
https://review.coreboot.org/c/flashrom/+/49599/comment/1bc73921_ce34e1a3 PS4, Line 681: $(shell bash ./util/generator_programmer_enum.sh)
Please guide me how to modify the Makefile, and meson. […]
Sorry for the delay. I don't have much time and some effort the rework the list has already been started: CB:51925.
I can give you a brief overview wrt. to Make. But I don't know about Meson.
Makefiles specify rules to create files. The syntax is roughly:
target_file: dependency_file_1 dependency_file_2 etc # recipe: a shell script to create the file, e.g. cat dependency_file_1 dependency_file_2 >target_file
The recipe is always indented with a tab. Each line is run in a shell and only if the shell's return value is 0, Make continues. Now if Make is supposed to create the `target_file`, it would first check for the presence of the dependency files. If there are rules for these files too, they would be checked first and so on. If `target_file` already exists, the recipe will only be executed if any of the dependency files have a newer timestamp than the `target_file`.
In case of this patch, you want to create a file `programmer_enum.h` and you know that its contents depend on `programmer_table.c`, so you would write it like this:
programmer_enum.h: programmer_table.c ./util/generator_programmer_enum.sh
Now to let Make know that `programmer_enum.h` needs to be created or updated, for all the files that (potentially) #include it, you need to add `programmer_enum.h` to the dependency list. This could be done for each file individually, e.g.
flashrom.o: programmer_enum.h
Or for all `.o` files at once: There is a rule below that says
%.o: %.c .features
Which means all `.o` files depend on their respective `.c` files plus `.features`. It could be changed to:
%.o: %.c .features programmer_enum.h