From e185302039bad1059a9d5077f145499e570a05d2 Mon Sep 17 00:00:00 2001 From: awalvie Date: Wed, 13 Dec 2023 15:53:37 +0100 Subject: [PATCH] feat: Add Makefile to project Add a makefile to the project to support the following operations: - build - install - clean - deps - watch - help Update the README to use the Makefile command as well and move from using `go build` to `go install` in the Makefile. --- Makefile | 40 ++++++++++++++++++++++++++++++++++++++++ README.md | 4 +--- 2 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7055d7f --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ +NAME=slick +VERSION=0.0.1 + +.DEFAULT_GOAL := help + +.PHONY: build +## build: Compile the packages. +build: + @go build -v -o bin/$(NAME) cmd/$(NAME)/main.go + +.PHONY: install +## install: Install the packages. +install: build + @mv bin/$(NAME) $(GOPATH)/bin/$(NAME) + +.PHONY: clean +## clean: Clean projects and previous builds +clean: + @rm -rf bin/* + +.PHONY: deps +## deps: Download modules +deps: + @go mod download + +.PHONY: watch +## watch: Reload the app whenever the source changes +watch: + @which reflex > /dev/null || (go install github.com/cespare/reflex@latest) + reflex -s -r '\.go$$' make run + +.PHONY: help +all: help +## help: show this help message +help: Makefile + @echo + @echo " Choose a command to run:" + @echo + @sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /' + @echo diff --git a/README.md b/README.md index 1f60490..64c012f 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,9 @@ To start using Slick Deploy, install it right from the source: ```bash git clone https://github.com/scmmishra/slick-deploy.git cd slick-deploy -go build -o slick ./cmd/slick +make install ``` -You can now move the slick binary to a directory in your PATH to make it globally accessible. - ### Usage To deploy an application: