-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (40 loc) · 1.06 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
GOARCH ?= amd64
GOOS ?= linux
GO ?= env GOOS=$(GOOS) GOARCH=$(GOARCH) go
UNAME := $(shell uname)
BUILD ?= build
BUILDARCH ?= $(BUILD)/$(GOOS)-$(GOARCH)
all:
GOOS=linux GOARCH=amd64 make binaries-all
GOOS=linux GOARCH=arm make binaries-all
GOOS=darwin GOARCH=amd64 make binaries-all
binaries-all: $(BUILDARCH)/flasher
cd $(BUILDARCH) && zip -r ../$(GOOS)-$(GOARCH).zip *
$(BUILDARCH)/flasher: $(BUILDARCH) *.go
$(GO) build -o $(BUILDARCH)/flasher *.go
$(BUILDARCH):
mkdir -p $(BUILDARCH)
cp -a tools $(BUILDARCH)
install: all
echo $(UNAME)
ifeq ($(UNAME),Linux)
rm -rf ~/tools/lib/flasher
mkdir -p ~/tools/lib
cp -a tools ~/tools/lib/flasher
sudo rm ~/tools/bin/flasher
sudo cp $(BUILD)/linux-amd64/flasher ~/tools/bin
sudo chown root. ~/tools/bin/flasher
sudo chmod ug+s ~/tools/bin/flasher
endif
ifeq ($(UNAME),Darwin)
rm -rf ~/tools/lib/flasher
mkdir -p ~/tools/lib
cp -a tools ~/tools/lib/flasher
sudo rm ~/tools/bin/flasher
sudo cp $(BUILD)/darwin-amd64/flasher ~/tools/bin
endif
clean:
rm -rf $(BUILD)
deps:
$(GO) get go.bug.st/serial.v1
.PHONY: $(BUILD)