-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
31 lines (25 loc) · 904 Bytes
/
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
.PHONY: _tasks
_tasks: .tasks
.PHONY: start
start: stop # start app
@run build env=dev # tasks can be run directly from other tasks
@echo "starting app in 3 seconds"
@loading
@sleep 3
.PHONY: stop
stop: # stop app
@echo "stopping app"
.PHONY: build
build: lint # build app for environment [vars: env]
@[[ -n $(env) ]] && echo "buiding app for $(env)" || echo "error: missing env"
.PHONY: test
test: # run all tests or specific tests [vars: name1, name2, etc.]
@run build env=test
@[[ -n $(@) ]] && echo "running tests $(@)" || echo "running all tests"
.PHONY: lint
lint: # lint all files or specific file [vars: file]
@[[ -n $(1) ]] && echo "linting file $(1)" || echo "linting all files"
.PHONY: .tasks
.tasks:
@grep -E "^(([[:alnum:]_-][[:alnum:][:space:]_-]+):([[:alnum:][:space:]_-]+)?#)" $(MAKEFILE_LIST) \
| sed -Ee "s/^/ /" -e 's/[[:space:]]*:[[:alnum:] _-]*#[[:space:]]*/ · /'