Fix n64.mk dfs target nested directories #436
Open
+9
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
n64.mk
rule for%.dfs
makes an unreliable assumption that the ROM filesystem is flat. If prerequisites are nested in subdirectories of the filesystem root, this rule has unexpected behavior:%.dfs: @mkdir -p $(dir $@) @echo " [DFS] $@" $(N64_MKDFS) $@ $(<D) >/dev/null
$(<D)
gets the directory part of the first prerequisite. This only works correctly if the first prerequisite is in the root of the DFS filesystem. Ideally, this rule would use the longest common prefix of all prerequisites, but this is not trivial to do in a Makefile and has the potential to run up against command-line length limits.As a simple, surgical workaround, this PR introduces a
DFS_ROOTDIR
Makefile variable to specify the ROM filesystem root directory. This PR also adds a warning to existing users advising them to adoptDFS_ROOTDIR
.Context from Discord: https://discord.com/channels/205520502922543113/974342113850445874/1152363061475278980