Makefile.in 21.1 KB
Newer Older
1 2
### @configure_input@

Paul Eggert's avatar
Paul Eggert committed
3
# Copyright (C) 2000-2019 Free Software Foundation, Inc.
Gerd Moellmann's avatar
Gerd Moellmann committed
4 5 6

# This file is part of GNU Emacs.

7
# GNU Emacs is free software: you can redistribute it and/or modify
Gerd Moellmann's avatar
Gerd Moellmann committed
8
# it under the terms of the GNU General Public License as published by
9 10
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
Gerd Moellmann's avatar
Gerd Moellmann committed
11 12 13 14 15 16 17

# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
18
# along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
19

20
SHELL = @SHELL@
21

22 23 24 25
srcdir = @srcdir@
top_srcdir = @top_srcdir@
lisp = $(srcdir)
VPATH = $(srcdir)
26
EXEEXT = @EXEEXT@
Gerd Moellmann's avatar
Gerd Moellmann committed
27

28 29 30 31
# Empty for all systems except MinGW, where xargs needs an explicit
# limitation.
XARGS_LIMIT = @XARGS_LIMIT@

32 33 34
# 'make' verbosity.
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@

35 36 37 38 39
AM_V_ELC = $(am__v_ELC_@AM_V@)
am__v_ELC_ = $(am__v_ELC_@AM_DEFAULT_V@)
am__v_ELC_0 = @echo "  ELC     " $@;
am__v_ELC_1 =

40 41 42 43 44
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo "  GEN     " $@;
am__v_GEN_1 =

45 46 47 48 49
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =

Paul Eggert's avatar
Paul Eggert committed
50 51 52

FIND_DELETE = @FIND_DELETE@

53 54 55
# You can specify a different executable on the make command line,
# e.g. "make EMACS=../src/emacs ...".

56 57 58
# We never change directory before running Emacs, so a relative file
# name is fine, and makes life easier.  If we need to change
# directory, we can use emacs --chdir.
59
EMACS = ../src/emacs${EXEEXT}
60

61
# Command line flags for Emacs.
62

63
EMACSOPT = -batch --no-site-file --no-site-lisp
64

65
# Extra flags to pass to the byte compiler
66
BYTE_COMPILE_EXTRA_FLAGS =
67 68 69 70
# For example to not display the undefined function warnings you can use this:
# BYTE_COMPILE_EXTRA_FLAGS = --eval '(setq byte-compile-warnings (quote (not unresolved)))'
# The example above is just for developers, it should not be used by default.

71 72 73
# Those automatically generated autoload files that need special rules
# to build; ie not including things created via generated-autoload-file
# (eg calc/calc-loaddefs.el).
Glenn Morris's avatar
Glenn Morris committed
74
LOADDEFS = $(lisp)/calendar/cal-loaddefs.el \
75 76
	$(lisp)/calendar/diary-loaddefs.el \
	$(lisp)/calendar/hol-loaddefs.el \
77 78
	$(lisp)/mh-e/mh-loaddefs.el \
	$(lisp)/net/tramp-loaddefs.el
Glenn Morris's avatar
Glenn Morris committed
79

80
# All generated autoload files.
81
loaddefs = $(shell find ${srcdir} -name '*loaddefs.el' ! -name '.*')
Kenichi Handa's avatar
Kenichi Handa committed
82
# Elisp files auto-generated.
83 84
AUTOGENEL = ${loaddefs} ${srcdir}/cus-load.el ${srcdir}/finder-inf.el \
  ${srcdir}/subdirs.el ${srcdir}/eshell/esh-groups.el
Kenichi Handa's avatar
Kenichi Handa committed
85

86
# Set load-prefer-newer for the benefit of the non-bootstrappers.
87
BYTE_COMPILE_FLAGS = \
88
  --eval '(setq load-prefer-newer t)' $(BYTE_COMPILE_EXTRA_FLAGS)
89

90
# Files to compile before others during a bootstrap.  This is done to
Stefan Monnier's avatar
Stefan Monnier committed
91 92
# speed up the bootstrap process.  They're ordered by size, so we use
# the slowest-compiler on the smallest file and move to larger files as the
93
# compiler gets faster.  'autoload.elc' comes last because it is not used by
Stefan Monnier's avatar
Stefan Monnier committed
94 95
# the compiler (so its compilation does not speed up subsequent compilations),
# it's only placed here so as to speed up generation of the loaddefs.el file.
Gerd Moellmann's avatar
Gerd Moellmann committed
96

