From 245b9ac6968a7e7a8598c55dd298d10d9fc863ba Mon Sep 17 00:00:00 2001 From: David Krutsko Date: Tue, 27 Jun 2023 16:52:01 -0400 Subject: [PATCH] Add makefile --- .gitignore | 3 +++ Makefile | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 3388995..da35c5f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # Generic .DS_Store +# Bin +/bin/ + # Logs *.log /logs/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d3fc542 --- /dev/null +++ b/Makefile @@ -0,0 +1,46 @@ +##----------------------------------------------------------------------------## +## Variables ## +##----------------------------------------------------------------------------## + +OUTPUT = ./bin/ +BINARY = systags + +##----------------------------------------------------------------------------## +## Help ## +##----------------------------------------------------------------------------## + +.PHONY: help + +help: + @echo + @echo "WELCOME TO SYSTAGS" + @echo "------------------" + @echo + @echo "MAKE" + @echo " $$ make help - Prints out these help instructions" + @echo " $$ make build - Builds systags binary for this OS" + @echo " $$ make clean - Cleans and removes generated files" + @echo " $$ make publish - Builds artifacts for a new release" + @echo + @echo "DOCS" + @echo " Visit https://github.com/StackAdapt/systags for more" + @echo + +##----------------------------------------------------------------------------## +## Build ## +##----------------------------------------------------------------------------## + +.PHONY: build clean publish + +build: + go build -o "$(OUTPUT)$(BINARY)" + +clean: + rm -rf "$(OUTPUT)" + +publish: clean + env GOOS=linux GOARCH=amd64 go build -o "$(OUTPUT)$(BINARY)_linux_amd64/$(BINARY)" + env GOOS=linux GOARCH=arm64 go build -o "$(OUTPUT)$(BINARY)_linux_arm64/$(BINARY)" + + tar -czf "$(OUTPUT)$(BINARY)_linux_amd64.tar.gz" -C "$(OUTPUT)" "$(BINARY)_linux_amd64" + tar -czf "$(OUTPUT)$(BINARY)_linux_arm64.tar.gz" -C "$(OUTPUT)" "$(BINARY)_linux_arm64"