forked from neomutt/neomutt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.autosetup
333 lines (296 loc) · 9.3 KB
/
Makefile.autosetup
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
###############################################################################
# substitutions by autosetup
PACKAGE= @PACKAGE@
PACKAGE_VERSION=@PACKAGE_VERSION@
# Build-time compiler and flags. These are used for building executables that
# are only used at build-time, e.g., doc/makedoc. These are different from CC /
# CFLAGS / LDFLAGS because the host and target systems might be different.
CC_FOR_BUILD= @CC_FOR_BUILD@
CFLAGS_FOR_BUILD= @CFLAGS_FOR_BUILD@ $(EXTRA_CFLAGS_FOR_BUILD)
LDFLAGS_FOR_BUILD= @LDFLAGS_FOR_BUILD@ $(EXTRA_LDFLAGS_FOR_BUILD)
PWD= @PWD@
AR= @AR@
CC= @CC@
CPP= @CPP@
CFLAGS= @CPPFLAGS@ @CFLAGS@ -I. -I@top_srcdir@ -Wall $(EXTRA_CFLAGS)
LDFLAGS= @LDFLAGS@ $(EXTRA_LDFLAGS)
EXEEXT= @EXEEXT@
LIBS= @LIBS@
@if ENABLE_NLS
INTLLIBS= @INTLLIBS@
@endif
RANLIB= @RANLIB@
SRCDIR= @srcdir@
INSTALL= @INSTALL@ -c
INSTALL_DATA= @INSTALL@ -m 644
MKDIR_P= mkdir -p
RM= rm -fr
DEPFILES= $(ALLOBJS:.o=.Po)
BINFILES= $(NEOMUTT)
@if HAVE_PGP
LIBBINFILES+= $(PGPEWRAP) $(PGPRING)
@endif
@if HAVE_SMIME
LIBBINFILES+= $(SRCDIR)/contrib/smime_keys
@endif
# paths
bindir= @BINDIR@
datadir= @PKGDATADIR@
docdir= @PKGDOCDIR@
mandir= @mandir@
libdir= @libdir@
libexecdir= @libexecdir@
sysconfdir= @SYSCONFDIR@
# targets for specific subdirectories
ALL_TARGETS= @ALL_TARGETS@
CLEAN_TARGETS= @CLEAN_TARGETS@
INSTALL_TARGETS= @INSTALL_TARGETS@
UNINSTALL_TARGETS= @UNINSTALL_TARGETS@
VPATH= $(SRCDIR)
ALL_FILES!= (cd $(SRCDIR) && git ls-files 2>/dev/null) || true
###############################################################################
# neomutt
NEOMUTT= neomutt$(EXEEXT)
NEOMUTTOBJS= mutt_account.o addrbook.o alias.o attach.o bcache.o body.o \
browser.o buffy.o color.o commands.o complete.o \
compose.o compress.o conststrings.o copy.o curs_lib.o \
curs_main.o edit.o editmsg.o enter.o envelope.o filter.o \
flags.o from.o group.o handler.o hdrline.o \
header.o help.o history.o hook.o init.o keymap.o mutt_logging.o main.o \
mbox.o menu.o mh.o muttlib.o \
mutt_socket.o tags.o mx.o \
newsrc.o nntp.o pager.o parse.o pattern.o pop.o \
pop_auth.o pop_lib.o postpone.o query.o recvattach.o recvcmd.o \
rfc1524.o rfc2047.o rfc2231.o rfc3676.o \
safe_asprintf.o score.o send.o sendlib.o sidebar.o mutt_signal.o \
resize.o smtp.o sort.o state.o status.o system.o thread.o url.o \
version.o
@if !HAVE_WCSCASECMP
NEOMUTTOBJS+= wcscasecmp.o
@endif
@if USE_NOTMUCH
NEOMUTTOBJS+= mutt_notmuch.o
@endif
@if MIXMASTER
NEOMUTTOBJS+= remailer.o
@endif
@if USE_LUA
NEOMUTTOBJS+= mutt_lua.o
@endif
CLEANFILES+= $(NEOMUTT) $(NEOMUTTOBJS)
ALLOBJS+= $(NEOMUTTOBJS)
###############################################################################
# libmutt
LIBMUTT= libmutt.a
LIBMUTTOBJS= mutt/address.o mutt/base64.o mutt/buffer.o mutt/charset.o \
mutt/date.o mutt/exit.o \
mutt/file.o mutt/hash.o mutt/idna.o mutt/list.o mutt/logging.o \
mutt/mapping.o mutt/mbyte.o mutt/md5.o \
mutt/memory.o mutt/mime.o mutt/parameter.o \
mutt/regex.o mutt/sha1.o mutt/signal.o mutt/string.o \
mutt/rfc2047.o
CLEANFILES+= $(LIBMUTT) $(LIBMUTTOBJS)
MUTTLIBS+= $(LIBMUTT)
ALLOBJS+= $(LIBMUTTOBJS)
###############################################################################
# libncrypt
LIBNCRYPT= libncrypt.a
LIBNCRYPTOBJS= ncrypt/crypt.o ncrypt/crypt_mod.o ncrypt/cryptglue.o
@if HAVE_GPGME
LIBNCRYPTOBJS+= ncrypt/crypt_gpgme.o ncrypt/crypt_mod_pgp_gpgme.o \
ncrypt/crypt_mod_smime_gpgme.o
@endif
@if HAVE_PGP
LIBNCRYPTOBJS+= ncrypt/crypt_mod_pgp_classic.o ncrypt/gnupgparse.o \
ncrypt/pgp.o ncrypt/pgpinvoke.o ncrypt/pgpkey.o \
ncrypt/pgplib.o ncrypt/pgpmicalg.o ncrypt/pgppacket.o
@endif
@if HAVE_SMIME
LIBNCRYPTOBJS+= ncrypt/crypt_mod_smime_classic.o ncrypt/smime.o
@endif
CLEANFILES+= $(LIBNCRYPT) $(LIBNCRYPTOBJS)
MUTTLIBS+= $(LIBNCRYPT)
ALLOBJS+= $(LIBNCRYPTOBJS)
###############################################################################
# libimap
LIBIMAP= libimap.a
LIBIMAPOBJS= imap/auth.o imap/auth_anon.o imap/auth_cram.o \
imap/auth_login.o imap/auth_plain.o imap/browse.o \
imap/command.o imap/imap.o imap/message.o imap/utf7.o \
imap/util.o
@if USE_GSS
LIBIMAPOBJS+= imap/auth_gss.o
@endif
@if HAVE_SASL
LIBIMAPOBJS+= imap/auth_sasl.o
@endif
CLEANFILES+= $(LIBIMAP) $(LIBIMAPOBJS)
MUTTLIBS+= $(LIBIMAP)
ALLOBJS+= $(LIBIMAPOBJS)
###############################################################################
# libconn
LIBCONN= libconn.a
LIBCONNOBJS= conn/conn_globals.o conn/getdomain.o conn/sasl_plain.o \
conn/socket.o conn/tunnel.o
@if HAVE_SASL
LIBCONNOBJS+= conn/sasl.o
@endif
@if USE_SSL_OPENSSL
LIBCONNOBJS+= conn/ssl.o
@endif
@if USE_SSL_GNUTLS
LIBCONNOBJS+= conn/ssl_gnutls.o
@endif
CLEANFILES+= $(LIBCONN) $(LIBCONNOBJS)
MUTTLIBS+= $(LIBCONN)
ALLOBJS+= $(LIBCONNOBJS)
###############################################################################
# libhcache
@if USE_HCACHE
LIBHCACHE= libhcache.a
LIBHCACHEOBJS= hcache/hcache.o
CLEANFILES+= $(LIBHCACHE) $(LIBHCACHEOBJS)
MUTTLIBS+= $(LIBHCACHE)
ALLOBJS+= $(LIBHCACHEOBJS)
@if HAVE_BDB
LIBHCACHEOBJS+= hcache/bdb.o
@endif
@if HAVE_GDBM
LIBHCACHEOBJS+= hcache/gdbm.o
@endif
@if HAVE_KC
LIBHCACHEOBJS+= hcache/kc.o
@endif
@if HAVE_LMDB
LIBHCACHEOBJS+= hcache/lmdb.o
@endif
@if HAVE_QDBM
LIBHCACHEOBJS+= hcache/qdbm.o
@endif
@if HAVE_TC
LIBHCACHEOBJS+= hcache/tc.o
@endif
@endif # USE_HCACHE
###############################################################################
# pgpewrap
PGPEWRAP= pgpewrap$(EXEEXT)
PGPEWRAPOBJS= pgpewrap.o
CLEANFILES+= $(PGPEWRAP) $(PGPEWRAPOBJS)
ALLOBJS+= $(PGPEWRAPOBJS)
###############################################################################
# pgpring
PGPRING= pgpring$(EXEEXT)
PGPRINGOBJS= pgppubring.o
CLEANFILES+= $(PGPRING) $(PGPRINGOBJS)
ALLOBJS+= $(PGPRINGOBJS)
###############################################################################
# generated
GENERATED= git_ver.h hcache/hcversion.h
CLEANFILES+= $(GENERATED)
##############################################################################
# targets
all: $(BINFILES) $(LIBBINFILES) $(ALL_TARGETS)
# compile + dependencies
.c.o:
$(CC) $(CFLAGS) -MT $@ -MD -MP -MF $*.Tpo -c -o $@ $<
@mv $*.Tpo $*.Po
# make sure git_ver.h is built before any .o files
$(ALLOBJS): git_ver.h
# mutt
$(NEOMUTT): $(GENERATED) $(NEOMUTTOBJS) $(MUTTLIBS)
$(CC) -o $@ $(NEOMUTTOBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
# libmutt
$(LIBMUTT): $(PWD)/mutt $(LIBMUTTOBJS)
$(AR) cr $@ $(LIBMUTTOBJS)
$(RANLIB) $@
$(PWD)/mutt:
$(MKDIR_P) $(PWD)/mutt
# libncrypt
$(LIBNCRYPT): $(PWD)/ncrypt $(LIBNCRYPTOBJS)
$(AR) cr $@ $(LIBNCRYPTOBJS)
$(RANLIB) $@
$(PWD)/ncrypt:
$(MKDIR_P) $(PWD)/ncrypt
# libimap
$(LIBIMAP): $(PWD)/imap $(LIBIMAPOBJS)
$(AR) cr $@ $(LIBIMAPOBJS)
$(RANLIB) $@
$(PWD)/imap:
$(MKDIR_P) $(PWD)/imap
# libconn
$(LIBCONN): $(PWD)/conn $(LIBCONNOBJS)
$(AR) cr $@ $(LIBCONNOBJS)
$(RANLIB) $@
$(PWD)/conn:
$(MKDIR_P) $(PWD)/conn
# libhcache
hcache/hcache.o: hcache/hcversion.h
$(LIBHCACHE): $(PWD)/hcache $(LIBHCACHEOBJS)
$(AR) cr $@ $(LIBHCACHEOBJS)
$(RANLIB) $@
$(PWD)/hcache:
$(MKDIR_P) $(PWD)/hcache
# pgpewrap
$(PGPEWRAP): $(PGPEWRAPOBJS)
$(CC) $(LDFLAGS) -o $@ $(PGPEWRAPOBJS)
# pgpring
$(PGPRING): $(PGPRINGOBJS) $(LIBMUTT) $(LIBNCRYPT)
$(CC) $(LDFLAGS) -o $@ $(PGPRINGOBJS) $(LIBMUTT) $(LIBNCRYPT) $(INTLLIBS)
# generated
git_ver.h: $(ALL_FILES)
version=`git describe --dirty --abbrev=6 --match "neomutt-*" 2> /dev/null | \
sed -e 's/^neomutt-[0-9]\{8\}//; s/-g\([a-z0-9]\{6\}\)/-\1/'`; \
echo 'const char *GitVer = "'$$version'";' > git_ver.h.tmp; \
cmp -s git_ver.h.tmp git_ver.h || mv git_ver.h.tmp git_ver.h; \
rm -f git_ver.h.tmp
hcache/hcversion.h: $(SRCDIR)/mutt.h $(SRCDIR)/mutt/address.h \
$(SRCDIR)/mutt/list.h $(SRCDIR)/mutt/buffer.h \
$(SRCDIR)/mutt/parameter.h $(SRCDIR)/body.h \
$(SRCDIR)/envelope.h $(SRCDIR)/header.h \
$(SRCDIR)/hcache/hcachever.sh \
$(PWD)/hcache
( echo '#include "config.h"'; echo '#include "mutt.h"'; \
echo '#include "mutt/address.h"'; echo '#include "mutt/list.h"'; \
echo '#include "mutt/buffer.h"'; echo '#include "mutt/parameter.h"'; \
echo '#include "body.h"'; echo '#include "envelope.h"'; \
echo '#include "header.h"';) | $(CPP) $(CFLAGS) - | \
sh $(SRCDIR)/hcache/hcachever.sh hcache/hcversion.h
# clean
clean: $(CLEAN_TARGETS)
rm -f $(CLEANFILES)
# install
install: all $(INSTALL_TARGETS)
# Install binaries
$(MKDIR_P) $(DESTDIR)$(bindir)
for f in $(BINFILES); do \
$(INSTALL) $$f $(DESTDIR)$(bindir)/`basename $$f`; \
done
$(MKDIR_P) $(DESTDIR)$(libexecdir)/$(PACKAGE)
for f in $(LIBBINFILES); do \
$(INSTALL) $$f $(DESTDIR)$(libexecdir)/$(PACKAGE)/`basename $$f`; \
done
# uninstall
uninstall: $(UNINSTALL_TARGETS)
# Uninstall binaries
for f in $(BINFILES); do \
$(RM) $(DESTDIR)$(bindir)/`basename $$f`; \
done
for f in $(LIBBINFILES); do \
$(RM) $(DESTDIR)$(libexecdir)/$(PACKAGE)/`basename $$f`; \
done
# distclean
distclean: clean
$(RM) $(DEPFILES) conststrings.c config.h config.log doc/neomutt.1 \
Makefile po/Makefile contrib/Makefile doc/Makefile \
test/Makefile autosetup/jimsh0
##############################################################################
# include generated dependency files
-include $(DEPFILES)
##############################################################################
# include special-purpose makefiles, each one of which MUST define the
# dedicated all-, clean-, install-, and uninstall- targets.
include po/Makefile
include contrib/Makefile
include doc/Makefile
include test/Makefile
# vim: set ts=8 noexpandtab: