From d591ea6264bb287a6e57f815a0bc75b7b920bb87 Mon Sep 17 00:00:00 2001
From: Eugene Bujak <hmage@hmage.net>
Date: Wed, 10 Oct 2018 17:56:48 +0300
Subject: [PATCH] Makefile -- run npm build whenever any .js file changes
 inside client/

---
 Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 959a75b8..1c335fd2 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,8 @@ NATIVE_GOARCH = $(shell unset GOARCH; go env GOARCH)
 mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
 mkfile_dir := $(patsubst %/,%,$(dir $(mkfile_path)))
 GOPATH := $(mkfile_dir)/build/gopath
-STATIC := build/static/index.html
+JSFILES = $(shell find client -path client/node_modules -prune -o -type f -name '*.js')
+STATIC = build/static/index.html
 
 .PHONY: all build clean
 all: build
@@ -15,7 +16,7 @@ client/node_modules: client/package.json client/package-lock.json
 	npm --prefix client install
 	touch client/node_modules
 
-$(STATIC): client/node_modules
+$(STATIC): $(JSFILES) client/node_modules
 	npm --prefix client run build-prod
 
 AdguardDNS: $(STATIC) *.go