Gerd Moellmann's avatar
Gerd Moellmann committed
97
COMPILE_FIRST = \
Stefan Monnier's avatar
Stefan Monnier committed
98
	$(lisp)/emacs-lisp/macroexp.elc \
Stefan Monnier's avatar
Stefan Monnier committed
99 100 101
	$(lisp)/emacs-lisp/cconv.elc    \
	$(lisp)/emacs-lisp/byte-opt.elc \
	$(lisp)/emacs-lisp/bytecomp.elc \
102
	$(lisp)/emacs-lisp/autoload.elc
Gerd Moellmann's avatar
Gerd Moellmann committed
103

104 105 106 107
# Files to compile early in compile-main.  Works around bug#25556.
MAIN_FIRST = ./emacs-lisp/eieio.el ./emacs-lisp/eieio-base.el \
  ./cedet/semantic/db.el

108 109 110
# Prevent any settings in the user environment causing problems.
unexport EMACSDATA EMACSDOC EMACSPATH

111
# The actual Emacs command run in the targets below.
112 113
# Prevent any setting of EMACSLOADPATH in user environment causing problems.
emacs = EMACSLOADPATH= '$(EMACS)' $(EMACSOPT)
114

115 116 117 118
## Subdirectories, relative to builddir.
SUBDIRS = $(sort $(shell find ${srcdir} -type d -print))
## Subdirectories, relative to srcdir.
SUBDIRS_REL = $(patsubst ${srcdir}%,.%,${SUBDIRS})
119
## All subdirectories except 'obsolete' and 'term'.
120
SUBDIRS_ALMOST = $(filter-out ${srcdir}/obsolete ${srcdir}/term,${SUBDIRS})
121 122 123 124 125
## All subdirectories except 'obsolete', 'term', and 'leim' (and subdirs).
## We don't want the leim files listed as packages, especially
## since many share basenames with files in language/.
SUBDIRS_FINDER = $(filter-out ${srcdir}/leim%,${SUBDIRS_ALMOST})
## All subdirectories in which we might want to create subdirs.el.
126
SUBDIRS_SUBDIRS = $(filter-out ${srcdir}/cedet% ${srcdir}/leim%,${SUBDIRS})
127

Glenn Morris's avatar
Glenn Morris committed
128
# cus-load and finder-inf are not explicitly requested by anything, so
129
# we add them here to make sure they get built.
130
all: compile-main $(lisp)/cus-load.el $(lisp)/finder-inf.el
131

132 133
PHONY_EXTRAS =
.PHONY: all custom-deps finder-data autoloads update-subdirs $(PHONY_EXTRAS)
134

135
# custom-deps and finder-data both used to scan _all_ the *.el files.
Glenn Morris's avatar
Glenn Morris committed
136 137
# This could lead to problems in parallel builds if automatically
# generated *.el files (eg loaddefs etc) were being changed at the same time.
138
# One solution was to add autoloads as a prerequisite:
139 140
# https://lists.gnu.org/r/emacs-pretest-bug/2007-01/msg00469.html
# https://lists.gnu.org/r/bug-gnu-emacs/2007-12/msg00171.html
Glenn Morris's avatar
Glenn Morris committed
141
# However, this meant that running these targets modified loaddefs.el,
142 143 144
# every time (due to time-stamping).  Calling these rules from
# bootstrap-after would modify loaddefs after src/emacs, resulting
# in make install remaking src/emacs for no real reason:
145
# https://lists.gnu.org/r/emacs-devel/2008-02/msg00311.html
Glenn Morris's avatar
Glenn Morris committed
146 147 148
# Nowadays these commands don't scan automatically generated files,
# since they will never contain any useful information
# (see finder-no-scan-regexp and custom-dependencies-no-scan-regexp).
149
custom-deps:
150 151
	$(AM_V_at)$(MAKE) PHONY_EXTRAS=$(lisp)/cus-load.el $(lisp)/cus-load.el
$(lisp)/cus-load.el:
152
	$(AM_V_GEN)$(emacs) -l cus-dep \
Eli Zaretskii's avatar
Eli Zaretskii committed
153
	  --eval '(setq generated-custom-dependencies-file (unmsys--file-name "$(srcdir)/cus-load.el"))' \
