-
Notifications
You must be signed in to change notification settings - Fork 692
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (37 loc) · 1.13 KB
/
Copy pathMakefile
File metadata and controls
47 lines (37 loc) · 1.13 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
SHELL := /bin/bash
CONF := build-config.json
.PHONY: all
.DEFAULT_GOAL := all
TOOLS := jq
$(foreach tool, $(TOOLS), \
$(if $(shell command -v $(tool)), , $(error "$(tool) is not installed. Please install $(tool) to proceed.")) \
)
COMMON_BRANCH_PATH := $(shell jq -r '.["common-branch-path"]' "$(CONF)")
RELEASE_BRANCH_PATH := $(shell pwd)
STAGE_PATH := $(shell realpath $(shell jq -r '.["stage-path"]' "$(CONF)"))
RELEASE_BRANCH_ID = $(shell pwd | sed 's|/|-|g')
FIRST_PASS_MARKER = /tmp/.first-pass$(RELEASE_BRANCH_ID)
$(shell rm -f $(FIRST_PASS_MARKER))
export COMMON_BRANCH_PATH RELEASE_BRANCH_PATH STAGE_PATH FIRST_PASS_MARKER
define with_pushd
pushd $(COMMON_BRANCH_PATH) > /dev/null && \
{ $(1); } && \
popd > /dev/null
endef
all:
@$(call with_pushd, \
if [ -n "$(pkgs)" ]; then \
python3 build.py -c $(CONF) --pkgs "$(pkgs)"; \
elif [ "$(BUILD_EXTRA_PKGS)" = "1" ]; then \
python3 build.py -c $(CONF) -t extra-packages; \
else \
python3 build.py -c $(CONF) -t packages; \
fi \
)
%:
@$(call with_pushd, \
python3 build.py -c $(CONF) -t "$@" && \
if [[ "$@" != clean* ]]; then \
touch $(FIRST_PASS_MARKER); \
fi \
)