forked from mongoose-os-libs/homekit-adk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (52 loc) · 1.28 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
61
62
63
64
# Use "make TARGET=Linux all" to build for Linux
export
STEPS := all tests apps clean check info tools %.debug
.PHONY: $(STEPS) %.debug shell docker
CWD := $(shell pwd)
HOST := $(shell uname)
TARGET ?= $(HOST)
BUILD_TYPE ?= Debug
MAKE := make -f Build/Makefile -j 8
DOCKER := docker
DOCKERFILE := Build/Docker/Dockerfile
ifeq ($(TARGET),Raspi)
DOCKERFILE := Build/Docker/Dockerfile.Raspi
endif
ENABLE_TTY =
MAKE_DOCKER = $(DOCKER) build - < $(DOCKERFILE) | tee /dev/stderr | grep "Successfully built" | cut -d ' ' -f 3
RUN = $(DOCKER) run \
-e APPS \
-e BUILD_TYPE \
-e HOST \
-e LOG_LEVEL \
-e PROTOCOLS \
-e TARGET \
-e USE_HW_AUTH \
-e USE_NFC \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
--mount type=bind,source="$(CWD)",target=/build \
--rm \
-i $(ENABLE_TTY) `$(MAKE_DOCKER)`
ifeq ($(HOST)$(TARGET),LinuxDarwin)
$(error Can't build $(TARGET) on $(HOST).)
endif
ifneq ($(TARGET),Darwin)
ifneq (,$(wildcard /.dockerenv))
# If we are already running inside docker
MAKE := $(MAKE)
else
# Else run make inside docker
MAKE := $(RUN) $(MAKE)
endif
endif
define make_target
$(1):
@$(2) $$@
endef
$(eval $(foreach step,$(STEPS),$(call make_target,$(step),$(MAKE) PAL=$(TARGET))))
shell: ENABLE_TTY=-t
shell:
@$(RUN) bash
docker:
@$(MAKE_DOCKER)