about summary refs log tree commit diff stats
path: root/Makefile
blob: 3f06c4da6bc39be26f61c4343b1ffe0ef5720f2d (plain) (blame)
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
108
109
.POSIX:
.SUFFIXES:
.SUFFIXES: .1 .5 .7 .1.scd .5.scd .7.scd

VERSION=0.3.0

VPATH=doc
PREFIX?=/usr/local
_INSTDIR=$(DESTDIR)$(PREFIX)
BINDIR?=$(_INSTDIR)/bin
SHAREDIR?=$(_INSTDIR)/share/aerc
MANDIR?=$(_INSTDIR)/share/man
GO?=go
GOFLAGS?=

GOSRC!=find . -name '*.go'
GOSRC+=go.mod go.sum

aerc: $(GOSRC)
	$(GO) build $(GOFLAGS) \
		-ldflags "-X main.Prefix=$(PREFIX) \
		-X main.ShareDir=$(SHAREDIR) \
		-X main.Version=$(VERSION)" \
		-o $@

aerc.conf: config/aerc.conf.in
	sed -e 's:@SHAREDIR@:$(SHAREDIR):g' > $@ < config/aerc.conf.in

DOCS := \
	aerc.1 \
	aerc-search.1 \
	aerc-config.5 \
	aerc-imap.5 \
	aerc-maildir.5 \
	aerc-sendmail.5 \
	aerc-notmuch.5 \
	aerc-smtp.5 \
	aerc-tutorial.7 \
	aerc-templates.7

.1.scd.1:
	scdoc < $< > $@

.5.scd.5:
	scdoc < $< > $@

.7.scd.7:
	scdoc < $< > $@

doc: $(DOCS)

all: aerc aerc.conf doc

# Exists in GNUMake but not in NetBSD make and others.
RM?=rm -f

clean:
	$(RM) $(DOCS) aerc.conf aerc

install: all
	mkdir -m755 -p $(BINDIR) $(MANDIR)/man1 $(MANDIR)/man5 $(MANDIR)/man7 \
		$(SHAREDIR) $(SHAREDIR)/filters $(SHAREDIR)/templates
	install -m755 aerc $(BINDIR)/aerc
	install -m644 aerc.1 $(MANDIR)/man1/aerc.1
	install -m644 aerc-search.1 $(MANDIR)/man1/aerc-search.1
	install -m644 aerc-config.5 $(MANDIR)/man5/aerc-config.5
	install -m644 aerc-imap.5 $(MANDIR)/man5/aerc-imap.5
	install -m644 aerc-maildir.5 $(MANDIR)/man5/aerc-maildir.5
	install -m644 aerc-sendmail.5 $(MANDIR)/man5/aerc-sendmail.5
	install -m644 aerc-notmuch.5 $(MANDIR)/man5/aerc-notmuch.5
	install -m644 aerc-smtp.5 $(MANDIR)/man5/aerc-smtp.5
	install -m644 aerc-tutorial.7 $(MANDIR)/man7/aerc-tutorial.7
	install -m644 aerc-templates.7 $(MANDIR)/man7/aerc-templates.7
	install -m644 config/accounts.conf $(SHAREDIR)/accounts.conf
	install -m644 aerc.conf $(SHAREDIR)/aerc.conf
	install -m644 config/binds.conf $(SHAREDIR)/binds.conf
	install -m755 filters/hldiff $(SHAREDIR)/filters/hldiff
	install -m755 filters/html $(SHAREDIR)/filters/html
	install -m755 filters/plaintext $(SHAREDIR)/filters/plaintext
	install -m644 templates/quoted_reply $(SHAREDIR)/templates/quoted_reply
	install -m644 templates/forward_as_body $(SHAREDIR)/templates/forward_as_body

RMDIR_IF_EMPTY:=sh -c '\
if test -d $$0 && ! ls -1qA $$0 | grep -q . ; then \
	rmdir $$0; \
fi'

uninstall:
	$(RM) $(BINDIR)/aerc
	$(RM) $(MANDIR)/man1/aerc.1
	$(RM) $(MANDIR)/man1/aerc-search.1
	$(RM) $(MANDIR)/man5/aerc-config.5
	$(RM) $(MANDIR)/man5/aerc-imap.5
	$(RM) $(MANDIR)/man5/aerc-maildir.5
	$(RM) $(MANDIR)/man5/aerc-sendmail.5
	$(RM) $(MANDIR)/man5/aerc-notmuch.5
	$(RM) $(MANDIR)/man5/aerc-smtp.5
	$(RM) $(MANDIR)/man7/aerc-tutorial.7
	$(RM) $(MANDIR)/man7/aerc-templates.7
	$(RM) -r $(SHAREDIR)
	${RMDIR_IF_EMPTY} $(BINDIR)
	$(RMDIR_IF_EMPTY) $(MANDIR)/man1
	$(RMDIR_IF_EMPTY) $(MANDIR)/man5
	$(RMDIR_IF_EMPTY) $(MANDIR)/man7
	$(RMDIR_IF_EMPTY) $(MANDIR)

.DEFAULT_GOAL := all

