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.
This commit is contained in:
parent
5cc9b12030
commit
99e39fc6c1
15
Makefile
15
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
|
Loading…
Reference in New Issue
Block a user