-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
96 lines (81 loc) · 2.93 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
#!/usr/bin/make -f
# Copyright (c) 2020-2021 TurnKey GNU/Linux - https://www.turnkeylinux.org
LOCAL_DISTRO := $(shell lsb_release -si | tr [A-Z] [a-z])
LOCAL_CODENAME := $(shell lsb_release -sc)
LOCAL_RELEASE := $(LOCAL_DISTRO)/$(LOCAL_CODENAME)
ifndef RELEASE
$(info RELEASE not defined - falling back to system: '$(LOCAL_RELEASE)')
RELEASE := $(LOCAL_RELEASE)
endif
DISTRO ?= $(shell dirname $(RELEASE))
CODENAME ?= $(shell basename $(RELEASE))
FAB_ARCH ?= $(shell dpkg --print-architecture)
MIRROR ?= http://deb.debian.org/debian
VARIANT ?= minbase
EXTRA_PKGS ?= initramfs-tools,gpg,gpg-agent,ca-certificates,lsb-release
REMOVELIST ?= ./removelist
# build output path
O ?= build
.PHONY: all
all: $O/bootstrap.tar.gz
help:
@echo '=== Configurable variables'
@echo 'Resolution order:'
@echo '1) command line (highest precedence)'
@echo '2) product Makefile'
@echo '3) environment variable'
@echo '4) built-in default (lowest precedence)'
@echo
@echo '# Recommended configuration variables:'
@echo ' RELEASE $(value RELEASE)'
@echo ' if not set, will fall back to system:'
@echo ' $(value LOCAL_RELEASE)'
@echo
@echo '# Build context variables'
@echo ' FAB_ARCH $(value FAB_ARCH)'
@echo ' MIRROR $(value MIRROR)'
@echo ' VARIANT $(value VARIANT)'
@echo ' EXTRA_PKGS $(value EXTRA_PKGS)'
@echo ' REMOVELIST $(value REMOVELIST)'
@echo
@echo '# Product output variables [VALUE]'
@echo ' O $(value O)/'
@echo
@echo '=== Usage'
@echo '# remake target and the targets that depend on it'
@echo '$$ make <target>'
@echo
@echo '# build a target (default: bootstrap.tar.gz)'
@echo '$$ make [target] [O=path/to/build/dir]'
@echo
@echo ' clean # clean all build targets'
@echo ' bootstrap # build bootstrap with debootstrap'
@echo ' show-packages # show packages installed in bootstrap'
@echo ' removelist # apply removelist'
@echo ' bootstrap.tar.gz # build tarball from bootstrap'
.PHONY: clean
clean:
rm -rf $O/bootstrap $O/bootstrap.tar.gz
.PHONY: show-packages
show-packages: $O/bootstrap
fab-chroot build/bootstrap "dpkg -l | grep ^ii"
$O/bootstrap:
mkdir -p $O
ifneq ($(LOCAL_CODENAME), $(CODENAME))
@echo
@echo '***Note: OS release transition may require a newer version of `debootstrap`.'
@echo
endif
debootstrap --arch=$(FAB_ARCH) --variant=$(VARIANT) --include=$(EXTRA_PKGS) $(CODENAME) $O/bootstrap $(MIRROR)
.PHONY: bootstrap
bootstrap: $O/bootstrap
.PHONY: removelist
removelist: $O/bootstrap
fab-apply-removelist $(REMOVELIST) $O/bootstrap
$O/bootstrap.tar.gz: removelist
tar -C $O/bootstrap -zcf $O/bootstrap.tar.gz .
.PHONY: bootstrap.tar.gz
bootstrap.tar.gz: $O/bootstrap.tar.gz
.PHONY: install
install: removelist
rsync --delete -Hac $O/bootstrap/ $(FAB_PATH)/bootstraps/$(shell basename $(CODENAME))/