This repository was archived by the owner on Jun 6, 2021. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (72 loc) · 1.89 KB
/
Copy pathMakefile
File metadata and controls
88 lines (72 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# TODO: Remove .ONESHELL
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = >
# Default - top level rule is what gets ran when you run just `make`
build: wtfd
.PHONY: build
run: tmp/.js.sentinel
> rm -f tmp/.gen.sentinel
> pushd internal
> packr2 clean
> popd
> go run ./cmd/wtfd.go
.PHONY: run
test: tmp/.test.sentinel
.PHONY: test
clean: tmp/.check-deps.sentinel
> rm -rf tmp
> rm -f wtfd
> rm -rf html/static/*.js html/static/*.js.map
> pushd internal
> packr2 clean
> popd
.PHONY: clean
js-run: tmp/.js-deps.sentinel
> pushd frontend
> yarn run start
> popd
.PHONY: js-run
wtfd: $(shell find . -name '*.go') tmp/.gen.sentinel $(shell find html -name '*.html')
> go build ./cmd/wtfd.go
.PHONY: fmt
fmt:
> find -type f -name "*.go" -exec go fmt {} \;
tmp/.test.sentinel: $(shell find . -name '*.go') tmp/.check-deps.sentinel
> mkdir -p $(@D)
> go test ./...
> touch $@
# go generate
tmp/.gen.sentinel: tmp/.js.sentinel $(shell find html/static/ -type f | grep -v '.js$$' | grep -v '.map$$')
> mkdir -p $(@D)
> go generate ./...
> touch $@
tmp/.js.sentinel: $(shell find frontend/src -type f) tmp/.js-deps.sentinel $(shell find frontend/ -name 'webpack.*.js')
> mkdir -p $(@D)
> pushd frontend
> yarn run build
> popd
> rm -f tmp/.gen.sentinel
> pushd internal
> packr2 clean
> popd
> touch $@
tmp/.js-deps.sentinel: tmp/.check-deps.sentinel
> mkdir -p $(@D)
> pushd frontend
> yarn
> popd
> touch $@
tmp/.check-deps.sentinel:
> mkdir -p $(@D)
> which go || (echo "go not installed"; exit 1)
> which packr2 || (echo "packr2 not installed, run 'go get -u github.com/gobuffalo/packr/v2/packr2' please"; exit 1)
> which yarn || (echo "yarn not installed"; exit 1)
> touch $@