forked from Threagile/threagile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (56 loc) · 1.6 KB
/
Makefile
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
# Files and Folders
ASSET_DIR = $(HOME)/.threagile
BIN_DIR = $(HOME)/bin
ASSETS = \
LICENSE.txt \
report/template/background.pdf \
support/openapi.yaml \
support/schema.json \
support/live-templates.txt \
pkg/types/technologies.yaml \
server
BIN = \
risk_demo_rule \
threagile
# Commands and Flags
GOFLAGS = -a -ldflags="-s -w -X main.buildTimestamp=$(shell date '+%Y%m%d%H%M%S')"
GO = env GO111MODULE=on go
MKDIR = mkdir -p
CP = cp -r
RM = rm -rf
GOSEC = /opt/homebrew/bin/gosec
# Targets
.phony: all prep run_tests clean tidy install uninstall gosec gv
default: all
all: prep run_tests $(addprefix bin/,$(BIN))
prep:
@# env GO111MODULE=on go mod vendor
$(MKDIR) bin
run_tests:
$(GO) test ./...
clean:
$(RM) bin vendor
tidy: clean
$(RM) .DS_Store
$(RM) just-for-docker-build-?.txt
$(RM) data-asset-diagram.* data-flow-diagram.*
$(RM) report.pdf risks.xlsx tags.xlsx risks.json technical-assets.json stats.json
$(RM) *.exe *.exe~ *.dll *.so *.dylibc *.test *.out
install: all
mkdir -p $(BIN_DIR) $(ASSET_DIR)
$(CP) $(addprefix bin/,$(BIN)) $(BIN_DIR)
$(CP) $(ASSETS) $(ASSET_DIR)
$(CP) demo/example/threagile.yaml $(ASSET_DIR)/threagile-example-model.yaml
$(CP) demo/stub/threagile.yaml $(ASSET_DIR)/threagile-stub-model.yaml
uninstall:
$(RM) $(addprefix $(BIN_DIR)/,$(BIN))
$(RM) $(ASSET_DIR)
gosec:
$(GOSEC) ./...
gv: out/tmp/diagram.png
out/tmp/diagram.png: out/tmp/diagram.gv
dot -Tpng $< -o $@
bin/risk_demo_rule: cmd/risk_demo/main.go
$(GO) build $(GOFLAGS) -o $@ $<
bin/threagile: cmd/threagile/main.go
$(GO) build $(GOFLAGS) -o $@ $<