Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ismaell
Copy link
Contributor

@ismaell ismaell commented Nov 21, 2020

The implementation imitates the behavior of build-systems generated by GNU Automake.

Installs and uninstalls binaries and manual pages.

Implemented targets:

  • install
  • install-strip
  • uninstall

Implemented variables:

  • DESTDIR
  • prefix (default: /usr/local)
  • bindir (default: ${prefix}/bin)
  • mandir (default: ${prefix}/share/man)
  • INSTALL_STRIP_FLAG

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! In the future, it would be very useful to describe your PR, or possibly link to an issue that this is solving. We generally do not accept PRs that are not linked to any particular issue.

Would this be addressing #293? Do you think an uninstall target would make sense too?

Makefile Outdated
.PHONY: install install-strip install-dirs
install-dirs:
install -d ${DESTDIR}${bindir}
install-strip: install-dirs bin/gh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate on why separate targets install-dirs and install-strip are useful?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directories need to be created by all install targets, that's the only reason to have a install-dirs target.

install-strip is provided by autotools, so I thought it may be a good idea to support that too.

@ismaell
Copy link
Contributor Author

ismaell commented Nov 23, 2020

Yes, it's addressing #293, although I didn't see that ticket at the time of making the PR.

I'll add the uninstall target later today. I should probably refactor things to be driven by variables.

@mislav
Copy link
Contributor

mislav commented Nov 23, 2020

@ismaell Just remembered: if there was an install command, I think it should also install man pages in addition to the bin/gh executable.

@ismaell
Copy link
Contributor Author

ismaell commented Nov 23, 2020

@ismaell Just remembered: if there was an install command, I think it should also install man pages in addition to the bin/gh executable.

Ok, I'll address that next. 😁

@ismaell
Copy link
Contributor Author

ismaell commented Nov 23, 2020

@mislav any ideas on how to track manpages for uninstalling and for preventing the manpages rule to run needlessly?

@ismaell
Copy link
Contributor Author

ismaell commented Nov 24, 2020

Maybe it's a good idea to merge this PR then I make another one for the manpages.

The implementation imitates the behavior of build-systems generated by
GNU Automake.

Implemented targets:
- install
- install-strip
- uninstall

Implemented variables:
- DESTDIR
- prefix
- bindir
- INSTALL_STRIP_FLAG

Internal implementation details:

- install-bins variable collects user binaries to be installed
- install-dirs variable collects directories to be created
@ismaell
Copy link
Contributor Author

ismaell commented Nov 30, 2020

I've addressed the need to track manual page files by creating a manpages.list file.

@ismaell ismaell changed the title Add make install target for POSIX systems Add make (un)install targets for POSIX systems Nov 30, 2020
Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

I've pushed a commit to simplify things. I wanted to avoid adding additional make target install-strip (since it's unnecessary for now), tracking binaries via install-bins/remove-bins (since it's unlikely that we're going to ship more binaries in the near future), and needing an intermediate file manpages.list (we simply remove man pages named gh*.1 while uninstalling).

Your version of the Makefile was definitely more sophisticated and suitable for a larger project, but for sake of maintainability, for our purposes it's best if it's simple as possible.

@mislav mislav merged commit faa1e44 into cli:trunk Dec 1, 2020
@ismaell ismaell deleted the install-target branch December 8, 2020 20:17
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.

4 participants