-
Notifications
You must be signed in to change notification settings - Fork 32
/
Makefile
59 lines (48 loc) · 946 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
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
MAKEFLAGS += --silent
TARGET = hd-idle
PLATFORM := $(shell uname -m)
ARCH :=
ifeq ($(PLATFORM),x86_64)
ARCH = amd64
endif
ifeq ($(PLATFORM),aarch64)
ARCH = arm64
endif
ifeq ($(PLATFORM),armv7l)
ARCH = armhf
endif
GOARCH :=
ifeq ($(ARCH),amd64)
GOARCH = amd64
endif
ifeq ($(ARCH),i386)
GOARCH = 386
endif
ifeq ($(ARCH),arm64)
GOARCH = arm64
endif
ifeq ($(ARCH),armhf)
GOARCH = arm
endif
ifeq ($(GOARCH),)
$(error Invalid ARCH: $(ARCH))
endif
ifdef DESTDIR
# dh_auto_install (Debian) sets this variable
TARGET_DIR = $(DESTDIR)/usr
else
TARGET_DIR ?= /usr/local
endif
all: $(TARGET)
distclean: clean
clean:
rm -f $(TARGET)
install: $(TARGET)
install -Dm755 $(TARGET) $(TARGET_DIR)/sbin/$(TARGET)
install -Dm755 debian/$(TARGET).8 $(TARGET_DIR)/share/man/man8/$(TARGET).8
uninstall:
rm -f $(TARGET_DIR)/sbin/$(TARGET)
$(TARGET):
GOOS=linux GOARCH=$(GOARCH) go build
test:
go test ./... -race -cover