Skip to content

Commit 81761ef

Browse files
Update Makefile
1 parent 328072c commit 81761ef

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

Makefile

+33-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
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)
35

46
.PHONY: test
57
test: format
@@ -9,19 +11,39 @@ test: format
911
# format Crystal code as well
1012
crystal tool format --check src spec
1113

12-
.PHONY: build
13-
build: $(BIN)/catalog_tools
14+
.PHONY: format
15+
format: bin/catalog_tools
16+
bin/catalog_tools format
1417

15-
$(BIN)/catalog_tools: src/* shard.lock
18+
bin/catalog_tools: $(SRC_SOURCES) $(LIB_SOURCES) lib
1619
$(SHARDS) build catalog_tools
1720

21+
.PHONY: build
22+
build: bin/catalog_tools
23+
24+
lib: shard.lock
25+
$(SHARDS) install
26+
1827
shard.lock: shard.yml
1928
$(SHARDS) update
2029

21-
.PHONY: format
22-
format: $(BIN)/catalog_tools
23-
$(BIN)/catalog_tools format
24-
2530
.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}'

src/awesome_list.cr

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#! /usr/bin/env crystal
2-
#
31
require "http/client"
42
require "file_utils"
53
require "shardbox-core/catalog"

0 commit comments

Comments
 (0)