feat: add test, cleanup Makefile

This commit is contained in:
koru 2026-06-13 15:12:53 +00:00 committed by nekohepott
parent 389dbeff56
commit e1d8393d85
No known key found for this signature in database

View File

@ -1,9 +1,10 @@
.PHONY: all build install clean uninstall
.PHONY: all build install clean uninstall test
BINARY_NAME=gogofetch
PREFIX?=/usr
BINARY_NAME = gogofetch
PREFIX ?= /usr
all: build
all:
@echo "Available targets: build install clean uninstall test"
build:
@echo "Building $(BINARY_NAME)..."
@ -11,16 +12,13 @@ build:
@echo "Build completed successfully."
install:
@if [ "$$(id -u)" -ne 0 ] && [ -z "$(DESTDIR)" ]; then \
echo "Error: root privileges required. Run with sudo or doas."; \
exit 1; \
fi
@echo "Installing $(BINARY_NAME) to $(PREFIX)/bin..."
@[ "$$(id -u)" -eq 0 ] || [ -n "$(DESTDIR)" ] || { echo "Root privileges required."; exit 1; }
install -Dm755 $(BINARY_NAME) $(DESTDIR)$(PREFIX)/bin/$(BINARY_NAME)
install -d $(DESTDIR)$(PREFIX)/share/gogofetch/logos
cp -v logos/* $(DESTDIR)$(PREFIX)/share/gogofetch/logos/
chmod 755 $(DESTDIR)$(PREFIX)/share/gogofetch/logos
chmod 644 $(DESTDIR)$(PREFIX)/share/gogofetch/logos/*
install -m 644 logos/* $(DESTDIR)$(PREFIX)/share/gogofetch/logos/
test:
go test -v ./src/...
clean:
rm -f $(BINARY_NAME)