Skip to content

Commit

Permalink
chore: clean targets and vars in Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
f1zm0 committed Jan 11, 2023
1 parent 93785f0 commit 7d5b09a
Showing 1 changed file with 4 additions and 35 deletions.
39 changes: 4 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,43 +1,20 @@
# --- Go Variables
GO=$(shell which go)
GOINSTALL=${GO} install
GOGET=${GO} get
GOBUILD=${GO} build
GOTEST=${GO} test

# --- Config Variables
WIN_ARCHS=amd64 # 386 (not supported yet)
COMMIT_ID=$(shell git rev-parse --short HEAD)
TODAY=$(shell date +%d/%m/%y)

ifdef VERSION
VERSION := $(VERSION)
else
VERSION := dev
endif

# --- Project Vars
PROJ_NAME=hades
PROJ_MOD_PREFIX=github.com/f1zm0/hades
BUILD_PATH=${CURDIR}/dist
ENTRYPOINT=${CURDIR}/cmd/hades/main.go

# --- Compiler Vars
GCFLAGS=-gcflags=all=-trimpath=$(GOPATH)
ASMFLAGS=-asmflags=all=-trimpath=$(GOPATH)
# LDFLAGS="-s -w -H=windowsgui"
LDFLAGS="-s -w"


# --- Targets
.PHONY: default
default: build


.PHONY: help
## help: prints an help message with all the available targets
help:
@echo "Usage: \n"
@echo -e "Usage: \n"
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'


Expand All @@ -47,17 +24,9 @@ clean:
@if [ -d "${BUILD_PATH}" ]; then ${RM} ${BUILD_PATH}/* ; fi


.PHONY: test
## test: test code base using go test
test:
${GOTEST} ./... -v -cover


.PHONY: build
## build: builds binary for Windows
build:
@for ARCH in ${WIN_ARCHS}; do \
echo "Building binaries for Windows $${ARCH} ..."; \
GOOS=windows GOARCH=$${ARCH} ${GOBUILD} -ldflags=${LDFLAGS} ${GCFLAGS} ${ASMFLAGS} \
-o ${BUILD_PATH}/${PROJ_NAME}-win-$${ARCH}-${VERSION}.exe ${ENTRYPOINT} || exit 1;\
done;
@echo "Building binaries for Windows x64 ..."; \
GOOS=windows GOARCH=amd64 go build -ldflags=${LDFLAGS} ${GCFLAGS} ${ASMFLAGS} \
-o ${BUILD_PATH}/${PROJ_NAME}.exe ${ENTRYPOINT} || exit 1; \

0 comments on commit 7d5b09a

Please sign in to comment.