forked from xtacocorex/Gadget-OS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
85 lines (70 loc) · 2.4 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
GADGET_DIR = "$(PWD)/"
IMAGE_DIR = "$(PWD)/output/images"
TOP=$(CURDIR)
OUTPUT_DIR?=/opt/output
BR_DIR?=/opt/buildroot
ifneq ($(strip $(TERM)),)
INTERACTIVE = -it
else
INTERACTIVE =
endif
ifeq ($(strip $(no_docker)),)
ID=$(shell cat scripts/id)
ifeq ($(strip $(ID)),)
$(error scripts/id not found! please run `scripts/init-container` )
endif
GADGET_CONTAINER = gadget-build-container
BUILD_OUTPUT_VOL = "gadget-build-output-${ID}"
DL_CACHE_VOL = "gadget-build-dlcache-${ID}"
TMP_VOL = "gadget-build-tmp-${ID}"
BR2_EXTERNAL?=/opt/gadget-os-proto/gadget
DOCKER = \
echo "------------------------------------------------------------"; \
echo " Running Docker - hit CTRL-C then CTRL-\ to interrupt"; \
echo "------------------------------------------------------------"; \
docker run \
--rm \
--env BR2_DL_DIR=/opt/dlcache/ \
--env BR2_EXTERNAL=${BR2_EXTERNAL} \
--volume=${DL_CACHE_VOL}:/opt/dlcache/ \
--volume=${BUILD_OUTPUT_VOL}:/opt/output \
--volume=${IMAGE_DIR}:/opt/output/images \
--volume=${GADGET_DIR}:/opt/gadget-os-proto \
--volume=${GADGET_DIR}/local:/local \
--volume=${TMP_VOL}:/tmp \
--name=gadget-build-task \
-w="/opt/gadget-os-proto" \
${INTERACTIVE} \
${GADGET_CONTAINER}
else
$(info PWD=$(PWD) )
$(info CURDIR=$(CURDIR) )
$(info "NO DOCKER")
BR2_EXTERNAL?=$(CURDIR)/gadget
export BR2_EXTERNAL
DOCKER =
endif
all:
@$(DOCKER) make -C $(BR_DIR) O=$(OUTPUT_DIR)
gadget_export_linux_defconfig:
@$(DOCKER) cp /opt/gadget-os-proto/gadget/board/nextthing/$(BOARD)/configs/linux.config /save/$(BOARD)-linux.config
gadget_edit_linux_defconfig:
@echo BR2_EXTERNAL=$(BR2_EXTERNAL)
@$(DOCKER) make -C $(BR_DIR) O=$(OUTPUT_DIR) linux-menuconfig && $(DOCKER) make -C $(BR_DIR) O=$(OUTPUT_DIR) linux-update-config
gadget_build:
@echo BR2_EXTERNAL=$(BR2_EXTERNAL)
@$(DOCKER) make -C $(BR_DIR) O=$(OUTPUT_DIR) $(BOARD)_defconfig && $(DOCKER) make -C $(BR_DIR) O=$(OUTPUT_DIR)
%_defconfig:
@echo BR2_EXTERNAL=$(BR2_EXTERNAL)
@$(DOCKER) make -C $(BR_DIR) O=$(OUTPUT_DIR) $@
%:
@$(DOCKER) make -C $(BR_DIR) O=$(OUTPUT_DIR) $@
nconfig:
@$(DOCKER) make -C $(BR_DIR) O=$(OUTPUT_DIR) nconfig
SHELL:
@$(DOCKER) /bin/bash
CLEAN_TARGET:
@$(DOCKER) bash -c 'find /opt/output/build -name ".stamp_target_installed" -exec rm \{\} \; && rm -r /opt/output/target/*'
help:
@$(foreach b, $(sort $(notdir $(wildcard $(BR2_EXTERNAL_GADGETOS_PATH)/configs/*_defconfig))), \
printf " %-29s - Build for %s\\n" $(b) $(b:_defconfig=);)