-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
110 lines (77 loc) · 3.22 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
################################################################################
all: ybpi-sdk ybpi-image
################################################################################
sdk = poky-glibc-x86_64-ybpi-rpi2-image-cortexa7hf-neon-vfpv4-toolchain-2.3.1.sh
image = ybpi-rpi2-image-raspberrypi2.rpi-sdimg
ybpi-sdk: ybpi-sdk/.done
ybpi-image: artifacts/$(image)
release: ybpi-release
################################################################################
base_version = 1.3.0
deploy = /workspace/build/tmp/deploy
sdk_deploy = $(deploy)/sdk
sdk_path = $(sdk_deploy)/$(sdk)
image_deploy = $(deploy)/images/raspberrypi2
image_path = $(image_deploy)/$(image)
################################################################################
ifdef tag
ybpi-release-image = artifacts/$(patsubst %.rpi-sdimg,%_$(tag).rpi-sdimg,$(image))
endif
################################################################################
ybpi-yocto/.done: ybpi-yocto/Dockerfile ybpi-yocto/build-ybpi-sdk.sh
-docker rmi raphaelmeyer/ybpi-yocto
docker build -t raphaelmeyer/ybpi-yocto ybpi-yocto
touch $@
ybpi-sdk/.done: ybpi-sdk/Dockerfile ybpi-sdk/ybpi-entrypoint.sh artifacts/$(sdk)
-docker rmi raphaelmeyer/ybpi-sdk
cp artifacts/$(sdk) ybpi-sdk/sdk-installer.sh
docker build -t raphaelmeyer/ybpi-sdk ybpi-sdk
touch $@
################################################################################
ybpi-release: check-tag ybpi-sdk $(ybpi-release-image)
docker tag raphaelmeyer/ybpi-yocto raphaelmeyer/ybpi-yocto:$(tag)
docker tag raphaelmeyer/ybpi-sdk raphaelmeyer/ybpi-sdk:$(tag)
docker push raphaelmeyer/ybpi-yocto:$(tag)
docker push raphaelmeyer/ybpi-sdk:$(tag)
check-tag:
ifndef tag
$(error "Must specify a tag with make release tag=TAG")
endif
$(ybpi-release-image): ybpi-image
test -f "artifacts/$(image)"
cp artifacts/$(image) $(ybpi-release-image)
echo "TODO upload image to dropbox"
################################################################################
tools/.yocto-workspace.done:
-docker rm -v yocto-workspace
docker create --name yocto-workspace raphaelmeyer/base:$(base_version)
touch $@
################################################################################
ybpi-yocto: ybpi-yocto/.done tools/.yocto-workspace.done
docker run --rm -t --volumes-from yocto-workspace raphaelmeyer/ybpi-yocto \
/bin/bash -c "/bin/build-ybpi-sdk.sh"
artifacts/$(image): ybpi-yocto artifacts
$(eval target := $(shell \
docker run --rm -t --volumes-from yocto-workspace \
raphaelmeyer/ybpi-yocto readlink $(image_path)))
docker cp yocto-workspace:$(image_deploy)/$(target) $@
artifacts/$(sdk): ybpi-yocto artifacts
docker cp yocto-workspace:$(sdk_path) $@
artifacts:
mkdir -p $@
################################################################################
clean: clean-yocto clean-sdk
rm -rf artifacts
clean-yocto: clean-yocto-workspace
rm -rf ybpi-yocto/.done
-docker rmi raphaelmeyer/ybpi-yocto
clean-sdk:
rm -rf ybpi-sdk/.done
-docker rmi raphaelmeyer/ybpi-sdk
clean-yocto-workspace:
rm -rf tools/.yocto-workspace.done
-docker rm -v yocto-workspace
################################################################################
.PHONY: clean
.PHONY: clean-yocto clean-sdk
.PHONY: clean-yocto-workspace