Import Upstream version 1.05+ds
This commit is contained in:
77
Makefile
77
Makefile
@@ -1,35 +1,8 @@
|
||||
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
|
||||
###############################################################################
|
||||
#
|
||||
# General Definitions
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
ifdef DESTDIR
|
||||
# dh_auto_install (Debian) sets this variable
|
||||
@@ -38,22 +11,44 @@ else
|
||||
TARGET_DIR ?= /usr/local
|
||||
endif
|
||||
|
||||
LIB_DIRS =
|
||||
|
||||
INC_DIRS =
|
||||
|
||||
CC ?= gcc
|
||||
CFLAGS += $(INC_DIRS) -Wall
|
||||
|
||||
LD = $(CC)
|
||||
LDFLAGS += $(LIB_DIRS)
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Main Dependencies
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
TARGET = hd-idle
|
||||
|
||||
LIBS =
|
||||
|
||||
SRCS = hd-idle.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
distclean: clean
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
rm -f $(OBJS) $(TARGET)
|
||||
|
||||
install: $(TARGET)
|
||||
install -Dm755 $(TARGET) $(TARGET_DIR)/sbin/$(TARGET)
|
||||
install -Dm755 debian/$(TARGET).8 $(TARGET_DIR)/share/man/man8/$(TARGET).8
|
||||
install -D -g root -o root $(TARGET) $(TARGET_DIR)/sbin/$(TARGET)
|
||||
install -D -g root -o root $(TARGET).1 $(TARGET_DIR)/share/man/man1/$(TARGET).1
|
||||
|
||||
uninstall:
|
||||
rm -f $(TARGET_DIR)/sbin/$(TARGET)
|
||||
hd-idle.o: hd-idle.c
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(LD) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIB_DIRS) $(LIBS)
|
||||
|
||||
$(TARGET):
|
||||
GOOS=linux GOARCH=$(GOARCH) go build
|
||||
|
||||
test:
|
||||
go test ./... -race -cover
|
||||
|
||||
Reference in New Issue
Block a user