-
Notifications
You must be signed in to change notification settings - Fork 4
/
makefile
136 lines (112 loc) · 3.55 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
PLATFORM_AGNOSTIC_TARGETS += clean-fs-all clean-image-all
include src/make-helper-functions.mk
all: bin/$(IMAGE_NAME)
ifdef KERNEL_CONFIG_TARGET
KERNEL_TARGET=kernel/bin/$(KERNEL_CONFIG_TARGET)/.done
linux: $(KERNEL_TARGET)
@true
$(KERNEL_TARGET):
$(MAKE) -C kernel
else
linux:
@true
endif
extra_packages:
if [ "$(BUILD_PACKAGES)" != no ]; \
then $(MAKE) -C chroot-build-helper; \
fi
clean-fs-all: build/bin/usernsexec
uexec rm -rf "$(project_root)/build/"*.img
clean-fs: build/bin/usernsexec
uexec rm -rf "$(project_root)/build/$(IMAGE_NAME)/"
clean-image-all:
rm -f bin/*.img
clean-image:
rm -f "bin/$(IMAGE_NAME)"
shell: enter-buildenv
enter-buildenv:
export PROMPT_COMMAND='if [ -z "$$PS_SET" ]; then PS_SET=1; PS1="(buildenv) $$PS1"; fi'; \
$(USER_SHELL)
build/$(DISTRO)-$(RELEASE)/deb/%.deb: | build/$(DISTRO)-$(RELEASE)/deb/.dir
getdeb.sh "$@"
$(DEBOOTSTRAP_SCRIPT): build/$(DISTRO)-$(RELEASE)/deb/debootstrap.deb
set -ex; \
exec 8>"build/.debootstrap-$(DISTRO)-$(RELEASE).lock"; \
flock 8; \
if [ -e "$@" ]; then exit 0; fi; \
rm -rf "$$X_DEBOOTSTRAP_DIR"; \
mkdir -p "$$X_DEBOOTSTRAP_DIR"; \
debootstrap_deb="$$(realpath "build/$$DISTRO-$$RELEASE/deb/debootstrap.deb")"; \
cd "$$X_DEBOOTSTRAP_DIR"; \
ar x "$$debootstrap_deb"; \
tar xzf data.tar.*;
[ -e "$@" ]
touch "$@"
build/$(IMAGE_NAME)/root.fs/: \
$(KERNEL_TARGET) \
build/bin/usernsexec \
$(DEBOOTSTRAP_SCRIPT) \
bin/.dir \
build/$(IMAGE_NAME)/.dir
$(MAKE) extra_packages
./script/debootstrap.sh
bin/$(IMAGE_NAME): \
$(KERNEL_TARGET) \
build/bin/fuseloop \
build/bin/tar2ext \
build/$(IMAGE_NAME)/root.fs/ \
$(PLATFORM_FILES)
./script/assemble_image.sh
always:
.PHONY: always
rebuild: clean-fs clean-image always
$(MAKE) all
clean-repo: clean-repo//fuseloop clean-repo//usernsexec clean-repo//tar2ext
$(MAKE) -C platform clean-repo
$(MAKE) -C kernel clean-repo
$(MAKE) -C chroot-build-helper clean-repo
update-repo: update-repo//fuseloop update-repo//usernsexec update-repo//tar2ext
$(MAKE) -C platform update-repo
$(MAKE) -C kernel update-repo
if [ "$(BUILD_PACKAGES)" != no ]; \
then $(MAKE) -C chroot-build-helper update-repo; \
fi
clean-build: clean-image clean-fs
$(MAKE) -C platform clean-build
$(MAKE) -C kernel clean-build
$(MAKE) -C chroot-build-helper clean-build
rm -rf build/bin/
rmdir build/ 2>/dev/null || true
clean-build-all: clean-image-all clean-fs-all
$(MAKE) -C platform clean-build-all
$(MAKE) -C kernel clean-build-all
$(MAKE) -C chroot-build-helper clean-build-all
rm -rf build/
.SECONDEXPANSION:
repo: always \
$$(call repodir,fuseloop) \
$$(call repodir,usernsexec) \
$$(call repodir,tar2ext)
$(MAKE) -C platform repo
$(MAKE) -C kernel repo
if [ "$(BUILD_PACKAGES)" != no ]; \
then $(MAKE) -C chroot-build-helper repo; \
fi
build/bin/fuseloop: $$(call repodir,fuseloop) | build/bin/.dir
with-repo.sh fuseloop bash -ex -c "\
$(MAKE) -C \"\$$repodir/fuseloop\"; \
cp \"\$$repodir/fuseloop/fuseloop\" build/bin/; \
"
build/bin/usernsexec: $$(call repodir,usernsexec) | build/bin/.dir
with-repo.sh usernsexec bash -ex -c "\
$(MAKE) -C \"\$$repodir/usernsexec/\"; \
cp \"\$$repodir/usernsexec/bin/usernsexec\" build/bin/; \
cp \"\$$repodir/usernsexec/script/uexec\" build/bin/; \
"
build/bin/tar2ext: $$(call repodir,tar2ext) | build/bin/.dir
with-repo.sh tar2ext bash -ex -c "\
$(MAKE) -C \"\$$repodir/tar2ext/\"; \
cp \"\$$repodir/tar2ext/scripts/sload.ext4\" build/bin/; \
cp \"\$$repodir/tar2ext/bin/tar2ext\" build/bin/; \
"
( cd build/bin/; ln -sf sload.ext4 sload.ext3; ln -sf sload.ext4 sload.ext2; )