From 66df573c280caeb1f21a776b2f574a19c81cf424 Mon Sep 17 00:00:00 2001 From: Matthew Strasiotto <39424834+matthewstrasiotto@users.noreply.github.com> Date: Thu, 24 Sep 2020 05:51:43 +1000 Subject: [PATCH] Update makefile so make all works in any state (after a full clean) (#13) * Update makefile so make all works in any state (after a full clean) * Mark "all" as phony * Explicit phony frontend target always triggers rebuild of frontend * Add rebuild target that always triggers full build --- Makefile | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index cf21515..d0b357d 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,36 @@ TTY_SERVER=./tty-server -TTY_SERVER_ASSETS=$(wildcard frontend/public/*) +TTY_SERVER_ASSETS=$(wildcard frontend/public/*) frontend/public/index.html TTY_SERVER_SRC=$(wildcard *.go) assets_bundle.go +.PHONY: all frontend clean cleanfront rebuild + all: $(TTY_SERVER) @echo "Done" +rebuild: clean all + # Building the server and tty-share $(TTY_SERVER): $(TTY_SERVER_SRC) go build -o $@ assets_bundle.go: $(TTY_SERVER_ASSETS) go get github.com/go-bindata/go-bindata/... - go-bindata --prefix frontend/public/ -o $@ $^ + go-bindata --prefix frontend/public/ -o $@ frontend/public/* %.zip: % zip $@ $^ -frontend: force +frontend: cleanfront frontend/public/index.html + +frontend/public/index.html: cd frontend && npm install && npm run build && cd - -force: -clean: - rm -fr tty-server assets_bundle.go frontend/public +cleanfront: + rm -fr frontend/public + +clean: cleanfront + rm -fr tty-server assets_bundle.go @echo "Cleaned" ## Development helper targets