From 99e39fc6c1e0bb533e81350e49fd9d1661eb6c17 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Wed, 20 Sep 2023 04:06:54 +0400 Subject: [PATCH] Added FLAGS, reorganised targets ${TARGET} and web/*.jade.go. Removed all target. Added clean .PHONY target, removed ${TARGET} from .PHONY. In web/*.jade.go added check for jade executable existence. --- Makefile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a98d91f..bbcae29 100755 --- a/Makefile +++ b/Makefile @@ -8,17 +8,18 @@ PREFIX:=/usr/local VERSION=23.32.0 +FLAGS=-buildmode=pie -modcacherw -mod=readonly -trimpath LDFLAGS=-ldflags "-s -w -X main.version=${VERSION}" -tags osusergo,netgo -all: web/*.jade.go ${TARGET} +.PHONY: run install uninstall clean -.PHONY: ${TARGET} - -${TARGET}: - go build -o bin/$@ ${LDFLAGS} cmd/$@/main.go +${TARGET}: web/*.jade.go + go build -o bin/$@ ${LDFLAGS} ${FLAGS} cmd/$@/main.go web/*.jade.go: web/templates/*.jade +ifeq (,$(wildcard $(shell go env GOPATH)/bin/jade)) go install github.com/Joker/jade/cmd/jade@latest +endif go generate web/web.go run: @@ -33,3 +34,7 @@ uninstall: rm ${DESTDIR}${PREFIX}/bin/${TARGET} rm ${DESTDIR}/${SYSDDIR}/${TARGET}.service + +clean: + rm -f web/*.jade.go + go clean \ No newline at end of file