Generating file lists from a script
Maintaining the lists of files and directories in the makefiles is error-prone. Would it make sense to use a script to generate them from the git repository? The script would get it right every time, whereas I tend to get it wrong more times than not. -- Sincerely, Demi Marie Obenour (she/her/hers)
Demi Marie Obenour <demiobenour@gmail.com> writes:
Maintaining the lists of files and directories in the makefiles is error-prone. Would it make sense to use a script to generate them from the git repository? The script would get it right every time, whereas I tend to get it wrong more times than not.
As long as we're still maintaining a list of files in the source tree, rather than doing something like copying whole directories, and we don't have to make the Makefiles less readable to accomodate the script, I don't mind.
On 8/31/25 06:51, Alyssa Ross wrote:
Demi Marie Obenour <demiobenour@gmail.com> writes:
Maintaining the lists of files and directories in the makefiles is error-prone. Would it make sense to use a script to generate them from the git repository? The script would get it right every time, whereas I tend to get it wrong more times than not.
As long as we're still maintaining a list of files in the source tree, rather than doing something like copying whole directories, and we don't have to make the Makefiles less readable to accomodate the script, I don't mind.
Would this work? 1. Move all files meant to be included into the images into a subdirectory, say `image`. 2. Move the lists of files and symlinks (but not FIFOs and directories) into a separate file that is included by the main Makefile. 3. Write a script that uses `git ls-files` to generate that file. I already wrote a script that is a bit over 100 lines of code. Its only dependencies are awk, (bash OR zsh), sort, env, and git. I only tested it with GNU awk, GNU bash, and GNU sort, but I expect that it should work with any awk supporting -E, any env implementing -S, and any shell supporting -euo pipefail. If storing the permissions of FIFOs and directories is desired, it would be trivial to add them. -- Sincerely, Demi Marie Obenour (she/her/hers)
participants (2)
-
Alyssa Ross -
Demi Marie Obenour