~yerinalexey/rex

01a437f3c49159f1021a55b816d4a1aaf7d16eeb — Alexey Yerin 4 months ago 874a837
Improve overall installation process
2 files changed, 44 insertions(+), 3 deletions(-)

A Makefile
M README.md
A Makefile => Makefile +26 -0
@@ 0,0 1,26 @@
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin

GO ?= go
GOFLAGS ?=

GOSRC := $(shell find . -name '*.go')
GOSRC += go.mod go.sum

RM ?= rm -f

all: rex

rex: $(GOSRC)
	$(GO) build $(GOFLAGS) -o $@

install: all
	install -D -m755 rex $(DESTDIR)$(BINDIR)/rex

uninstall:
	$(RM) $(DESTDIR)$(BINDIR)/rex

clean:
	$(RM) rex

.PHONY: all clean install uninstall

M README.md => README.md +18 -3
@@ 7,16 7,31 @@ playground section on [ihateregex.io][ihateregex].
[ihateregex]: https://ihateregex.io/playground/

# Installation
Dependencies:
- Go >=1.15
- GNU Make

With the repository checked out:

```sh
go get -u git.sr.ht/~yerinalexey/rex
make
make install
```

Make sure to add `$GOPATH/bin` to your `$PATH` variable if not already:
This will install everything into `/usr/local` by default so you might
need root access to do this. Alternatively you can install into a
different directory by setting `PREFIX`. For example:

```sh
export PATH="$PATH:$GOPATH/bin"
make install PREFIX="$HOME/.local"
```

will instal `rex` into `~/.local/bin`.

For packagers: you can set `DESTDIR` to install into a different system
root, e.g. use `make install DESTDIR="$pkgdir" PREFIX=/usr` on Arch and
Alpine.

# Usage
```
$ rex [flags] [file]