| 1 |
# Cheap BBDB makefile -*- Makefile -*- |
| 2 |
# Copyright (C) 2010-2023 Roland Winkler <[email protected]> |
| 3 |
# |
| 4 |
# This file is part of the Insidious Big Brother Database (aka BBDB), |
| 5 |
# |
| 6 |
# BBDB is free software: you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation, either version 3 of the License, or |
| 9 |
# (at your option) any later version. |
| 10 |
# |
| 11 |
# BBDB is distributed in the hope that it will be useful, |
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
# GNU General Public License for more details. |
| 15 |
# |
| 16 |
# You should have received a copy of the GNU General Public License |
| 17 |
# along with BBDB. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
|
| 19 |
### Commentary: |
| 20 |
|
| 21 |
# This file provides a cheap workaround for (most of) those users |
| 22 |
# who like to use the latest BBDB, but do not have autotools installed. |
| 23 |
# This file can compile BBDB's lisp code on most systems. Yet it is not |
| 24 |
# intended to be foolproof! |
| 25 |
# This file may also come handy for BBDB developers as it knows |
| 26 |
# about the proper dependencies of the elisp files, so that it keeps |
| 27 |
# the *.elc files consistently up to date. |
| 28 |
|
| 29 |
srcdir = . |
| 30 |
prefix = /usr/local |
| 31 |
lispdir = $(DESTDIR)/usr/local/share/emacs/site-lisp/bbdb |
| 32 |
|
| 33 |
INSTALL = /usr/bin/install -c |
| 34 |
INSTALL_DATA = ${INSTALL} -m 644 |
| 35 |
|
| 36 |
RM = /bin/rm -f |
| 37 |
LN_S = /bin/ln -s |
| 38 |
CP = /bin/cp |
| 39 |
|
| 40 |
EMACS = emacs |
| 41 |
|
| 42 |
# Command line flags for Emacs. |
| 43 |
EMACSOPT = |
| 44 |
|
| 45 |
# The actual Emacs command run in the targets below. |
| 46 |
# --batch implies --no-init-file, yet let's be explicit about what we want |
| 47 |
emacs = LC_ALL=C $(EMACS) --batch --no-init-file --no-site-file \ |
| 48 |
--directory=./ $(EMACSOPT) |
| 49 |
emacs_compile = $(emacs) --funcall batch-byte-compile |
| 50 |
|
| 51 |
# Mu4e is not part of GNU Emacs. If you want to use BBDB with Mu4e |
| 52 |
# then the variable MU4EDIR should point to your mu4e lisp directory. |
| 53 |
MU4EDIR = |
| 54 |
MU4E = -eval '(unless (string= "$(MU4EDIR)" "") (push "$(MU4EDIR)" load-path))' |
| 55 |
|
| 56 |
# VM is not part of GNU Emacs. If you want to use BBDB with VM |
| 57 |
# then the variable VMDIR should point to your vm/lisp directory. |
| 58 |
VMDIR = |
| 59 |
VM = -eval '(unless (string= "$(VMDIR)" "") (push "$(VMDIR)" load-path))' |
| 60 |
|
| 61 |
# WL is not part of GNU Emacs. If you want to use BBDB with WL |
| 62 |
# then the variable WLDIR should point to your wl/lisp directory. |
| 63 |
WLDIR = |
| 64 |
WL = -eval '(unless (string= "$(WLDIR)" "") (push "$(WLDIR)" load-path))' |
| 65 |
|
| 66 |
# notmuch is not part of GNU Emacs. If you want to use BBDB with notmuch |
| 67 |
# then the variable NOTMUCHDIR should point to your notmuch/lisp directory. |
| 68 |
NOTMUCHDIR = |
| 69 |
NOTMUCH = -eval '(unless (string= "$(NOTMUCHDIR)" "") (push "$(NOTMUCHDIR)" load-path))' |
| 70 |
|
| 71 |
.SUFFIXES: .elc .el .tar .Z .gz .uu |
| 72 |
|
| 73 |
SRCS = bbdb.el bbdb-site.el bbdb-com.el bbdb-tex.el bbdb-anniv.el \ |
| 74 |
bbdb-migrate.el bbdb-snarf.el \ |
| 75 |
bbdb-mua.el bbdb-message.el bbdb-rmail.el \ |
| 76 |
bbdb-gnus.el bbdb-gnus-aux.el bbdb-mhe.el bbdb-mu4e.el \ |
| 77 |
bbdb-vm.el bbdb-vm-aux.el bbdb-pgp.el \ |
| 78 |
bbdb-sc.el bbdb-wl.el \ |
| 79 |
bbdb-ispell.el bbdb-pkg.el |
| 80 |
|
| 81 |
# ELC = $(patsubst %.el,%.elc,$(SRCS)) # GNU Make |
| 82 |
ELC = bbdb.elc bbdb-site.elc bbdb-com.elc bbdb-tex.elc bbdb-anniv.elc \ |
| 83 |
bbdb-migrate.elc bbdb-snarf.elc \ |
| 84 |
bbdb-mua.elc bbdb-message.elc bbdb-rmail.elc \ |
| 85 |
bbdb-gnus.elc bbdb-gnus-aux.elc bbdb-mhe.elc bbdb-pgp.elc bbdb-sc.elc \ |
| 86 |
bbdb-ispell.elc bbdb-wl.elc # bbdb-pkg.elc |
| 87 |
|
| 88 |
all: bbdb |
| 89 |
|
| 90 |
bbdb: bbdb-loaddefs.el $(ELC) |
| 91 |
mu4e: bbdb-mu4e.elc |
| 92 |
vm: bbdb-vm.elc bbdb-vm-aux.elc |
| 93 |
wl: bbdb-wl.elc |
| 94 |
notmuch: bbdb-notmuch.elc |
| 95 |
|
| 96 |
bbdb-loaddefs.el: $(SRCS) |
| 97 |
# 2011-12-11: We switched from bbdb-autoloads.el to bbdb-loaddefs.el. |
| 98 |
# If the user still has an old bbdb-autoloads.el in the BBDB |
| 99 |
# lisp directory (and keeps loading it from the emacs init file), |
| 100 |
# we might get strange error messages that things fail. |
| 101 |
# So we throw an error if these old files are found. |
| 102 |
@if test -f bbdb-autoloads.el -o -f bbdb-autoloads.elc; then \ |
| 103 |
(echo "*** ERROR: Old file(s) \`bbdb-autoloads.el(c)' found ***" ; \ |
| 104 |
echo "*** Delete these files; do not load them from your init file ***") && \ |
| 105 |
false ; \ |
| 106 |
fi |
| 107 |
-$(RM) $@; |
| 108 |
@echo "(provide 'bbdb-loaddefs)" > $@; |
| 109 |
@echo "(if (and load-file-name (file-name-directory load-file-name))" >> $@; |
| 110 |
@echo " (add-to-list 'load-path (file-name-directory load-file-name)))" >> $@; |
| 111 |
@echo "" >> $@; |
| 112 |
# Generated autoload-file must have an absolute path, |
| 113 |
# $(srcdir) can be relative. |
| 114 |
$(emacs) --load autoload \ |
| 115 |
--eval '(setq generated-autoload-file "'`pwd`/$@'")' \ |
| 116 |
--eval '(setq make-backup-files nil)' \ |
| 117 |
--funcall batch-update-autoloads `pwd` |
| 118 |
|
| 119 |
.el.elc: |
| 120 |
$(emacs_compile) $< |
| 121 |
|
| 122 |
# Not perfect, but better than nothing: If we do not have / do not use |
| 123 |
# autotools, we simply copy bbdb-site.el.in to bbdb-site.el. |
| 124 |
bbdb-site.el: bbdb-site.el.in |
| 125 |
$(CP) $< $@ |
| 126 |
bbdb-site.elc: bbdb-site.el |
| 127 |
$(emacs_compile) $(@:.elc=.el) |
| 128 |
bbdb-pkg.el: bbdb-pkg.el.in |
| 129 |
$(CP) $< $@ |
| 130 |
|
| 131 |
bbdb.elc: bbdb.el bbdb-site.elc |
| 132 |
$(emacs_compile) $(@:.elc=.el) |
| 133 |
|
| 134 |
bbdb-com.elc: bbdb-com.el bbdb.elc |
| 135 |
$(emacs_compile) $(@:.elc=.el) |
| 136 |
bbdb-mua.elc: bbdb-mua.el bbdb-com.elc |
| 137 |
$(emacs) -eval '(unless (string= "$(VMDIR)" "") (push "$(VMDIR)" load-path) (load "vm" t t))' \ |
| 138 |
-eval '(unless (string= "$(MU4EDIR)" "") (push "$(MU4EDIR)" load-path) (load "mu4e" t t))' \ |
| 139 |
-eval '(unless (string= "$(WLDIR)" "") (push "$(WLDIR)" load-path) (load "wl" t t))' \ |
| 140 |
--funcall batch-byte-compile $(@:.elc=.el) |
| 141 |
bbdb-rmail.elc: bbdb-rmail.el bbdb-mua.elc |
| 142 |
$(emacs_compile) $(@:.elc=.el) |
| 143 |
bbdb-gnus.elc: bbdb-gnus.el bbdb-mua.elc |
| 144 |
$(emacs_compile) $(@:.elc=.el) |
| 145 |
bbdb-gnus-aux.elc: bbdb-gnus-aux.el bbdb-mua.elc |
| 146 |
$(emacs_compile) $(@:.elc=.el) |
| 147 |
bbdb-mhe.elc: bbdb-mhe.el bbdb-mua.elc |
| 148 |
$(emacs_compile) $(@:.elc=.el) |
| 149 |
bbdb-mu4e.elc: bbdb-mu4e.el bbdb-mua.elc |
| 150 |
$(emacs) $(MU4E) --funcall batch-byte-compile $(@:.elc=.el) |
| 151 |
bbdb-wl.elc: bbdb-wl.el bbdb-mua.elc |
| 152 |
$(emacs_compile) $(@:.elc=.el) |
| 153 |
bbdb-notmuch.elc: bbdb-notmuch.el bbdb-mua.elc |
| 154 |
$(emacs) $(NOTMUCH) --funcall batch-byte-compile $(@:.elc=.el) |
| 155 |
bbdb-vm.elc: bbdb-vm.el bbdb-mua.elc |
| 156 |
$(emacs) $(VM) --funcall batch-byte-compile $(@:.elc=.el) |
| 157 |
bbdb-vm-aux.elc: bbdb-vm-aux.el bbdb-mua.elc |
| 158 |
$(emacs) $(VM) --funcall batch-byte-compile $(@:.elc=.el) |
| 159 |
bbdb-sc.elc: bbdb-sc.el bbdb-mua.elc |
| 160 |
$(emacs_compile) $(@:.elc=.el) |
| 161 |
|
| 162 |
bbdb-tex.elc: bbdb-tex.el bbdb-com.elc |
| 163 |
$(emacs_compile) $(@:.elc=.el) |
| 164 |
bbdb-migrate.elc: bbdb-migrate.el bbdb.elc |
| 165 |
$(emacs_compile) $(@:.elc=.el) |
| 166 |
bbdb-anniv.elc: bbdb-anniv.el bbdb-com.elc |
| 167 |
$(emacs_compile) $(@:.elc=.el) |
| 168 |
bbdb-ispell.elc: bbdb-ispell.el bbdb.elc |
| 169 |
$(emacs_compile) $(@:.elc=.el) |
| 170 |
bbdb-snarf.elc: bbdb-snarf.el bbdb-com.elc |
| 171 |
$(emacs_compile) $(@:.elc=.el) |
| 172 |
|
| 173 |
install-el: all |
| 174 |
$(INSTALL) -d -m 0755 "$(lispdir)/" |
| 175 |
for elc in *.elc; do \ |
| 176 |
el=`basename $$elc c`; \ |
| 177 |
if test -f "$(srcdir)/$$el"; then \ |
| 178 |
echo "Install $$el in $(lispdir)/"; \ |
| 179 |
$(INSTALL_DATA) "${srcdir}/$$el" "$(lispdir)/"; \ |
| 180 |
fi; \ |
| 181 |
done; |
| 182 |
for el in bbdb-loaddefs.el; do \ |
| 183 |
echo "Install $$el in $(lispdir)/"; \ |
| 184 |
$(INSTALL_DATA) $$el "$(lispdir)/"; \ |
| 185 |
done; |
| 186 |
|
| 187 |
install-elc: all |
| 188 |
$(INSTALL) -d -m 0755 "$(lispdir)/" |
| 189 |
for elc in bbdb-loaddefs.el *.elc; do \ |
| 190 |
echo "Install $$elc in $(lispdir)/"; \ |
| 191 |
$(INSTALL_DATA) $$elc "$(lispdir)/"; \ |
| 192 |
done; |
| 193 |
|
| 194 |
uninstall: |
| 195 |
for elc in *.elc; do \ |
| 196 |
$(RM) "$(lispdir)/$$elc"; \ |
| 197 |
done |
| 198 |
for el in *.el; do \ |
| 199 |
$(RM) "$(lispdir)/$$el"; \ |
| 200 |
done |
| 201 |
|
| 202 |
# Assorted clean-up targets |
| 203 |
clean: |
| 204 |
-$(RM) bbdb*.elc TAGS |
| 205 |
|
| 206 |
distclean: clean |
| 207 |
|
| 208 |
maintainer-clean: distclean |
| 209 |
-$(RM) bbdb-loaddefs.el # Generated file |
| 210 |
-$(RM) Makefile |
| 211 |
|
| 212 |
extraclean: maintainer-clean |
| 213 |
-$(RM) *~ \#* |
| 214 |
|
| 215 |
TAGS: $(SRCS) |
| 216 |
etags $(SRCS) |