forked from mdehaas/pi-init2
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
26 lines (19 loc) · 831 Bytes
/
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
## This looks complicated, but it's really just getting the path of this Makefile
path := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
cwd := $(shell pwd)
all: boot/pi-init2
boot/pi-init2:
GOPATH=$(path) GOOS=linux GOARCH=arm go build -o boot/pi-init2 pi-init2
clean:
rm -f boot/pi-init2
reqs:
apt update
apt install -y git golang
GOPATH=$(path) GOOS=linux GOARCH=arm go get golang.org/x/sys/unix
## This is an experimental and Mac-only shortcut to installing the files onto a mounted card.
## I'm looking for contributions to also support Linux.
install:
@cd $(path); \
card_device="$$(diskutil info -all | awk '/Device Identifier/{disk=$$3} /SD Card Reader/{print(disk)}')"; \
card_path="$$(mount | awk '$$1 ~ "'$${card_device}'" && $$3 ~ "boot" {print $$3}')"; \
cp -Hv boot/* $${card_path}/