Import Upstream version 1.21+ds

This commit is contained in:
geos_one
2025-08-06 15:51:53 +02:00
parent 7527bfa483
commit aab8caab26
30 changed files with 3083 additions and 1097 deletions

View File

@@ -1,8 +1,35 @@
###############################################################################
#
# General Definitions
#
###############################################################################
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
@@ -11,44 +38,22 @@ 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 $(OBJS) $(TARGET)
rm -f $(TARGET)
install: $(TARGET)
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
install -Dm755 $(TARGET) $(TARGET_DIR)/sbin/$(TARGET)
install -Dm755 debian/$(TARGET).8 $(TARGET_DIR)/share/man/man8/$(TARGET).8
hd-idle.o: hd-idle.c
$(TARGET): $(OBJS)
$(LD) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIB_DIRS) $(LIBS)
uninstall:
rm -f $(TARGET_DIR)/sbin/$(TARGET)
$(TARGET):
GOOS=linux GOARCH=$(GOARCH) go build
test:
go test ./... -race -cover