1
- BIN ?= bin
2
- SHARDS := shards
1
+ SHARDS ::= shards
2
+
3
+ SRC_SOURCES ::= $(shell find src -name '* .cr' 2>/dev/null)
4
+ LIB_SOURCES ::= $(shell find lib -name '* .cr' 2>/dev/null)
3
5
4
6
.PHONY : test
5
7
test : format
@@ -9,19 +11,39 @@ test: format
9
11
# format Crystal code as well
10
12
crystal tool format --check src spec
11
13
12
- .PHONY : build
13
- build : $(BIN ) /catalog_tools
14
+ .PHONY : format
15
+ format : bin/catalog_tools
16
+ bin/catalog_tools format
14
17
15
- $( BIN ) /catalog_tools : src/ * shard.lock
18
+ bin /catalog_tools : $( SRC_SOURCES ) $( LIB_SOURCES ) lib
16
19
$(SHARDS ) build catalog_tools
17
20
21
+ .PHONY : build
22
+ build : bin/catalog_tools
23
+
24
+ lib : shard.lock
25
+ $(SHARDS ) install
26
+
18
27
shard.lock : shard.yml
19
28
$(SHARDS ) update
20
29
21
- .PHONY : format
22
- format : $(BIN ) /catalog_tools
23
- $(BIN ) /catalog_tools format
24
-
25
30
.PHONY : clean
26
- clean :
27
- rm -f $(BIN ) /catalog_tools
31
+ clean : # # Remove application binary
32
+ rm -f bin/catalog_tools
33
+
34
+ .PHONY : help
35
+ help : # # Show this help
36
+ @echo
37
+ @printf ' \033[34mtargets:\033[0m\n'
38
+ @grep -hE ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | \
39
+ sort | \
40
+ awk ' BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
41
+ @echo
42
+ @printf ' \033[34moptional variables:\033[0m\n'
43
+ @grep -hE ' ^[a-zA-Z_-]+ \?=.*?## .*$$' $(MAKEFILE_LIST ) | \
44
+ sort | \
45
+ awk ' BEGIN {FS = " \\?=.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
46
+ @echo
47
+ @printf ' \033[34mrecipes:\033[0m\n'
48
+ @grep -hE ' ^##.*$$' $(MAKEFILE_LIST ) | \
49
+ awk ' BEGIN {FS = "## "}; /^## [a-zA-Z_-]/ {printf " \033[36m%s\033[0m\n", $$2}; /^## / {printf " %s\n", $$2}'
0 commit comments