-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
60 lines (49 loc) · 1.57 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
-include Makefile.local # for optional local options
SHARDS := shards # The shards command to use
CRYSTAL := crystal # The crystal command to use
SRC_SOURCES := $(shell find src lib -name '*.cr' 2>/dev/null)
LIB_SOURCES := $(shell find lib -name '*.cr' 2>/dev/null)
SPEC_SOURCES := $(shell find spec -name '*.cr' 2>/dev/null)
.PHONY: test
test: ## Run test suite
test: test/unit test/integration
.PHONY: test/unit
test/unit: ## Run unit tests
test/unit: lib
$(CRYSTAL) spec
.PHONY: test/integration
test/integration: ## Run integration tests
test/integration:
make -C examples
.PHONY: format
format: ## Apply source code formatting
format: $(SRC_SOURCES) $(SPEC_SOURCES)
$(CRYSTAL) tool format src spec
docs: ## Generate API docs
docs: $(SRC_SOURCES) lib
$(CRYSTAL) docs src/docs.cr
lib: shard.lock
$(SHARDS) install
shard.lock: ## Update shards
shard.lock: shard.yml
$(SHARDS) update
.PHONY: clean
clean: ## Remove application binary
clean:
rm -rf docs
.PHONY: help
help: ## Show this help
@echo
@printf '\033[34mtargets:\033[0m\n'
@grep -hE '^[a-zA-Z/_-]+:.*?## .*$$' $(MAKEFILE_LIST) |\
sort |\
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
@echo
@printf '\033[34moptional variables:\033[0m\n'
@grep -hE '^[a-zA-Z_-]+ \?=.*?## .*$$' $(MAKEFILE_LIST) |\
sort |\
awk 'BEGIN {FS = " \\?=.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
@echo
@printf '\033[34mrecipes:\033[0m\n'
@grep -hE '^##.*$$' $(MAKEFILE_LIST) |\
awk 'BEGIN {FS = "## "}; /^## [a-zA-Z_-]/ {printf " \033[36m%s\033[0m\n", $$2}; /^## / {printf " %s\n", $$2}'