From 68c96923cdcc6f906494f954f99ff5e3e4758544 Mon Sep 17 00:00:00 2001 From: "Harry R. Schwartz" Date: Tue, 16 May 2023 15:31:57 -0700 Subject: [PATCH] Add a simple Makefile --- Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c09b81b --- /dev/null +++ b/Makefile @@ -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