Skip to content

Commit

Permalink
Add makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrutsko committed Jun 27, 2023
1 parent 8409777 commit 245b9ac
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Generic
.DS_Store

# Bin
/bin/

# Logs
*.log
/logs/
Expand Down
46 changes: 46 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 245b9ac

Please sign in to comment.