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