Files
phbar/Makefile
T
2026-07-13 16:53:48 +02:00

60 lines
1.4 KiB
Makefile

# Makefile for phbar
#
# Usage: make <target>
BIN_DIR := /usr/local/bin
BUILD_DIR := .build/release
BINARIES := phbar
.PHONY: all build install clean test run
all: build
# Build all targets in release mode
build:
swift build -c release
# Build and install binaries to /usr/local/bin
install: build
@mkdir -p $(BIN_DIR)
@for bin in $(BINARIES); do \
cp -f $(BUILD_DIR)/$$bin $(BIN_DIR)/; \
done
@echo "✅ Installed $(BINARIES) to $(BIN_DIR)"
# Clean build artifacts
clean:
swift package clean
# Run tests
test:
swift test
# Quick test: build, install, and verify
run: install
@echo "Verifying installation..."
@for bin in $(BINARIES); do \
which $$bin > /dev/null && echo "$$bin: $(shell which $$bin)" || echo "$$bin: not found"; \
done
# Uninstall binaries from /usr/local/bin
uninstall:
@for bin in $(BINARIES); do \
rm -f $(BIN_DIR)/$$bin; \
done
@echo "✅ Uninstalled $(BINARIES) from $(BIN_DIR)"
# Rebuild and reinstall (clean + install)
reinstall: clean install
# Show help
help:
@echo "Available targets:"
@echo " make build - Build in release mode"
@echo " make install - Build and install to /usr/local/bin"
@echo " make clean - Clean build artifacts"
@echo " make test - Run tests"
@echo " make run - Build, install, and verify"
@echo " make uninstall - Remove binaries from /usr/local/bin"
@echo " make reinstall - Clean and reinstall"