-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmin-Makefile
193 lines (153 loc) · 5.92 KB
/
min-Makefile
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
V ?= 0
CC ?= gcc
RM = rm -fr
MKDIR = mkdir -p
DEPDIR = .dep
OBJDIR = .obj
HCACHEDIR = $(DEPDIR)/hcache
IMAPDIR = $(DEPDIR)/imap
LIBDIR = $(DEPDIR)/lib
NCRYPTDIR = $(DEPDIR)/ncrypt
OUT = mutt
SRC += account.c addrbook.c alias.c attach.c auth.c auth_anon.c \
auth_cram.c auth_gss.c auth_login.c auth_plain.c auth_sasl.c base64.c \
bcache.c bdb.c browse.c browser.c buffer.c buffy.c charset.c color.c \
command.c commands.c complete.c compose.c compress.c copy.c crypt.c \
cryptglue.c crypt_gpgme.c crypt_mod.c crypt_mod_pgp_classic.c \
crypt_mod_pgp_gpgme.c crypt_mod_smime_classic.c crypt_mod_smime_gpgme.c \
curs_lib.c curs_main.c date.c edit.c editmsg.c enter.c file.c filter.c \
flags.c from.c gdbm.c getdomain.c gnupgparse.c group.c handler.c hash.c \
hcache.c hdrline.c headers.c help.c history.c hook.c imap.c init.c kc.c \
keymap.c lmdb.c main.c mbox.c mbyte.c md5.c memory.c menu.c message.c \
message2.c mh.c muttlib.c mutt_idna.c mutt_lua.c mutt_notmuch.c \
mutt_sasl.c mutt_sasl_plain.c mutt_socket.c mutt_ssl_gnutls.c \
mutt_tunnel.c mx.c newsrc.c nntp.c pager.c parameter.c parse.c \
pattern.c pgp.c pgpinvoke.c pgpkey.c pgplib.c pgpmicalg.c pgppacket.c \
pop.c pop_auth.c pop_lib.c postpone.c qdbm.c query.c recvattach.c \
recvcmd.c remailer.c resize.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
rfc822.c safe_asprintf.c score.c send.c sendlib.c sha1.c sidebar.c \
signal.c smime.c smtp.c sort.c state.c status.c string.c system.c tc.c \
thread.c url.c utf7.c util.c version.c
HDR += account.h address.h alias.h attach.h auth.h backend.h base64.h \
bcache.h body.h browser.h buffer.h buffy.h charset.h compress.h \
config.h content.h context.h copy.h crypt.h cryptglue.h crypt_gpgme.h \
crypt_mod.h date.h debug.h enter_state.h envelope.h exit.h file.h \
filter.h format_flags.h functions.h globals.h gnupgparse.h group.h \
hash.h hcache.h header.h history.h imap.h imap_private.h init.h \
keymap.h lib.h list.h mailbox.h mapping.h mbyte.h mbyte_table.h md5.h \
memory.h message.h message2.h mime.h mutt.h mutt_commands.h \
mutt_curses.h mutt_idna.h mutt_lua.h mutt_menu.h mutt_notmuch.h \
mutt_options.h mutt_regex.h mutt_sasl.h mutt_sasl_plain.h \
mutt_socket.h mutt_ssl.h mutt_tunnel.h mx.h myvar.h ncrypt.h nntp.h \
options.h pager.h parameter.h pattern.h pgp.h pgpinvoke.h pgpkey.h \
pgplib.h pgpmicalg.h pgppacket.h pop.h protos.h remailer.h rfc1524.h \
rfc2047.h rfc2231.h rfc3676.h rfc822.h sha1.h sidebar.h smime.h sort.h \
state.h string2.h thread.h url.h version.h where.h
BUILT_SRC = conststrings.c patchlist.c
SRC += $(BUILT_SRC)
BUILT_HDR = hcversion.h keymap_defs.h oldmutt_ver.h reldate.h git_ver.h
HDR += $(BUILT_HDR)
OBJ += $(SRC:%.c=$(OBJDIR)/%.o)
CFLAGS += -DPKGDATADIR=\"/usr/share/mutt\"
CFLAGS += -DSYSCONFDIR=\"/etc\"
CFLAGS += -DBINDIR=\"/usr/bin\"
CFLAGS += -DMUTTLOCALEDIR=\"/usr/share/locale\"
CFLAGS += -Wall
# CFLAGS += -Wextra
# CFLAGS += -Wpedantic
CFLAGS += -g
CFLAGS += -O0
CFLAGS += -I.
CFLAGS += -I$(DEPDIR)
# CFLAGS += -Ihcache
# CFLAGS += -Iimap
# CFLAGS += -Incrypt
CFLAGS += -I/usr/include/qdbm
LDFLAGS += -pthread
LDFLAGS += -rdynamic
CFLAGS += -fno-omit-frame-pointer
PACKAGES += gnutls
PACKAGES += krb5-gssapi
PACKAGES += kyotocabinet
PACKAGES += libidn
PACKAGES += libsasl2
PACKAGES += lmdb
PACKAGES += lua
PACKAGES += ncursesw
PACKAGES += qdbm
PACKAGES += tokyocabinet
CFLAGS += $(shell pkg-config --cflags $(PACKAGES))
LDFLAGS += $(shell pkg-config --libs $(PACKAGES))
LDFLAGS += -lanl
LDFLAGS += -ldb
LDFLAGS += -lgpgme
LDFLAGS += -lnotmuch
all: $(OBJDIR) $(DEPDIR) $(HCACHEDIR) $(IMAPDIR) $(LIBDIR) $(NCRYPTDIR) $(BUILT_HDR) $(BUILT_SRC) $(OBJ) $(OUT) tags
# ----------------------------------------------------------------------------
ifneq ($(V),1)
Q := @
endif
QUIET_CC = $(Q:@=@echo 'CC '$<;)
QUIET_LINK = $(Q:@=@echo 'LD '$@;)
QUIET_TAGS = $(Q:@=@echo 'TAGS '$@;)
ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
QUIET_CC =
QUIET_LINK =
QUIET_TAGS =
endif
# ----------------------------------------------------------------------------
$(OBJDIR)/%.o: %.c
$(QUIET_CC)$(CC) $(CFLAGS) -c $< -o $@ && ( \
$(CC) -MM $(CFLAGS) -c $< | sed 's/.*:/'$(OBJDIR)'\/\0/' > $(DEPDIR)/$*.d; \
cp -f $(DEPDIR)/$*.d $(DEPDIR)/$*.d.tmp; \
sed -e 's/.*://' -e 's/\\$$//' < $(DEPDIR)/$*.d.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $(DEPDIR)/$*.d; \
$(RM) $(DEPDIR)/$*.d.tmp)
# ----------------------------------------------------------------------------
$(OUT): $(OBJ)
$(QUIET_LINK)$(CC) -o $@ $(OBJ) $(LDFLAGS)
$(DEPDIR) $(OBJDIR):
$(Q)$(MKDIR) $@
$(HCACHEDIR) $(IMAPDIR) $(LIBDIR) $(NCRYPTDIR): $(DEPDIR)
$(Q)ln -s .. $@
# ----------------------------------------------------------------------------
tags: $(SRC) $(HDR)
$(QUIET_TAGS)ctags *.[ch]
clean:
$(Q)$(RM) $(OUT) $(OBJ)
distclean: clean
$(Q)$(RM) $(DEPDIR) $(OBJDIR) tags $(BUILT_SRC) $(BUILT_HDR)
force:
-include $(SRC:%.c=$(DEPDIR)/%.d)
$(SRC): keymap_defs.h oldmutt_ver.h
reldate.h:
@echo "const char *ReleaseDate = \""$(shell date +%F)"\";" > $@
patchlist.c:
@echo "#include <stdio.h>" > $@
@echo "void mutt_print_patchlist (void)" >> $@
@echo "{" >> $@
@echo "}" >> $@
conststrings.c:
@echo "unsigned char cc_version[] = { 0 };" > $@
@echo "unsigned char cc_cflags[] = { 0 };" >> $@
@echo "unsigned char configure_options[] = { 0 };" >> $@
hcversion.h:
@echo "#define HCACHEVER 0x4bfe345c" > $@
keymap_defs.h:
@echo "#ifndef _MUTT_KEYMAP_DEFS_H" > $@
@echo "#define _MUTT_KEYMAP_DEFS_H 1" >> $@
@echo "#ifdef HELP_C" >> $@
@echo "const char *HelpStrings[] = {" >> $@
@cat OPS* | sed 's/^[^ ]* *\(.*\)/ N_(\1),/' >> $@
@echo ' NULL' >> $@
@echo "};" >> $@
@echo "#endif /* MAIN_C */" >> $@
@echo '' >> $@
@echo "enum {" >> $@
@cat OPS* | sed 's/^\([^ ]*\).*/ \1,/' >> $@
@echo ' OP_MAX' >> $@
@echo "};" >> $@
@echo "#endif /* _MUTT_KEYMAP_DEFS_H */" >> $@
oldmutt_ver.h:
@echo 'const char *OldMuttVer = "1.7.0";' > $@
git_ver.h:
@echo 'const char *GitVer = "";' > $@