Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
108 lines (81 loc) · 2.59 KB
/
Copy pathMakefile
File metadata and controls
108 lines (81 loc) · 2.59 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
.PHONY: all compile clean test dialyzer xref format format-check lint docs console check coverage publish fetch-cards example
REBAR := rebar3
APP_NAME := graffeo
APP_VERSION := $(shell grep vsn src/$(APP_NAME).app.src | cut -d'"' -f2)
DOC_DIR := doc
all: compile
compile:
@$(REBAR) compile
clean:
@$(REBAR) clean
@rm -rf _build logs erl_crash.dump doc
test:
@mkdir -p logs
@$(REBAR) do eunit --cover, ct --cover, proper -c
@$(REBAR) cover
coverage: test
@escript scripts/check_coverage.escript
dialyzer:
@$(REBAR) dialyzer
xref:
@$(REBAR) xref
format:
@$(REBAR) fmt
lint:
@$(REBAR) lint
console:
@$(REBAR) shell
check: clean compile format-check xref dialyzer lint coverage
@echo "All checks passed!"
format-check:
@$(REBAR) fmt --check
# Testing helpers
test-unit:
@$(REBAR) eunit
test-integration:
@$(REBAR) ct
test-property:
@$(REBAR) proper -c
# Coverage report
coverage-report:
@$(REBAR) cover
@echo "Coverage report generated in _build/test/cover/index.html"
# Static analysis
analyze: xref dialyzer lint
@echo "Static analysis complete"
# Clean everything including deps
distclean: clean
@rm -rf _build
@echo "Deep clean complete"
$(DOC_DIR):
@$(REBAR) ex_doc
@echo "Documentation generated in $(DOC_DIR)/"
docs: clean $(DOC_DIR)
publish: docs
@echo "Publishing $(APP_NAME) v$(APP_VERSION)..."
@$(REBAR) hex publish package
## === Erlang-concepts example (delegates to examples/erlang-concepts/Makefile) ===
EXAMPLE_DIR := examples/erlang-concepts
fetch-cards:
@$(MAKE) -C $(EXAMPLE_DIR) fetch-cards
example:
@$(MAKE) -C $(EXAMPLE_DIR) example
# Help
help:
@echo "$(APP_NAME) v$(APP_VERSION) - Available targets:"
@echo " make compile - Compile the project"
@echo " make test - Run all tests"
@echo " make dialyzer - Run Dialyzer"
@echo " make xref - Run xref analysis"
@echo " make format - Format code"
@echo " make lint - Run linter (elvis)"
@echo " make console - Start Erlang shell with app loaded"
@echo " make check - Run all checks (xref, dialyzer, lint, tests)"
@echo " make analyze - Run static analysis (xref, dialyzer, lint)"
@echo " make coverage - Run tests and assert >=95% executable-line coverage"
@echo " make docs - Generate documentation (ex_doc)"
@echo " make coverage-report - Generate coverage report"
@echo " make publish - Publish to Hex"
@echo " make fetch-cards - Shallow-clone the concept-cards corpus"
@echo " make example - Build and run the erlang-concepts example"
@echo " make help - Show this help message"