-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (30 loc) · 999 Bytes
/
Makefile
File metadata and controls
36 lines (30 loc) · 999 Bytes
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
.PHONY: run test build clean help
GOOS = $(shell go env GOOS)
DISPLAY_INDEX?=1
TIMEOUT?=5s
## run: запустить программу. Можно установить значения переменных DISPLAY и/или TIMEOUT.
run:
go run cmd/screenmon/main.go -d=$(DISPLAY_INDEX) -t=$(TIMEOUT)
## test: запустить тесты
test:
go test ./...
## build: создать исполняемый файл
build:
ifeq ($(GOOS),windows)
go build -o bin/screenmon.exe -ldflags "-s -w" cmd/screenmon/main.go
else
go build -o bin/screenmon -ldflags "-s -w" cmd/screenmon/main.go
endif
## clean: удалить содержимое папки bin
clean:
ifeq ($(GOOS),windows)
powershell "Get-ChildItem bin/* -Recurse | Remove-Item -Recurse"
else
rm -rf bin/*
endif
help: Makefile
ifeq ($(GOOS),windows)
@powershell '(Get-Content $< -Encoding utf8) -match "^##" -replace "^##(.*?):\s(.*?)"," `$$1`t`$$2"'
else
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
endif