Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix n64.mk dfs target nested directories #436

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

meeq
Copy link
Contributor

@meeq meeq commented Sep 15, 2023

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 adopt DFS_ROOTDIR.

Context from Discord: https://discord.com/channels/205520502922543113/974342113850445874/1152363061475278980

Introduce DFS_ROOTDIR Makefile variable to specify the ROM filesystem root directory.

Warn existing users to adopt DFS_ROOTDIR
meeq added a commit to meeq/FlappyBird-N64 that referenced this pull request Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant