-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (71 loc) · 2.54 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
86
87
88
89
90
91
92
93
ARCH = i386
TOP_D = $(shell pwd)
BR_D = $(TOP_D)/buildroot
OUT_D = $(TOP_D)/output/$(ARCH)
BR_OUT_D = $(OUT_D)/buildroot
CONF_D = $(TOP_D)/conf
DL_D = $(TOP_D)/download
SKEL_D = $(OUT_D)/skeleton
TMPDIR ?= $(OUT_D)/tmp
export TMPDIR
DISK_IMG = $(OUT_D)/disk.img
PART_IMG = $(OUT_D)/part.img
TAR_IMG = $(OUT_D)/rootfs.tar
BR_TAR_IMG = $(BR_OUT_D)/images/rootfs.tar
BR2_CCACHE_DIR = $(OUT_D)/ccache
BR_MAKE = cd $(BR_D) && mkdir -p "$(TMPDIR)" && \
make O=$(BR_OUT_D) BR2_DL_DIR=$(DL_D) \
BR2_CONFIG=$(BR_OUT_D)/.config \
BUSYBOX_CONFIG_FILE=$(BR_OUT_D)/busybox.config \
BR2_CCACHE_DIR=$(BR2_CCACHE_DIR)
BR_DEPS = $(BR_D) $(BR_OUT_D)/busybox.config $(BR_OUT_D)/.config $(SKEL_D)/.dir
BR_CONFIG = $(CONF_D)/buildroot-$(ARCH).config
BUSYBOX_VERSION := $(shell sed -n \
"s,^BUSYBOX_VERSION\s*=\s*\([^\s]*\).*,\1,p" \
$(BR_D)/package/busybox/busybox.mk)
BUSYBOX_BUILD_DIR = $(BR_OUT_D)/build/busybox-$(BUSYBOX_VERSION)
BUSYBOX_BUILD_CONFIG = $(BUSYBOX_BUILD_DIR)/.config
unexport SED # causes random issues (LP: #920620)
all: $(TAR_IMG)
debug:
@echo "BR_DEPS: $(BR_DEPS)"
@echo "BR_MAKE: $(BR_MAKE)"
@echo "BR_OUT_D: $(BR_OUT_D)"
@echo "BUSYBOX_BUILD_CONFIG: $(BUSYBOX_BUILD_CONFIG)"
@echo "BUSYBOX_VERSION: $(BUSYBOX_VERSION)"
source: br_source minicloud_source
br_source: $(BR_DEPS) $(OUT_D)/.source.$(ARCH)
minicloud_source: $(DL_D)/.dir
@echo hi world
# here we would download the Ubuntu kernel
$(BR_D):
@[ -d "$(BR_D)" ] || { echo "You Must download BUILDROOT, extract it, and symlink to $(BR_D)"; exit 1; }
$(OUT_D)/.source.$(ARCH):
$(BR_MAKE) source
$(BR_OUT_D)/busybox.config: $(CONF_D)/busybox.config $(BR_OUT_D)/.dir
cp $(CONF_D)/busybox.config $@
for s in configured built target_installed; do rm -f $(BR_OUT_D)/build/busybox-*/.stamp_$$s; done
$(BR_OUT_D)/.config: $(BR_CONFIG) $(BR_OUT_D)/.dir
cp $(BR_CONFIG) $@
$(TAR_IMG): $(BR_TAR_IMG)
cp $(BR_TAR_IMG) $(TAR_IMG)
$(BR_TAR_IMG): $(BR_DEPS)
$(BR_MAKE)
$(SKEL_D)/.dir:
# copy BR_D/fs/skeleton, then sync src/ over the
# top of that.
# depends on $(BR_D)/fs/skeleton (somehow)
[ -d $(SKEL_D) ] || mkdir -p $(SKEL_D)
rsync -a $(BR_D)/system/skeleton/ $(SKEL_D)/ --delete
rsync -a $(TOP_D)/src/ $(SKEL_D)/
touch $(SKEL_D)/.dir
br-menuconfig: $(BR_OUT_D)/.config
$(BR_MAKE) $* menuconfig
cp $(BR_OUT_D)/.config $(CONF_D)/buildroot-$(ARCH).config
br-busybox-menuconfig: $(BR_OUT_D)/busybox.config
$(BR_MAKE) $* busybox-menuconfig
cp $(BUSYBOX_BUILD_CONFIG) $(CONF_D)/busybox.config
br-%: $(BR_OUT_D)/.config $(BR_OUT_D)/busybox.config
$(BR_MAKE) $*
%/.dir:
mkdir -p $* && touch $@