-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (45 loc) · 1.33 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
55
56
57
58
59
60
# # Makefile
.DEFAULT_GOAL := all
SHELL := /bin/sh
# # # Default variables
# # if COMMIT is given, the Dockerfile will reset the git repo to that commit
COMMIT ?= HEAD
DEFAULT_MODE ?= optlinux
BUILD_MODES ?= optlinux tinylinux asan rel
REGISTRY_OWNER ?= local
# # # Help
.PHONY: help
help:
@echo "Usage: make [TARGET: all]"
@echo ""
@echo "TARGET: [OPTION: default]"
@echo " help"
@echo " all"
@echo " build [MODE: $(DEFAULT_MODE)]"
@echo " build-all [BUILD_MODES: $(BUILD_MODES)]"
# # # Default goal
.PHONY: all
all: build
$(info Done running 'make all')
# # # Build
# # Build redbean in the given MODE (default: $(DEFAULT_MODE))
.PHONY: build
build:
ifeq ($(origin MODE), undefined)
$(warning variable MODE is not set. MODE set to $(DEFAULT_MODE))
$(MAKE) --directory=$(CURDIR) build MODE=$(DEFAULT_MODE)
else
$(info Building in '$(MODE)' mode)
DOCKER_BUILDKIT=1 MODE=$(MODE) COMMIT=$(COMMIT) \
docker buildx bake --load --progress=plain scratch
endif
# # Build redbean in all the BUILD_MODES
.PHONY: build-all build-all-%
build-all: $(foreach M, $(BUILD_MODES), build-all-$(M))
build-all-%:
$(MAKE) --directory=$(CURDIR) build MODE=$*
# # Downloads a copy of the repo in a debian container
.PHONY: build-repo
build-repo:
DOCKER_BUILDKIT=1 COMMIT=$(COMMIT) \
docker buildx bake --load --progress=plain debian-repository