154
	  -f custom-make-dependencies ${SUBDIRS_ALMOST}
155

156
finder-data:
157 158 159
	$(AM_V_at)$(MAKE) PHONY_EXTRAS=$(lisp)/finder-inf.el \
	  $(lisp)/finder-inf.el
$(lisp)/finder-inf.el:
160
	$(AM_V_GEN)$(emacs) -l finder \
Eli Zaretskii's avatar
Eli Zaretskii committed
161
	  --eval '(setq generated-finder-keywords-file (unmsys--file-name "$(srcdir)/finder-inf.el"))' \
162
	  -f finder-compile-keywords-make-dist ${SUBDIRS_FINDER}
163

164 165 166 167 168 169 170
## Comments on loaddefs generation:

# loaddefs depends on gen-lisp for two reasons:
# 1) In ../src, the emacs target depends on loaddefs but not on eg leim-list.
# So having leim as a dependency of loaddefs (via gen-lisp) ensures leim-list
# gets created before the final emacs is dumped.  Having leim
# dependencies in ../src as well would create a parallel race condition.
171
#
172 173 174 175 176 177 178 179
# 2) Files that are marked no-update-autoloads still get recorded in loaddefs.
# So those files should be generated before we make autoloads, if we
# don't want a successive make autoloads to change the output file.
# Said changes are trivial (only comments in the "files without autoloads"
# section), but still can be annoying.  Of course, if generated lisp files
# do contain autoloads, it is essential they be built before make autoloads.
# (Also, if a generated file is not written atomically, it is possible that
# in a parallel build, make autoloads could read a partial version of it.)
180
#
181 182 183 184 185 186 187
# We'd really like to add "make -C ../admin/unidata all" to gen-lisp
# because of 2) above, but it causes a race condition in parallel
# builds because ../src also runs that rule.  Given the limitations of
# recursive make, the only way to fix that would be to remove unidata
# from ../src rules, but that doesn't seem possible due to the various
# non-trivial dependencies.

188 189 190 191
# We make $(lisp)/loaddefs.el a dependency of .PHONY to cause Make to
# ignore its time stamp.  That's because the real dependencies of
# loaddefs.el aren't known to Make, they are implemented in
# batch-update-autoloads, which only updates the autoloads whose
192 193 194 195 196
# sources have changed.

# Use expand-file-name rather than $abs_scrdir so that Emacs does not
# get confused when it compares file-names for equality.

197
autoloads .PHONY: $(lisp)/loaddefs.el
198
$(lisp)/loaddefs.el: gen-lisp $(LOADDEFS)
Glenn Morris's avatar
Glenn Morris committed
199
	@echo Directories for loaddefs: ${SUBDIRS_ALMOST}
200
	$(AM_V_GEN)$(emacs) -l autoload \
201
	    --eval '(setq autoload-ensure-writable t)' \
202
	    --eval '(setq autoload-builtin-package-versions t)' \
203
	    --eval '(setq generated-autoload-file (expand-file-name (unmsys--file-name "$@")))' \
204
	    -f batch-update-autoloads ${SUBDIRS_ALMOST}
205

Paul Eggert's avatar
Paul Eggert committed
206
# autoloads only runs when loaddefs.el is nonexistent, although it
Phillip Lord's avatar
Phillip Lord committed
207 208
# generates a number of different files. Provide a force option to enable
# regeneration of all these files.
209 210
.PHONY: autoloads-force
autoloads-force:
Phillip Lord's avatar
Phillip Lord committed
211 212 213
	rm loaddefs.el
	$(MAKE) autoloads

214
# This is required by the bootstrap-emacs target in ../src/Makefile, so
215
# we know that if we have an emacs executable, we also have a subdirs.el.
216
$(lisp)/subdirs.el:
217
	$(AM_V_GEN)$(MAKE) update-subdirs
218
update-subdirs:
219
	$(AM_V_at)for file in ${SUBDIRS_SUBDIRS}; do \
220
	   $(srcdir)/../build-aux/update-subdirs $$file; \
221 222
	done;

223
.PHONY: updates repo-update update-authors
224

225
# Some modes of make-dist use this.
226
updates: update-subdirs autoloads finder-data custom-deps
Per Abrahamsen's avatar
Per Abrahamsen committed
227

