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

Makefile: Allow prefix to be set from outside #130

Closed
wants to merge 1 commit into from

Conversation

LeSpocky
Copy link
Contributor

This way external build systems can override prefix and decide to not install into $HOME.

Fixes: c11923a ("make: add install and uninstall targets")

This way external build systems can override prefix and decide to not
install into $HOME.

Signed-off-by: Alexander Dahl <[email protected]>
Fixes: c11923a ("make: add install and uninstall targets")
@felipec
Copy link
Owner

felipec commented Oct 23, 2024

You can just do make prefix=/usr, that overrides the variable: overriding variables.

@LeSpocky
Copy link
Contributor Author

You can just do make prefix=/usr, that overrides the variable: overriding variables.

Nice to know. The conditional variable assignement makes it a little more flexible, because make can also take the value from the environment then.

@felipec
Copy link
Owner

felipec commented Oct 23, 2024

@LeSpocky if you want the environment to override variables, you should use make -e. ?= is more commonly used when dealing with multiple Makefiles including each other.

@LeSpocky
Copy link
Contributor Author

You can just do make prefix=/usr, that overrides the variable: overriding variables.

I checked packages in buildroot this morning and found this is actually a common way to set prefix from outside. Not sure why my brain suggested the other way?! Calling make prefix=/usr install now and that works. Sorry for the noise.

@LeSpocky LeSpocky closed this Oct 24, 2024
@felipec
Copy link
Owner

felipec commented Oct 25, 2024

No problem. It took me a while to figure out all the common ways Makefiles are used, but yeah make prefix=/usr install is pretty common.

For reference this is what I use in my Arch Linux package:

DESTDIR="$pkgdir" make prefix=/usr VIM_DIR=/usr/share/vim/vimfiles install install-vim

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.

2 participants