File: Makefile

package info (click to toggle)
golang-gopkg-lxc-go-lxc.v2 0.0~git20181101.0aadfc3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 388 kB
  • sloc: ansic: 491; makefile: 75
file content (33 lines) | stat: -rw-r--r-- 675 bytes parent folder | download
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
NO_COLOR=\033[0m
OK_COLOR=\033[0;32m

ALL_GO_FILES = $(wildcard *.go)
ALL_FILES = $(patsubst %.go,%,$(ALL_GO_FILES))

all: $(ALL_FILES)

define PROGRAM_template
$(1): format vet lint
	@echo "$(OK_COLOR)==> Building $(1) $(NO_COLOR)"
	@go build $(1).go
endef

$(foreach prog,$(ALL_FILES),$(eval $(call PROGRAM_template,$(prog))))

clean:
	@$(foreach file,$(ALL_FILES),rm -f $(file);)

format:
	@echo "$(OK_COLOR)==> Formatting the code $(NO_COLOR)"
	@gofmt -s -w *.go
	@goimports -w *.go

vet:
	@echo "$(OK_COLOR)==> Running go vet $(NO_COLOR)"
	@`which go` vet .

lint:
	@echo "$(OK_COLOR)==> Running golint $(NO_COLOR)"
	@`which golint` .

.PHONY: all clean format vet lint