2018-08-30 17:25:33 +03:00
|
|
|
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
|
|
|
|
NATIVE_GOOS = $(shell unset GOOS; go env GOOS)
|
|
|
|
NATIVE_GOARCH = $(shell unset GOARCH; go env GOARCH)
|
2018-11-09 18:19:55 +03:00
|
|
|
GOPATH := $(shell go env GOPATH)
|
2018-10-10 17:56:48 +03:00
|
|
|
JSFILES = $(shell find client -path client/node_modules -prune -o -type f -name '*.js')
|
|
|
|
STATIC = build/static/index.html
|
2018-08-30 17:25:33 +03:00
|
|
|
|
2018-10-15 16:02:19 +03:00
|
|
|
TARGET=AdGuardHome
|
2018-10-12 16:43:17 +03:00
|
|
|
|
2018-08-30 17:25:33 +03:00
|
|
|
.PHONY: all build clean
|
|
|
|
all: build
|
|
|
|
|
2018-10-12 16:43:17 +03:00
|
|
|
build: $(TARGET)
|
2018-08-30 17:25:33 +03:00
|
|
|
|
2018-09-21 20:01:55 +03:00
|
|
|
client/node_modules: client/package.json client/package-lock.json
|
2018-09-07 16:14:25 +03:00
|
|
|
npm --prefix client install
|
2018-09-21 20:01:55 +03:00
|
|
|
touch client/node_modules
|
|
|
|
|
2018-10-10 17:56:48 +03:00
|
|
|
$(STATIC): $(JSFILES) client/node_modules
|
2018-09-07 16:14:25 +03:00
|
|
|
npm --prefix client run build-prod
|
2018-08-30 17:25:33 +03:00
|
|
|
|
2018-10-12 16:43:17 +03:00
|
|
|
$(TARGET): $(STATIC) *.go coredns_plugin/*.go dnsfilter/*.go
|
2018-11-09 18:19:55 +03:00
|
|
|
GOPATH=$(GOPATH) GOOS=$(NATIVE_GOOS) GOARCH=$(NATIVE_GOARCH) GO111MODULE=off go get -v github.com/gobuffalo/packr/...
|
|
|
|
GOPATH=$(GOPATH) PATH=$(GOPATH)/bin:$(PATH) packr build -ldflags="-X main.VersionString=$(GIT_VERSION)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)" -o $(TARGET)
|
2018-08-30 17:25:33 +03:00
|
|
|
|
|
|
|
clean:
|
2018-09-21 20:01:55 +03:00
|
|
|
$(MAKE) cleanfast
|
2018-09-25 19:25:54 +03:00
|
|
|
rm -rf build
|
|
|
|
rm -rf client/node_modules
|
2018-09-21 20:01:55 +03:00
|
|
|
|
|
|
|
cleanfast:
|
2018-10-12 16:43:17 +03:00
|
|
|
rm -f $(TARGET)
|