2023-10-30 02:18:41 +04:00
|
|
|
TARGET=mccl
|
|
|
|
|
|
|
|
ifeq ($(shell go env GOOS),windows)
|
|
|
|
EXEC_NAME=${TARGET}.exe
|
|
|
|
else
|
|
|
|
EXEC_NAME=${TARGET}
|
|
|
|
endif
|
|
|
|
DESTDIR:=
|
|
|
|
PREFIX:=/usr/local
|
|
|
|
|
2024-12-21 20:13:13 +04:00
|
|
|
VERSION=0.1.5
|
2023-10-30 02:18:41 +04:00
|
|
|
|
|
|
|
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:
|
2023-12-09 19:26:27 +04:00
|
|
|
ifeq ($(shell go env GOOS),windows)
|
|
|
|
else
|
2023-10-30 02:18:41 +04:00
|
|
|
install -Dm 0755 bin/${EXEC_NAME} ${DESTDIR}${PREFIX}/bin/${EXEC_NAME}
|
2023-12-09 19:26:27 +04:00
|
|
|
endif
|
2023-10-30 02:18:41 +04:00
|
|
|
|
|
|
|
uninstall:
|
2023-12-09 19:26:27 +04:00
|
|
|
ifeq ($(shell go env GOOS),windows)
|
|
|
|
else
|
2023-10-30 02:18:41 +04:00
|
|
|
rm ${DESTDIR}${PREFIX}/bin/${EXEC_NAME}
|
2023-12-09 19:26:27 +04:00
|
|
|
endif
|
2023-10-30 02:18:41 +04:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f bin/*
|