-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
63 lines (47 loc) · 1.74 KB
/
GNUmakefile
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
CROSSDEV_REPO ?= $(CURDIR)
ARCH ?= powerpc
LIBC ?= musl
TARGET ?= $(ARCH)-targetdisk-linux-$(LIBC)
EXTRA_PODMAN_FLAGS ?=
OPEN ?= xdg-open
SETUP_SCRIPTS ?= $(CURDIR)/setup-scripts
PODMAN_RUN ?= podman run -it $(EXTRA_PODMAN_FLAGS) \
-v $(CURDIR)/targets/$(TARGET):/usr/$(TARGET) \
-v $(CROSSDEV_REPO)/toolchain-scripts:/opt/toolchain-scripts \
-v $(SETUP_SCRIPTS):/opt/setup-scripts \
--env ARCH=$(ARCH) \
--env LIBC=$(LIBC) \
--env TARGET=$(TARGET) \
--env CROSS_COMPILE=$(TARGET)- \
--env INSTALL_MOD_PATH=/usr/$(TARGET) \
crossdev-$(TARGET):latest
Dockerfile: $(CROSSDEV_REPO)/Dockerfile.in
sed 's/\[%TARGET%\]/'"$(TARGET)/g" < $< > Dockerfile
$(CROSSDEV_REPO)/toolchain-scripts:
mkdir $@
$(SETUP_SCRIPTS):
mkdir $@
crossdev.conf: $(CROSSDEV_REPO)/crossdev.conf
cp $< $@
$(CROSSDEV_REPO)/toolchain-scripts/$(TARGET).cmake: $(CROSSDEV_REPO)/toolchain.cmake.in $(CROSSDEV_REPO)/toolchain-scripts
sed 's/\[%TARGET%\]/'"$(TARGET)/g" < $< \
> $(CROSSDEV_REPO)/toolchain-scripts/$(TARGET).cmake
targets/$(TARGET):
mkdir -p targets/$(TARGET)
targets/.$(TARGET): $(SETUP_SCRIPTS) $(CROSSDEV_REPO)/toolchain-scripts/$(TARGET).cmake crossdev.conf Dockerfile targets/$(TARGET)
podman build $(EXTRA_PODMAN_FLAGS) \
-v $(CURDIR)/targets/$(TARGET):/usr/$(TARGET) \
-v $(SETUP_SCRIPTS):/opt/setup-scripts \
-t crossdev-$(TARGET) .
touch targets/.$(TARGET)
touch $(CROSSDEV_REPO)/Dockerfile.in
shell: targets/.$(TARGET)
-@$(PODMAN_RUN) /bin/bash
clean:
rm -rf Dockerfile targets/* targets/.*
pub.css:
wget https://github.com/manuelp/pandoc-stylesheet/raw/acac36b976966f76544176161ba826d519b6f40c/pub.css
README: pub.css # Requires Pandoc to be installed
pandoc README.md -s -c pub.css -o README.html
$(OPEN) README.html
.PHONY: Dockerfile