forked from HUSTSeclab/criticality_score
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (30 loc) · 775 Bytes
/
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
# Makefile
# Go commands
GOCMD = go
GOBUILD = $(GOCMD) build
GOCLEAN = $(GOCMD) clean
GOTEST = $(GOCMD) test
GOFMT = $(GOCMD) fmt
# Binary directory
BIN_DIR=./bin
# foreach dir in cmd/*/main.go, set * as the target
# APPS = $(patsubst cmd/%/main.go,%,$(wildcard cmd/**/*/main.go))
APP_ENTRIES = $(wildcard cmd/*/main.go) $(wildcard cmd/*/*/main.go)
APPS_ALL = $(patsubst cmd/%/main.go,%,$(APP_ENTRIES))
APPS = $(filter-out archives/%,$(APPS_ALL))
# $(info $(APPS))
# Default target
all: $(APPS)
# all app targets
$(APPS): %:
$(GOBUILD) -o $(BIN_DIR)/$@ github.com/HUSTSecLab/criticality_score/cmd/$@
# # all binaries
# $(BIN_DIR)/%: cmd/%
fmt:
$(GOFMT) ./...
clean:
$(GOCLEAN)
rm -rf $(BIN_DIR)
test:
$(GOTEST) -v ./...
.PHONY: all build $(APPS) clean test fmt