Debian Codegraph @

Makefile

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