Merge pull request #2455 from ismaell/install-target

Add make (un)install targets for POSIX systems 

Fixes #293
This commit is contained in:
Mislav Marohnić 2020-12-01 20:33:37 +01:00 committed by GitHub
commit faa1e44f52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 10 deletions

View file

@ -58,7 +58,22 @@ endif
git -C site commit -m '$(GITHUB_REF:refs/tags/v%=%)' index.html
.PHONY: site-bump
.PHONY: manpages
manpages:
go run ./cmd/gen-docs --man-page --doc-path ./share/man/man1/
DESTDIR :=
prefix := /usr/local
bindir := ${prefix}/bin
mandir := ${prefix}/share/man
.PHONY: install
install: bin/gh manpages
install -d ${DESTDIR}${bindir}
install -m755 bin/gh ${DESTDIR}${bindir}/
install -d ${DESTDIR}${mandir}/man1
install -m644 ./share/man/man1/* ${DESTDIR}${mandir}/man1/
.PHONY: uninstall
uninstall:
rm -f ${DESTDIR}${bindir}/gh ${DESTDIR}${mandir}/man1/gh.1 ${DESTDIR}${mandir}/man1/gh-*.1

View file

@ -15,16 +15,18 @@
$ cd gh-cli
```
2. Build the project
```
$ make
```
3. Move the resulting `bin/gh` executable to somewhere in your PATH
2. Build and install
```sh
$ sudo mv ./bin/gh /usr/local/bin/
# installs to '/usr/local' by default; sudo may be required
$ make install
```
4. Run `gh version` to check if it worked.
To install to a different location:
```sh
$ make install prefix=/path/to/gh
```
Make sure that the `${prefix}/bin` directory is in your PATH.
3. Run `gh version` to check if it worked.