Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (34 loc) · 1.41 KB
/
Copy pathMakefile
File metadata and controls
52 lines (34 loc) · 1.41 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
48
49
50
51
52
all: mettle
include make/Makefile.tools
include make/Makefile.common
include make/Makefile.mettle
DOCKER_CONTAINER=rapid7/build:mettle
DOCKER_TARGET ?= x86_64-linux-musl
# Build mettle inside the official build container (no local toolchain or
# autotools required). Override the arch with DOCKER_TARGET=<triple>. Only the
# mettle checkout is mounted; build artifacts are chowned back to the invoking
# user. Output lands in build/$(DOCKER_TARGET)/bin/{mettle,mettle.bin}.
docker:
docker run --rm -v "$(CURDIR)":/mettle -w /mettle $(DOCKER_CONTAINER) \
bash -c "make TARGET=$(DOCKER_TARGET); rc=$$?; chown -R $(shell id -u):$(shell id -g) /mettle; exit $$rc"
distclean:
@rm -fr $(BUILD)
clean:
@rm -fr $(BUILD)/mettle
ARCHES := $(shell cat ARCHES)
# Create the individual build/clean/dist-clean rules for each arch...
define rules_for_each_arch
$(strip $(1)).build: $(TOOLS)/musl-cross/.unpacked $(ROOT)/mettle/configure
make TARGET=$(strip $(1))
$(strip $(1)).install:
make TARGET=$(strip $(1)) install
$(strip $(1)).clean:
make TARGET=$(strip $(1)) clean
$(strip $(1)).distclean:
make TARGET=$(strip $(1)) distclean
endef
$(foreach a, $(ARCHES), $(eval $(call rules_for_each_arch, $(strip $(a)))))
all-parallel: $(TOOLS) $(patsubst %,%.build,$(ARCHES))
clean-parallel: $(patsubst %,%.clean,$(ARCHES))
distclean-parallel: $(patsubst %,%.distclean,$(ARCHES))
install-parallel: $(patsubst %,%.install,$(ARCHES))