forked from magit/magit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
289 lines (244 loc) · 8.21 KB
/
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
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
PREFIX ?= /usr/local
datarootdir ?= $(PREFIX)/share
lispdir ?= $(datarootdir)/emacs/site-lisp/magit
infodir ?= $(datarootdir)/info
docdir ?= $(datarootdir)/doc/magit
execdir ?= $(PREFIX)/bin
LOADDEFS_FILE ?= magit-autoloads.el
LOADDEFS_DIR ?= $(lispdir)
ELS = magit.el
ELS += magit-blame.el
ELS += magit-key-mode.el
ELS += magit-stgit.el
ELS += magit-svn.el
ELS += magit-topgit.el
ELS += magit-wip.el
ELCS = $(ELS:.el=.elc)
CP ?= install -p -m 644
CPBIN ?= install -p -m 755
MKDIR ?= install -p -m 755 -d
RMDIR ?= rm -rf
MAKEINFO ?= makeinfo
INSTALL_INFO ?= install-info
EFLAGS ?= -L ../git-modes -L ../cl-lib
EMACS ?= emacs
BATCH = $(EMACS) $(EFLAGS) -batch -Q -L .
BATCHE = $(BATCH) -eval
BATCHC = $(BATCH) -f batch-byte-compile
VERSION=$(shell \
test -e .git && git describe --tags --dirty 2> /dev/null || \
$(BATCHE) "(progn\
(require 'cl)\
(flet ((message (&rest _) _))\
(load-file \"magit-version.el\"))\
(princ magit-version))")
.PHONY: lisp
lisp: $(ELCS) magit-version.el loaddefs
.PHONY: all
all: lisp docs
.PHONY: help
help:
$(info Getting Help)
$(info ============)
$(info )
$(info make help - show brief help)
$(info )
$(info Build)
$(info =====)
$(info )
$(info make - build elisp files)
$(info make lisp - ditto)
$(info make all - build elisp files and documentation)
$(info make docs - generate documentation)
$(info )
$(info Install)
$(info =======)
$(info )
$(info make install - install elisp files and documentation)
$(info make install-lisp - install elisp files)
$(info make install-docs - install documentation)
$(info make install-script - install shell script)
$(info make install-all - install elisp files, script, and docs)
$(info )
$(info Test)
$(info ====)
$(info )
$(info make test - run tests)
$(info make test-interactive - run tests interactively)
$(info )
$(info Release Managment)
$(info =================)
$(info )
$(info make authors - regenerate the AUTHORS.md file)
$(info make dist - create old-school tarball)
$(info make marmalade - create marmalade tarball)
@printf "\n"
%.elc: %.el
@$(BATCHC) $<
# Not a phony target, but needs to run *every* time.
.PHONY: magit-version.el
magit-version.el:
@printf "Generating magit-version.el\n"
@printf ";;; magit-version.el --- the Magit version you are using\n\n" > $@
@printf "(setq magit-version \""$(VERSION)"\")\n\n" >> $@
@printf "(provide 'magit-version)\n\n" >> $@
@printf ";; Local Variables:\n" >> $@
@printf ";; version-control: never\n" >> $@
@printf ";; no-byte-compile: t\n" >> $@
@printf ";; no-update-autoloads: t\n" >> $@
@printf ";; coding: utf-8\n" >> $@
@printf ";; End:\n" >> $@
@printf ";;; magit-version.el ends here\n" >> $@
# Not a phony target, but needs to run *every* time.
.PHONY: magit-pkg.el
magit-pkg.el:
@printf "Generating magit-pkg.el\n"
@printf "(define-package \"magit\" \""$(VERSION)"\"\n" > $@
@printf " \"Control Git from Emacs.\"\n" >> $@
@printf " '((cl-lib \"0.3\")\n" >> $@
@printf " (git-commit-mode \"0.14.0\")\n" >> $@
@printf " (git-rebase-mode \"0.14.0\")))\n" >> $@
.PHONY: loaddefs
loaddefs: $(LOADDEFS_FILE)
$(LOADDEFS_FILE): $(ELS)
@$(BATCHE) "(progn\
(setq vc-handled-backends nil)\
(defvar generated-autoload-file nil)\
(let ((generated-autoload-file \"$(CURDIR)/$(LOADDEFS_FILE)\")\
(make-backup-files nil))\
(update-directory-autoloads \".\")))"
.PHONY: docs
docs: magit.info dir
%.info: %.texi
$(MAKEINFO) $< -o $@
dir: magit.info
$(INSTALL_INFO) --dir=$@ $<
define MAILMAP
Alex Ott <[email protected]> <[email protected]>
Seong-Kook Shin <[email protected]>
David Abrahams <[email protected]>
Evgkeni Sampelnikof <[email protected]> <[email protected]>
Evgkeni Sampelnikof <[email protected]> <[email protected]>
Graham Clark <[email protected]> <gcla@moria.(none)>
Jesse Alama <[email protected]> <[email protected]>
Jonas Bernoulli <[email protected]> <[email protected]>
Leo Liu <[email protected]>
Marc Herbert <[email protected]> <[email protected]>
Marc Herbert <[email protected]> <[email protected]>
Marcel Wolf <[email protected]> marcel-wolf
Marius Vollmer <[email protected]> <[email protected]>
Marius Vollmer <[email protected]> <[email protected]>
Marius Vollmer <[email protected]> <mvo@bright.(none)>
Marius Vollmer <[email protected]> <[email protected]>
Marius Vollmer <[email protected]> <mvo@manamana.(none)>
Noam Postavsky <[email protected]>
Óscar Fuentes <[email protected]> Oscar Fuentes <[email protected]>
Óscar Fuentes <[email protected]> <oscar@nc10>
Óscar Fuentes <[email protected]> <oscar@qcore>
Peter J. Weisberg <[email protected]>
Rémi Vanicat <[email protected]> <[email protected]>
Sébastien Gross <[email protected]> <seb•ɑƬ•chezwam•ɖɵʈ•org>
Yann Hodique <[email protected]> <[email protected]>
Yann Hodique <[email protected]> <[email protected]>
endef
export MAILMAP
# Not a phony target, but needs to run *every* time.
.PHONY: .mailmap
.mailmap:
@printf "Generating .mailmap..."
@printf "$$MAILMAP\n" > $@
@printf "done\n"
CONTRIBUTORS_URL = https://github.com/magit/magit/graphs/contributors
define AUTHORS_HEADER
Authors
=======
Also see $(CONTRIBUTORS_URL).
Names below are sorted alphabetically.
Author
------
- Marius Vollmer <[email protected]>
Maintainers
-----------
- Jonas Bernoulli <[email protected]>
- Nicolas Dudebout <[email protected]>
- Rémi Vanicat <[email protected]>
- Yann Hodique <[email protected]>
Retired Maintainers
-------------------
- Peter J. Weisberg <[email protected]>
- Phil Jackson <[email protected]>
Contributors
------------
endef
export AUTHORS_HEADER
# Not a phony target, but needs to run *every* time.
.PHONY: AUTHORS.md
AUTHORS.md: .mailmap
@printf "Generating AUTHORS.md..."
@test -d .git \
&& (printf "$$AUTHORS_HEADER\n" > $@ \
&& git log --pretty=format:'- %aN <%aE>' | sort -u >> $@ \
&& printf "done\n" ; ) \
|| printf "FAILED (non-fatal)\n"
.PHONY: authors
authors: AUTHORS.md
.PHONY: install
install: install-lisp install-docs
.PHONY: install-all
install-all: install-lisp install-docs install-script
.PHONY: install-lisp
install-lisp: lisp
$(MKDIR) $(DESTDIR)$(lispdir)
$(CP) $(ELS) $(ELCS) magit-version.el $(DESTDIR)$(lispdir)
$(MKDIR) $(DESTDIR)$(LOADDEFS_DIR)
$(CP) $(LOADDEFS_FILE) $(DESTDIR)$(LOADDEFS_DIR)/$(LOADDEFS_FILE)
.PHONY: install-docs
install-docs: docs
$(MKDIR) $(DESTDIR)$(infodir)
$(CP) magit.info $(DESTDIR)$(infodir)
$(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/magit.info
$(MKDIR) $(DESTDIR)$(docdir)
$(CP) AUTHORS.md $(DESTDIR)$(docdir)
.PHONY: install-script
install-script: bin/magit
$(MKDIR) $(DESTDIR)$(execdir)
$(CPBIN) bin/magit $(DESTDIR)$(execdir)
.PHONY: test
test: $(ELCS)
@$(BATCHE) "(progn\
(require 'cl) \
(put 'flet 'byte-obsolete-info nil))" \
-l tests/magit-tests.el -f ert-run-tests-batch-and-exit
.PHONY: test-interactive
test-interactive: $(ELCS)
@$(EMACS) $(EFLAGS) -Q -L "." --eval "(progn\
(require 'cl)\
(put 'flet 'byte-obsolete-info nil)\
(load-file \"tests/magit-tests.el\")\
(ert t))"
.PHONY: clean
clean:
@echo "Cleaning..."
@$(RM) $(ELCS) $(LOADDEFS_FILE) magit-version.el *.tar.gz *.tar .mailmap
@$(RMDIR) magit-$(VERSION)
@test ! -e .git || $(RM) magit.info
DIST_FILES = $(ELS) magit-version.el Makefile AUTHORS.md
DIST_FILES += README.md magit.texi magit.info dir
DIST_FILES_BIN = bin/magit
ELPA_FILES = $(ELS) magit.info dir AUTHORS.md
.PHONY: dist
dist: magit-$(VERSION).tar.gz
magit-$(VERSION).tar.gz: $(DIST_FILES)
$(MKDIR) magit-$(VERSION)/bin
$(CP) $(DIST_FILES) magit-$(VERSION)
$(CPBIN) $(DIST_FILES_BIN) magit-$(VERSION)/bin
tar -cvz --mtime=./magit-$(VERSION) -f magit-$(VERSION).tar.gz magit-$(VERSION)
$(RMDIR) magit-$(VERSION)
.PHONY: marmalade
marmalade: magit-$(VERSION).tar
magit-$(VERSION).tar: $(ELPA_FILES) magit-pkg.el
$(MKDIR) magit-$(VERSION)
$(CP) $(ELPA_FILES) magit-$(VERSION)
$(CP) magit-pkg.el magit-$(VERSION)
tar -cv --mtime=./magit-$(VERSION) -f magit-$(VERSION).tar magit-$(VERSION)
$(RMDIR) magit-$(VERSION)