1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
NAME = email-reminder
PY_BINNAME = email-reminder-editor
PY_FILES = $(PY_BINNAME) EmailReminder/*.py
GO_BINARIES = collect-reminders send-reminders
VERSION := $(shell grep "VERSION =" $(PY_BINNAME) | grep -o "'[0-9]*\.[0-9]*\.[0-9]*'" | sed "s/'//g")
APPNAME = $(NAME)-$(VERSION)
# Standard installation directories
DESTDIR ?=
PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin
SBINDIR ?= $(PREFIX)/sbin
DATADIR ?= $(PREFIX)/share
MANDIR ?= $(DATADIR)/man
SYSCONFDIR ?= /etc
GO ?= go
GOFLAGS ?=
GO_LDFLAGS ?=
.PHONY: build clean install test lint \
pyflakes pydocstyle pycodestyle codespell pylint ruff isort bandit \
release commitsign
build: $(GO_BINARIES)
internal/config/version: $(PY_BINNAME)
echo -n "$(VERSION)" > $@
collect-reminders: internal/config/version
$(GO) build $(GOFLAGS) -ldflags "$(GO_LDFLAGS)" -o $@ ./cmd/collect-reminders
send-reminders: internal/config/version
$(GO) build $(GOFLAGS) -ldflags "$(GO_LDFLAGS)" -o $@ ./cmd/send-reminders
clean:
rm -f internal/config/version
rm -f $(GO_BINARIES)
rm -f $(APPNAME).tar.gz
rm -f $(APPNAME).tar.gz.asc
find -name "*.pyc" -delete
install: build
install -d $(DESTDIR)$(BINDIR)
install -d $(DESTDIR)$(SBINDIR)
install -d $(DESTDIR)$(DATADIR)/applications
install -d $(DESTDIR)$(DATADIR)/metainfo
install -d $(DESTDIR)$(MANDIR)/man1
install -d $(DESTDIR)$(MANDIR)/man8
install -m 0755 send-reminders $(DESTDIR)$(BINDIR)/
install -m 0755 $(PY_BINNAME) $(DESTDIR)$(BINDIR)/
install -m 0755 collect-reminders $(DESTDIR)$(SBINDIR)/
install -m 0644 $(PY_BINNAME).1 $(DESTDIR)$(MANDIR)/man1/
install -m 0644 send-reminders.1 $(DESTDIR)$(MANDIR)/man1/
install -m 0644 collect-reminders.8 $(DESTDIR)$(MANDIR)/man8/
install -m 0644 $(NAME).desktop $(DESTDIR)$(DATADIR)/applications/
install -m 0644 net.launchpad.email_reminder.metainfo.xml $(DESTDIR)$(DATADIR)/metainfo/
test: internal/config/version
$(GO) test $(GOFLAGS) ./...
pyflakes:
@echo Running pyflakes...
@pyflakes3 $(PY_FILES)
pydocstyle:
@echo Running pydocstyle...
@pydocstyle
pycodestyle:
@echo Running pycodestyle...
@pycodestyle $(PY_FILES)
codespell:
@echo Running codespell...
@codespell $(PY_FILES)
pylint:
@echo Running pylint...
@pylint $(PY_FILES)
ruff:
@echo Running ruff...
@ruff check $(PY_FILES)
isort:
@echo Running isort...
@isort --check-only --diff $(PY_FILES)
bandit:
@echo Running bandit...
@bandit --quiet -r .
lint: pycodestyle pydocstyle pyflakes pylint ruff isort codespell bandit
@echo Validating appstream data...
@appstreamcli validate --strict net.launchpad.email_reminder.metainfo.xml
$(APPNAME).tar.gz:
git archive --format=tar.gz --prefix=$(APPNAME)/ -o $@ HEAD
release: $(APPNAME).tar.gz
gpg -a --detach-sign $<
commitsign:
git commit -a -m "Bump version and changelog for release"
git tag -s $(APPNAME) -m "$(VERSION) release"
|