228 229 230 231 232 233
# This is useful after updating from the repository; but it doesn't do
# anything that a plain "make" at top-level doesn't.  The only
# difference between this and this directory's "all" rule is that this
# runs "autoloads" as well (because it uses "compile" rather than
# "compile-main").  In a bootstrap, $(lisp) in src/Makefile triggers
# this directory's autoloads rule.
234
repo-update: compile finder-data custom-deps
235

236
# Update etc/AUTHORS
237 238

update-authors:
239 240
	$(emacs) -L "$(top_srcdir)/admin" -l authors \
	  -f batch-update-authors "$(top_srcdir)/etc/AUTHORS" "$(top_srcdir)"
241

242 243
FORCE:
.PHONY: FORCE
244

245 246
tagsfiles = $(shell find ${srcdir} -name '*.el' \
	        ! -name '.*' ! -name '*loaddefs.el')
247
tagsfiles := $(filter-out ${srcdir}/ldefs-boot.el,${tagsfiles})
248
tagsfiles := $(filter-out ${srcdir}/eshell/esh-groups.el,${tagsfiles})
249

250 251 252 253
ETAGS = ../lib-src/etags${EXEEXT}

${ETAGS}: FORCE
	${MAKE} -C ../lib-src $(notdir $@)
254

255
## The use of xargs is to stop the command line getting too long
256 257 258 259
## on MS Windows, when the MSYS Bash passes it to a MinGW compiled
## etags.  It might be better to use find in a similar way to
## compile-main.  But maybe this is not even necessary any more now
## that this uses relative filenames.
260
TAGS: ${ETAGS} ${tagsfiles}
261 262 263
	$(AM_V_at)rm -f $@
	$(AM_V_at)touch $@
	$(AM_V_GEN)ls ${tagsfiles} | xargs $(XARGS_LIMIT) "${ETAGS}" -a -o $@
264

265

266 267 268 269 270 271 272 273 274
# The src/Makefile.in has its own set of dependencies and when they decide
# that one Lisp file needs to be re-compiled, we had better recompile it as
# well, otherwise every subsequent make will again call us, until we finally
# end up deciding that yes, the file deserves recompilation.
# One option is to try and reproduce exactly the same dependencies here as
# we have in src/Makefile.in, but it turns out to be painful
# (e.g. src/Makefile.in may have a dependency for ../lisp/foo.elc where we
# only know of $(lisp)/foo.elc).  So instead we provide a direct way for
# src/Makefile.in to rebuild a particular Lisp file, no questions asked.
275 276
# Use byte-compile-refresh-preloaded to try and work around some of
# the most common problems of not bootstrapping from a clean state.
277 278 279
THEFILE = no-such-file
.PHONY: $(THEFILE)c
$(THEFILE)c:
280
	$(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) \
281
		-l bytecomp -f byte-compile-refresh-preloaded \
282
		-f batch-byte-compile $(THEFILE)
283

284 285
# Files MUST be compiled one by one. If we compile several files in a
# row (i.e., in the same instance of Emacs) we can't make sure that
Lute Kamstra's avatar
Lute Kamstra committed
286 287 288 289
# the compilation environment is clean.  We also set the load-path of
# the Emacs used for compilation to the current directory and its
# subdirectories, to make sure require's and load's in the files being
# compiled find the right files.
Stefan Monnier's avatar
Stefan Monnier committed
290

291 292 293 294 295
.SUFFIXES: .elc .el

# An old-fashioned suffix rule, which, according to the GNU Make manual,
# cannot have prerequisites.
.el.elc:
296
	$(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) -f batch-byte-compile $<
297

298
.PHONY: compile-first compile-main compile compile-always
299

300
compile-first: $(COMPILE_FIRST)
Richard M. Stallman's avatar
Richard M. Stallman committed
301

302
# In 'compile-main' we could directly do
303
#    ... | xargs $(MAKE)
304
# and it works, but it generates a lot of messages like
305
#    make[2]: gnus/gnus-mlspl.elc is up to date.
306
# so instead, we use "xargs echo" to split the list of file into manageable
307
# chunks and then use an intermediate 'compile-targets' target so the
308 309 310 311 312
# actual targets (the .elc files) are not mentioned as targets on the
# make command line.


.PHONY: compile-targets
313
# TARGETS is set dynamically in the recursive call from 'compile-main'.
314 315 316
compile-targets: $(TARGETS)

