Skip to content

Commit 815e2f6

Browse files
author
Tom Softreck
committed
update docs
1 parent 69b8aad commit 815e2f6

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

Makefile

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
.PHONY: all install uninstall test clean build package release docs serve
2+
3+
# Variables
4+
NAME = fedora-cleaner
5+
VERSION = $(shell git describe --tags --always --dirty)
6+
PREFIX ?= /usr/local
7+
BINDIR = $(PREFIX)/bin
8+
MANDIR = $(PREFIX)/share/man/man1
9+
DOCDIR = $(PREFIX)/share/doc/$(NAME)
10+
11+
# Detect Linux distribution
12+
DISTRO_ID = $(shell . /etc/os-release && echo $$ID)
13+
DISTRO_VERSION = $(shell . /etc/os-release && echo $$VERSION_ID)
14+
15+
# Installation paths
16+
BIN = $(NAME).sh
17+
MAN = $(NAME).1
18+
DOCS = README.md LICENSE
19+
20+
# Build targets
21+
all: build
22+
23+
# Install for the detected distribution
24+
install: install-$(DISTRO_ID)
25+
26+
install-fedora install-rhel install-centos:
27+
@echo "Installing for Fedora/RHEL/CentOS..."
28+
install -Dm755 $(BIN) $(DESTDIR)$(BINDIR)/$(NAME)
29+
install -Dm644 $(MAN) $(DESTDIR)$(MANDIR)/$(NAME).1
30+
install -Dm644 $(DOCS) $(DESTDIR)$(DOCDIR)/
31+
@echo "Installation complete. Run '$(NAME) --help' to get started."
32+
33+
install-debian install-ubuntu:
34+
@echo "Installing for Debian/Ubuntu..."
35+
install -Dm755 $(BIN) $(DESTDIR)$(BINDIR)/$(NAME)
36+
install -Dm644 $(MAN) $(DESTDIR)$(MANDIR)/$(NAME).1
37+
install -Dm644 $(DOCS) $(DESTDIR)$(DOCDIR)/
38+
@echo "Installation complete. Run '$(NAME) --help' to get started."
39+
40+
install-arch:
41+
@echo "Installing for Arch Linux..."
42+
install -Dm755 $(BIN) $(DESTDIR)$(BINDIR)/$(NAME)
43+
install -Dm644 $(MAN) $(DESTDIR)$(MANDIR)/$(NAME).1
44+
install -Dm644 $(DOCS) $(DESTDIR)$(DOCDIR)/
45+
@echo "Installation complete. Run '$(NAME) --help' to get started."
46+
47+
# Default installation for other distributions
48+
install-:
49+
@echo "Installing for generic Linux..."
50+
install -Dm755 $(BIN) $(DESTDIR)$(BINDIR)/$(NAME)
51+
install -Dm644 $(MAN) $(DESTDIR)$(MANDIR)/$(NAME).1
52+
install -Dm644 $(DOCS) $(DESTDIR)$(DOCDIR)/
53+
@echo "Installation complete. Run '$(NAME) --help' to get started."
54+
55+
uninstall:
56+
rm -f $(DESTDIR)$(BINDIR)/$(NAME)
57+
rm -f $(DESTDIR)$(MANDIR)/$(NAME).1
58+
test -d $(DESTDIR)$(DOCDIR) && rm -rf $(DESTDIR)$(DOCDIR) || true
59+
60+
# Build documentation
61+
docs:
62+
@echo "Building documentation..."
63+
@pandoc -s -t man $(NAME).1.md -o $(NAME).1
64+
@echo "Documentation built: $(NAME).1"
65+
66+
# Build package
67+
package: docs
68+
@echo "Building package..."
69+
@mkdir -p dist
70+
@tar czf dist/$(NAME)-$(VERSION).tar.gz --transform 's,^,$(NAME)-$(VERSION)/,' \
71+
$(BIN) $(MAN) $(DOCS) Makefile
72+
@echo "Package built: dist/$(NAME)-$(VERSION).tar.gz"
73+
74+
# Release helper (requires GitHub CLI)
75+
release: test package
76+
@echo "Creating release v$(VERSION)..."
77+
gh release create v$(VERSION) dist/$(NAME)-$(VERSION).tar.gz --title "v$(VERSION)" --notes "Release v$(VERSION)"
78+
79+
# Run tests
80+
test:
81+
@echo "Running tests..."
82+
shellcheck $(BIN)
83+
@echo "All tests passed!"
84+
85+
# Clean build artifacts
86+
clean:
87+
rm -f $(NAME).1
88+
rm -rf dist/
89+
90+
# Run development server for docs
91+
serve:
92+
bundle exec jekyll serve --livereload
93+
94+
# Help
95+
dist: package
96+
97+
help:
98+
@echo "Available targets:"
99+
@echo " install - Install the program"
100+
@echo " uninstall - Uninstall the program"
101+
@echo " test - Run tests"
102+
@echo " clean - Remove build artifacts"
103+
@echo " docs - Build documentation"
104+
@echo " package - Create distribution package"
105+
@echo " release - Create a new release (requires GitHub CLI)"
106+
@echo " serve - Run local development server for docs"
107+
108+
.DEFAULT_GOAL := help

0 commit comments

Comments
 (0)