Repository navigation
Conversation
Pass --target-dir to cargo so the library always ends up where the install target expects it, even if CARGO_TARGET_DIR or build.target-dir is set globally. The directory can still be changed with TARGET_DIR. Also depend on the source files instead of the src directory, so editing a file in place triggers a rebuild. Fixes abba23#211
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #211.
If someone has
CARGO_TARGET_DIR(orbuild.target-dirin~/.cargo/config.toml) set globally,makebuilds fine but puts the library somewhere else, andmake installthen fails with:This passes
--target-dirto cargo, so the library always ends up whereinstalllooks for it. The directory is aTARGET_DIRvariable that defaults totarget, so anyone who wants their build output somewhere else can still domake TARGET_DIR=... && sudo make install TARGET_DIR=....I went with this instead of asking cargo for the target directory (e.g. via
cargo metadata) becausesudo make installusually runs as root without the user's cargo setup, so it wouldn't see the same directory anyway.While I was there, I also changed the dependency from
srcto$(wildcard src/*.rs). Depending on the directory only triggers a rebuild when files are added or removed, not when an existing file is edited in place.Tested with
CARGO_TARGET_DIRpointing elsewhere:makefollowed bymake install DESTDIR=...now installs both files, and editing a source file triggers a rebuild.