Skip to content

Commit

Permalink
Add a simple Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
hrs committed May 16, 2023
1 parent 69dee47 commit 68c9692
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Build parameters
GOCMD=go
GOBUILD=$(GOCMD) build
BINARY=docsim

# Install parameters
PREFIX=/usr/local
INSTDIR=$(DESTDIR)$(PREFIX)/bin
MANDIR=$(DESTDIR)$(PREFIX)/share/man/man1
MANPAGE=$(BINARY).1

.PHONY: build
build: $(BINARY)

$(BINARY): $(shell find . -iname *.go)
$(GOBUILD) -o $(BINARY) -v ./...

.PHONY: install
install: $(BINARY)
mkdir -p $(INSTDIR) $(MANDIR)
cp $(BINARY) $(INSTDIR)
install -m 644 man/$(MANPAGE) $(MANDIR)/$(MANPAGE)

.PHONY: uninstall
uninstall:
rm -f $(INSTDIR)/$(BINARY)
rm -f $(MANDIR)/$(MANPAGE)

.PHONY: deps
deps:
go mod download

.PHONY: test
test:
go test -race -v ./...
go vet ./...

.PHONY: clean
clean:
rm -f $(BINARY)
go clean

0 comments on commit 68c9692

Please # to comment.