Skip to content

Commit

Permalink
Merge pull request cli#2455 from ismaell/install-target
Browse files Browse the repository at this point in the history
Add make (un)install targets for POSIX systems 

Fixes cli#293
  • Loading branch information
mislav authored Dec 1, 2020
2 parents 34d549e + 6f689ff commit faa1e44
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 9 additions & 7 deletions docs/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@
$ cd gh-cli
```

2. Build the project
2. Build and install

```
$ make
```sh
# installs to '/usr/local' by default; sudo may be required
$ make install
```

3. Move the resulting `bin/gh` executable to somewhere in your PATH

To install to a different location:
```sh
$ sudo mv ./bin/gh /usr/local/bin/
$ make install prefix=/path/to/gh
```

4. Run `gh version` to check if it worked.
Make sure that the `${prefix}/bin` directory is in your PATH.

3. Run `gh version` to check if it worked.

0 comments on commit faa1e44

Please sign in to comment.