Debian Codegraph @

examples/Makefile

raw symbols SCIP
1 NO_COLOR=\033[0m
2 OK_COLOR=\033[0;32m
3
4 ALL_GO_FILES = $(wildcard */*.go)
5 ALL_BIN_FILES = $(patsubst %.go,%,$(ALL_GO_FILES))
6
7 all: $(ALL_GO_FILES)
8
9 define PROGRAM_template
10 $(1): vet
11 @echo "$(OK_COLOR)==> Building $(1) $(NO_COLOR)"
12 @cd $(dir $1); go build
13 endef
14
15 $(foreach prog,$(ALL_GO_FILES),$(eval $(call PROGRAM_template,$(prog))))
16
17 clean:
18 @$(foreach file,$(ALL_BIN_FILES),rm -f $(file);)
19
20 format:
21 @echo "$(OK_COLOR)==> Formatting the code $(NO_COLOR)"
22 @$(foreach file,$(ALL_GO_FILES),gofmt -s -w $(file);)
23 @$(foreach file,$(ALL_GO_FILES),goimports -w $(file);)
24
25 vet:
26 @echo "$(OK_COLOR)==> Running go vet $(NO_COLOR)"
27 @$(foreach file,$(ALL_GO_FILES),go vet -all $(file);)
28
29 lint:
30 @echo "$(OK_COLOR)==> Running golint $(NO_COLOR)"
31 @$(foreach file,$(ALL_GO_FILES),golint $(file);)
32
33 .PHONY: all clean format vet lint