# Compile all the Elisp files that need it.  Beware: it approximates
317
# 'no-byte-compile', so watch out for false-positives!
318
compile-main: gen-lisp compile-clean
319
	@(cd $(lisp) && 			     \
320
	els=`echo "${SUBDIRS_REL} " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
321 322 323 324 325 326 327 328
	for el in ${MAIN_FIRST} $$els; do            \
	  test -f $$el || continue; 		     \
	  test ! -f $${el}c && 			     \
	      GREP_OPTIONS= grep '^;.*[^a-zA-Z]no-byte-compile: *t' $$el > /dev/null && \
	      continue; 			     \
	  echo "$${el}c";                            \
	done | xargs $(XARGS_LIMIT) echo) | 	     \
	while read chunk; do 			     \
329
	  $(MAKE) compile-targets TARGETS="$$chunk"; \
330
	done
331

332 333 334
.PHONY: compile-clean
# Erase left-over .elc files that do not have a corresponding .el file.
compile-clean:
335 336
	@cd $(lisp) && \
	elcs=`echo "${SUBDIRS_REL} " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.elc |g'`; \
337
	for el in `echo $$elcs | sed -e 's/\.elc/\.el/g'`; do \
338
	  if test -f "$$el" || test ! -f "$${el}c"; then :; else \
339 340
	    echo rm "$${el}c"; \
	    rm "$${el}c"; \
Paul Eggert's avatar
Paul Eggert committed
341
	  fi; \
342 343
	done

344 345
.PHONY: gen-lisp leim semantic

346 347
## make -C ../admin/unidata all should be here, but that would race
## with ../src.  See comments above for loaddefs.
348 349
gen-lisp: leim semantic

350 351 352
# (re)compile titdic-cnv before recursing into `leim` since its used to
# generate some of the Quail source files from tables.
leim: $(lisp)/international/titdic-cnv.elc
353
	$(MAKE) -C ../leim all EMACS="$(EMACS)"
354

355
semantic:
356
	$(MAKE) -C ../admin/grammars all EMACS="$(EMACS:.%=../.%)"
357

358 359 360 361
# Compile all Lisp files, but don't recompile those that are up to
# date.  Some .el files don't get compiled because they set the
# local variable no-byte-compile.
# Calling make recursively because suffix rule cannot have prerequisites.
362
compile: $(LOADDEFS) autoloads compile-first
363
	$(MAKE) compile-main
364

365
# Compile all Lisp files.  This is like 'compile' but compiles files
Lute Kamstra's avatar
Lute Kamstra committed
366 367
# unconditionally.  Some files don't actually get compiled because they
# set the local variable no-byte-compile.
368
compile-always:
Paul Eggert's avatar
Paul Eggert committed
369
	find $(lisp) -name '*.elc' $(FIND_DELETE)
370
	$(MAKE) compile
Lute Kamstra's avatar
Lute Kamstra committed
371

Glenn Morris's avatar
Glenn Morris committed
372
.PHONY: backup-compiled-files compile-after-backup
373

374 375 376 377
# Backup compiled Lisp files in elc.tar.gz.  If that file already
# exists, make a backup of it.

backup-compiled-files:
Gerd Moellmann's avatar
Gerd Moellmann committed
378
	-mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
Glenn Morris's avatar
Glenn Morris committed
379
	-tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc $(lisp)/*/*/*.elc $(lisp)/*/*/*/*.elc
380 381 382

# Compile Lisp files, but save old compiled files first.

Richard M. Stallman's avatar
Richard M. Stallman committed
383
compile-after-backup: backup-compiled-files compile-always
384

385 386 387 388 389 390 391
# This does the same job as the "compile" rule, but in a different way.
# Rather than spawning a separate Emacs instance to compile each file,
# it uses the same Emacs instance to compile everything.
# This is faster on a single core, since it avoids the overhead of
# starting Emacs many times (it was 33% faster on a test with a
# random 10% of the .el files needing recompilation).
# Unlike compile, this is not parallelizable; so if you have more than
Glenn Morris's avatar
Glenn Morris committed
392
# one core and use make -j#, compile will be (much) faster.
393 394 395 396 397 398 399
# This rule also produces less accurate compilation warnings.
# The environment of later files is affected by definitions in
# earlier ones, so it does not produce some warnings that it should.
# It can also produces spurious warnings about "invalid byte code" if
# files that use byte-compile-dynamic are updated.
# There is no reason to use this rule unless you only have a single
# core and CPU time is an issue.
400
.PHONY: compile-one-process
401
compile-one-process: $(LOADDEFS) compile-first
402 403
	$(emacs) $(BYTE_COMPILE_FLAGS) \
	    --eval "(batch-byte-recompile-directory 0)" $(lisp)
404

405
# Update MH-E internal autoloads. These are not to be confused with
Glenn Morris's avatar
Glenn Morris committed
406
# the autoloads for the MH-E entry points, which are already in loaddefs.el.
Glenn Morris's avatar
Glenn Morris committed
407
MH_E_DIR = $(lisp)/mh-e
408 409
MH_E_SRC = $(sort $(wildcard ${MH_E_DIR}/mh*.el))
MH_E_SRC := $(filter-out ${MH_E_DIR}/mh-loaddefs.el,${MH_E_SRC})
Glenn Morris's avatar
Glenn Morris committed
410

411
.PHONY: mh-autoloads
Glenn Morris's avatar
Glenn Morris committed
412
mh-autoloads: $(MH_E_DIR)/mh-loaddefs.el
413
$(MH_E_DIR)/mh-loaddefs.el: $(MH_E_SRC)
414
	$(AM_V_GEN)$(emacs) -l autoload \
415
	   --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
416
	   --eval "(setq generated-autoload-file (expand-file-name (unmsys--file-name \"$@\")))" \
Glenn Morris's avatar
Glenn Morris committed
417 418
	   -f batch-update-autoloads $(MH_E_DIR)

419
# Update TRAMP internal autoloads. Maybe we could move tramp*.el into
420 421 422
# an own subdirectory. OTOH, it does not hurt to keep them in
# lisp/net.
TRAMP_DIR = $(lisp)/net
423 424
TRAMP_SRC = $(sort $(wildcard ${TRAMP_DIR}/tramp*.el))
TRAMP_SRC := $(filter-out ${TRAMP_DIR}/tramp-loaddefs.el,${TRAMP_SRC})
425 426

$(TRAMP_DIR)/tramp-loaddefs.el: $(TRAMP_SRC)
427
	$(AM_V_GEN)$(emacs) -l autoload \
428
	   --eval "(setq generate-autoload-cookie \";;;###tramp-autoload\")" \
429
	   --eval "(setq generated-autoload-file (expand-file-name (unmsys--file-name \"$@\")))" \
430 431
	   -f batch-update-autoloads $(TRAMP_DIR)

Glenn Morris's avatar
Glenn Morris committed
432 433
CAL_DIR = $(lisp)/calendar
## Those files that may contain internal calendar autoload cookies.
434
CAL_SRC = $(addprefix ${CAL_DIR}/,diary-lib.el holidays.el lunar.el solar.el)
435
CAL_SRC := $(sort ${CAL_SRC} $(wildcard ${CAL_DIR}/cal-*.el))
436
CAL_SRC := $(filter-out ${CAL_DIR}/cal-loaddefs.el,${CAL_SRC})
Glenn Morris's avatar
Glenn Morris committed
437

438
$(CAL_DIR)/cal-loaddefs.el: $(CAL_SRC)
439
	$(AM_V_GEN)$(emacs) -l autoload \
Glenn Morris's avatar
Glenn Morris committed
440
	   --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \
441
	   --eval "(setq generated-autoload-file (expand-file-name (unmsys--file-name \"$@\")))" \
Glenn Morris's avatar
Glenn Morris committed
442
	   -f batch-update-autoloads $(CAL_DIR)
Glenn Morris's avatar
Glenn Morris committed
443

444
$(CAL_DIR)/diary-loaddefs.el: $(CAL_SRC) $(CAL_DIR)/cal-loaddefs.el
445
	$(AM_V_GEN)$(emacs) -l autoload \
Glenn Morris's avatar
Glenn Morris committed
446
	   --eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \
447
	   --eval "(setq generated-autoload-file (expand-file-name (unmsys--file-name \"$@\")))" \
Glenn Morris's avatar
Glenn Morris committed
448
	   -f batch-update-autoloads $(CAL_DIR)
Glenn Morris's avatar
Glenn Morris committed
449

450
$(CAL_DIR)/hol-loaddefs.el: $(CAL_SRC) $(CAL_DIR)/diary-loaddefs.el
451
	$(AM_V_GEN)$(emacs) -l autoload \
Glenn Morris's avatar
Glenn Morris committed
452
	   --eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \
453
	   --eval "(setq generated-autoload-file (expand-file-name (unmsys--file-name \"$@\")))" \
Glenn Morris's avatar
Glenn Morris committed
454
	   -f batch-update-autoloads $(CAL_DIR)
Glenn Morris's avatar
Glenn Morris committed
455

456
.PHONY: bootstrap-clean distclean maintainer-clean extraclean
457

458
bootstrap-clean:
Paul Eggert's avatar
Paul Eggert committed
459
	find $(lisp) -name '*.elc' $(FIND_DELETE)
460
	rm -f $(AUTOGENEL)
461

462
distclean:
463
	-rm -f ./Makefile $(lisp)/loaddefs.el
464 465

maintainer-clean: distclean bootstrap-clean
466
	rm -f TAGS
Gerd Moellmann's avatar
Gerd Moellmann committed
467

468 469 470 471
extraclean: bootstrap-clean distclean
	-for file in $(LOADDEFS); do rm -f $${file}~; done
	-rm -f $(lisp)/loaddefs.el~

Glenn Morris's avatar
Glenn Morris committed
472 473 474
.PHONY: check-declare

check-declare:
475
	$(emacs) -l check-declare --eval '(check-declare-directory "$(lisp)")'
Glenn Morris's avatar
Glenn Morris committed
476

477
## This finds a lot of duplicates between foo.el and obsolete/foo.el.
478 479
check-defun-dups:
	sed -n -e '/^(defun /s/\(.\)(.*/\1/p' \
480
	  $$(find . -name '*.el' ! -name '.*' -print | \
481
	  grep -Ev '(loaddefs|ldefs-boot)\.el|obsolete') | sort | uniq -d
482

483 484
# Dependencies

485 486 487 488 489 490
## None of the following matters for bootstrap, which is the only way
## to ensure a correct compilation of all lisp files.
## Manually specifying dependencies of a handful of lisp files, (and
## ones that don't change very often at that) seems pretty pointless
## to me.

491
# https://debbugs.gnu.org/1004
492 493 494
# CC Mode uses a compile time macro system which causes a compile time
# dependency in cc-*.elc files on the macros in other cc-*.el and the
# version string in cc-defs.el.
495
$(lisp)/progmodes/cc-align.elc\
496 497 498 499
 $(lisp)/progmodes/cc-cmds.elc $(lisp)/progmodes/cc-compat.elc\
 $(lisp)/progmodes/cc-engine.elc $(lisp)/progmodes/cc-fonts.elc\
 $(lisp)/progmodes/cc-langs.elc $(lisp)/progmodes/cc-menus.elc\
 $(lisp)/progmodes/cc-mode.elc $(lisp)/progmodes/cc-styles.elc\
500
 $(lisp)/progmodes/cc-vars.elc: \
501 502
   $(lisp)/progmodes/cc-bytecomp.elc $(lisp)/progmodes/cc-defs.elc

503
$(lisp)/progmodes/cc-align.elc $(lisp)/progmodes/cc-cmds.elc: \
504 505 506 507 508 509
   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc

$(lisp)/progmodes/cc-compat.elc: \
   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-styles.elc \
   $(lisp)/progmodes/cc-engine.elc

510
$(lisp)/progmodes/cc-defs.elc: $(lisp)/progmodes/cc-bytecomp.elc
511 512 513 514 515

$(lisp)/progmodes/cc-engine.elc: $(lisp)/progmodes/cc-langs.elc \
   $(lisp)/progmodes/cc-vars.elc

$(lisp)/progmodes/cc-fonts.elc: $(lisp)/progmodes/cc-langs.elc \
516
   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc
517

518
$(lisp)/progmodes/cc-langs.elc: $(lisp)/progmodes/cc-vars.elc
519 520 521 522 523 524 525 526 527

$(lisp)/progmodes/cc-mode.elc: $(lisp)/progmodes/cc-langs.elc \
   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc \
   $(lisp)/progmodes/cc-styles.elc $(lisp)/progmodes/cc-cmds.elc \
   $(lisp)/progmodes/cc-align.elc $(lisp)/progmodes/cc-menus.elc

$(lisp)/progmodes/cc-styles.elc: $(lisp)/progmodes/cc-vars.elc \
   $(lisp)/progmodes/cc-align.elc

528
# Makefile ends here.