38 lines
772 B
Makefile
Executable File
38 lines
772 B
Makefile
Executable File
TARGET=mccl
|
|
|
|
ifeq ($(shell go env GOOS),windows)
|
|
EXEC_NAME=${TARGET}.exe
|
|
else
|
|
EXEC_NAME=${TARGET}
|
|
endif
|
|
DESTDIR:=
|
|
PREFIX:=/usr/local
|
|
|
|
VERSION=0.1.5
|
|
|
|
FLAGS:=-buildmode=pie -modcacherw -mod=readonly -trimpath
|
|
LDFLAGS:= -ldflags "-s -w -X main.programVersion=${VERSION}"
|
|
|
|
.PHONY: ${TARGET} install uninstall clean
|
|
|
|
${TARGET}:
|
|
ifeq ($(shell go env GOOS),windows)
|
|
go build -o bin/$@.exe ${LDFLAGS} ${FLAGS} cmd/$@/main.go
|
|
else
|
|
go build -o bin/$@ ${LDFLAGS} ${FLAGS} cmd/$@/main.go
|
|
endif
|
|
|
|
install:
|
|
ifeq ($(shell go env GOOS),windows)
|
|
else
|
|
install -Dm 0755 bin/${EXEC_NAME} ${DESTDIR}${PREFIX}/bin/${EXEC_NAME}
|
|
endif
|
|
|
|
uninstall:
|
|
ifeq ($(shell go env GOOS),windows)
|
|
else
|
|
rm ${DESTDIR}${PREFIX}/bin/${EXEC_NAME}
|
|
endif
|
|
|
|
clean:
|
|
rm -f bin/*
|