-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (29 loc) · 1016 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
32
33
34
35
36
37
RUN:=yarn
NAME:=sprint-review
# STYLE #
ERROR=\x1b[41m
SUCCESS=\x1b[42m
RESET=\x1b[0m
WARN=\x1b[30;43m
# ------------------------------------------------------------------------------------ #
# Função para executar comandos dentro do workspace
define run_in_workspace
@echo ------------------------------------------------------------------------------;
@printf "${WARN} RUNNING ${RESET}: $(1) - $(2) $(3)\n";
@echo ;
@$(RUN) workspace @$(NAME)/$(1) $(2) $(3)
@if [ $$? -eq 0 ]; then \
printf "${SUCCESS} SUCCESS ${RESET}: $(1) - $(2) $(3)\n"; \
echo ------------------------------------------------------------------------------; \
fi
endef
# Extrair parâmetros dos argumentos posicionais
.PHONY: run
run:
$(eval PROJECT := $(word 2, $(MAKECMDGOALS)))
$(eval CMD := $(wordlist 3, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS)))
$(call run_in_workspace,$(PROJECT),$(CMD))
# Para evitar que make tente interpretar os argumentos como alvos
%:
@:
# ----------------------------------------------- #