.PHONY: all doc clean install uninstall
span class="p">} static const GList * _mock_bookmark_get_list(void) { return (GList *)mock(); } static gboolean _mock_bookmark_add(const char *jid, const char *nick, gboolean autojoin) { check_expected(jid); check_expected(nick); check_expected(autojoin); return (gboolean)mock(); } static gboolean _mock_bookmark_remove(const char *jid, gboolean autojoin) { check_expected(jid); check_expected(autojoin); return (gboolean)mock(); } static void _mock_message_send(const char * const msg, const char * const recipient) { check_expected(msg); check_expected(recipient); } static void _mock_presence_join_room(char *room, char*nick, char *passwd) { check_expected(room); check_expected(nick); check_expected(passwd); } static void _mock_roster_send_add_new(const char *const barejid, const char * const name) { check_expected(barejid); check_expected(name); } static void _mock_roster_send_remove(const char * const barejid) { check_expected(barejid); } void mock_jabber_connect_with_details(void) { jabber_connect_with_details = _mock_jabber_connect_with_details; } void mock_jabber_connect_with_account(void) { jabber_connect_with_account = _mock_jabber_connect_with_account; } void mock_presence_update(void) { presence_update = _mock_presence_update; } void mock_connection_status(jabber_conn_status_t status) { jabber_get_connection_status = _mock_jabber_get_connection_status; will_return(_mock_jabber_get_connection_status, status); } void mock_bookmark_add(void) { bookmark_add = _mock_bookmark_add; } void mock_bookmark_remove(void) { bookmark_remove = _mock_bookmark_remove; } void mock_presence_join_room(void) { presence_join_room = _mock_presence_join_room; } void mock_roster_send_add_new(void) { roster_send_add_new = _mock_roster_send_add_new; } void mock_roster_send_remove(void) { roster_send_remove = _mock_roster_send_remove; } void bookmark_get_list_returns(GList *bookmarks) { bookmark_get_list = _mock_bookmark_get_list; will_return(_mock_bookmark_get_list, bookmarks); } void mock_connection_account_name(char *name) { jabber_get_account_name = _mock_jabber_get_account_name; will_return(_mock_jabber_get_account_name, name); } void mock_connection_presence_message(char *message) { jabber_get_presence_message = _mock_jabber_get_presence_message; will_return(_mock_jabber_get_presence_message, message); } void expect_room_list_request(char *conf_server) { iq_room_list_request = _mock_iq_room_list_request; expect_string(_mock_iq_room_list_request, conf_server, conf_server); } void jabber_connect_with_details_expect_and_return(char *jid, char *password, char *altdomain, int port, jabber_conn_status_t result) { expect_string(_mock_jabber_connect_with_details, jid, jid); expect_string(_mock_jabber_connect_with_details, passwd, password); if (altdomain == NULL) { expect_any(_mock_jabber_connect_with_details, altdomain); } else { expect_string(_mock_jabber_connect_with_details, altdomain, altdomain); } expect_value(_mock_jabber_connect_with_details, port, port); will_return(_mock_jabber_connect_with_details, result); } void jabber_connect_with_details_return(jabber_conn_status_t result) { expect_any(_mock_jabber_connect_with_details, jid); expect_any(_mock_jabber_connect_with_details, passwd); expect_any(_mock_jabber_connect_with_details, altdomain); expect_any(_mock_jabber_connect_with_details, port); will_return(_mock_jabber_connect_with_details, result); } void jabber_connect_with_account_expect_and_return(ProfAccount *account, jabber_conn_status_t result) { expect_memory(_mock_jabber_connect_with_account, account, account, sizeof(ProfAccount)); will_return(_mock_jabber_connect_with_account, result); } void jabber_connect_with_account_return(ProfAccount *account, jabber_conn_status_t result) { expect_any(_mock_jabber_connect_with_account, account); will_return(_mock_jabber_connect_with_account, result); } void presence_update_expect(resource_presence_t presence, char *msg, int idle) { expect_value(_mock_presence_update, status, presence); expect_string(_mock_presence_update, msg, msg); expect_value(_mock_presence_update, idle, idle); } void expect_and_return_bookmark_add(char *expected_jid, char *expected_nick, gboolean expected_autojoin, gboolean added) { expect_string(_mock_bookmark_add, jid, expected_jid); if (expected_nick != NULL) { expect_string(_mock_bookmark_add, nick, expected_nick); } else { expect_any(_mock_bookmark_add, nick); } expect_value(_mock_bookmark_add, autojoin, expected_autojoin); will_return(_mock_bookmark_add, added); } void expect_and_return_bookmark_remove(char *expected_jid, gboolean expected_autojoin, gboolean removed) { expect_string(_mock_bookmark_remove, jid, expected_jid); expect_value(_mock_bookmark_remove, autojoin, expected_autojoin); will_return(_mock_bookmark_remove, removed); } void message_send_expect(char *message, char *recipient) { message_send = _mock_message_send; expect_string(_mock_message_send, msg, message); expect_string(_mock_message_send, recipient, recipient); } void presence_join_room_expect(char *room, char *nick, char *passwd) { expect_string(_mock_presence_join_room, room, room); expect_string(_mock_presence_join_room, nick, nick); if (passwd == NULL) { expect_any(_mock_presence_join_room, passwd); } else { expect_string(_mock_presence_join_room, passwd, passwd); } } void roster_send_add_new_expect(char *jid, char *nick) { expect_string(_mock_roster_send_add_new, barejid, jid); expect_string(_mock_roster_send_add_new, name, nick); } void roster_send_remove_expect(char *jid) { expect_string(_mock_roster_send_remove, barejid, jid); }