mccl/Makefile

38 lines
772 B
Makefile
Raw Normal View History

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