-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
54 lines (42 loc) · 1.31 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
SHELL := /bin/bash
include ./common/credentials.mk
MAKEFILES := $(shell find . -name "Makefile" | grep -E "^./[^/]*/Makefile\$$")
MAKEDIRS := $(patsubst ./%, %, $(patsubst %/Makefile, %, $(MAKEFILES)))
BUILD_CMDS := $(patsubst %, build-%, $(MAKEDIRS))
CLEAN_CMDS := $(patsubst %, clean-%, $(MAKEDIRS))
TAG_LATEST_CMDS := $(patsubst %, tag-latest-%, $(MAKEDIRS))
PUSH_LATEST_CMDS := $(patsubst %, push-latest-%, $(MAKEDIRS))
.DEFAULT_GOAL := help
.PHONY: $(BUILD_CMDS)
$(BUILD_CMDS):
@make -C $(strip $(patsubst build-%, %, $@)) build
.PHONY: $(CLEAN_CMDS)
$(CLEAN_CMDS):
@make -C $(strip $(patsubst clean-%, %, $@)) build
.PHONY: $(PUSH_LATEST_CMDS)
$(PUSH_LATEST_CMDS):
@make -C $(strip $(patsubst push-latest-%, %, $@)) push-latest
.PHONY: $(TAG_LATEST_CMDS)
$(TAG_LATEST_CMDS):
@make -C $(strip $(patsubst tag-latest-%, %, $@)) tag-latest
.PHONY: build
build: $(BUILD_CMDS)
.PHONY: clean
clean: $(CLEAN_CMDS)
.PHONY: tag-latest
tag-latest: $(TAG_LATEST_CMDS)
.PHONY: push-latest
push-latest: $(PUSH_LATEST_CMDS)
.PHONY: help
help:
@echo "Detected sub-dir Makefiles:"
@echo $(MAKEFILES) | tr [:space:] "\n"
@echo
@echo "Available build commands:"
@echo "build"
@echo $(BUILD_CMDS) | tr [:space:] "\n"
@echo
@echo "Available tag commands:"
@echo "tag-latest"
@echo $(TAG_LATEST_CMDS) | tr [:space:] "\n"
@echo