2018-08-30 15:25:33 +01: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 15:19:55 +00:00
|
|
|
GOPATH := $(shell go env GOPATH)
|
2018-10-10 15:56:48 +01:00
|
|
|
JSFILES = $(shell find client -path client/node_modules -prune -o -type f -name '*.js')
|
|
|
|
STATIC = build/static/index.html
|
2019-06-06 01:00:15 +01:00
|
|
|
CHANNEL ?= release
|
2018-08-30 15:25:33 +01:00
|
|
|
|
2018-10-15 14:02:19 +01:00
|
|
|
TARGET=AdGuardHome
|
2018-10-12 14:43:17 +01:00
|
|
|
|
2018-08-30 15:25:33 +01:00
|
|
|
.PHONY: all build clean
|
|
|
|
all: build
|
|
|
|
|
2018-10-12 14:43:17 +01:00
|
|
|
build: $(TARGET)
|
2018-08-30 15:25:33 +01:00
|
|
|
|
2018-09-21 18:01:55 +01:00
|
|
|
client/node_modules: client/package.json client/package-lock.json
|
2019-12-19 10:28:08 +00:00
|
|
|
npm --prefix client ci
|
2018-09-21 18:01:55 +01:00
|
|
|
touch client/node_modules
|
|
|
|
|
2018-10-10 15:56:48 +01:00
|
|
|
$(STATIC): $(JSFILES) client/node_modules
|
2018-09-07 14:14:25 +01:00
|
|
|
npm --prefix client run build-prod
|
2018-08-30 15:25:33 +01:00
|
|
|
|
2019-06-10 09:33:19 +01:00
|
|
|
$(TARGET): $(STATIC) *.go home/*.go dhcpd/*.go dnsfilter/*.go dnsforward/*.go
|
2018-11-29 16:40:48 +00:00
|
|
|
GOOS=$(NATIVE_GOOS) GOARCH=$(NATIVE_GOARCH) GO111MODULE=off go get -v github.com/gobuffalo/packr/...
|
|
|
|
PATH=$(GOPATH)/bin:$(PATH) packr -z
|
2020-02-06 17:55:37 +00:00
|
|
|
CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=$(GIT_VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)"
|
2018-11-29 16:40:48 +00:00
|
|
|
PATH=$(GOPATH)/bin:$(PATH) packr clean
|
2018-08-30 15:25:33 +01:00
|
|
|
|
|
|
|
clean:
|
2018-09-21 18:01:55 +01:00
|
|
|
$(MAKE) cleanfast
|
2018-09-25 17:25:54 +01:00
|
|
|
rm -rf build
|
|
|
|
rm -rf client/node_modules
|
2018-09-21 18:01:55 +01:00
|
|
|
|
|
|
|
cleanfast:
|
2018-10-12 14:43:17 +01:00
|
|
|
rm -f $(TARGET)
|