1 # Build Emacs from a fresh tarball or version-control checkout.
3 # Copyright (C) 2011-2024 Free Software Foundation, Inc.
5 # This file is part of GNU Emacs.
7 # GNU Emacs is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # GNU Emacs is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # 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/>.
20 # written by Paul Eggert
23 # This GNUmakefile is for GNU Make. It is for convenience, so that
24 # one can run 'make' in an unconfigured source tree. In such a tree,
25 # this file causes GNU Make to first create a standard configuration
26 # with the default options, and then reinvokes itself on the
27 # newly-built Makefile. If the source tree is already configured,
28 # this file defers to the existing Makefile.
32 # If you want non-default build options, or if you want to build in an
33 # out-of-source tree, you should run 'configure' before running 'make'.
34 # But run 'autogen.sh' first, if the source was checked out directly
35 # from the repository.
39 ifeq (help
,$(filter help
,$(MAKECMDGOALS
)))
41 $(info $.NOTE
: This is a brief summary of some common make targets.
)
42 $(info $.For more detailed information
, please read the files INSTALL
,)
43 $(info $.INSTALL.REPO
, Makefile or visit this URL
:)
44 $(info $.https
://www.gnu.org
/prep
/standards
/html_node
/Standard-Targets.html
)
46 $(info $.make
all -- compile and build Emacs
)
47 $(info $.make
install -- install Emacs
)
48 $(info $.make TAGS
-- update
tags tables
)
49 $(info $.make
clean -- delete built files but preserve configuration
)
50 $(info $.make
mostlyclean -- like
'make clean', but leave those files that
)
51 $(info $. usually do not need to be recompiled
)
52 $(info $.make
distclean -- delete
all build and configuration files
,)
53 $(info $. leave only files included in source distribution
)
54 $(info $.make maintainer-clean
-- delete almost everything that can be regenerated
)
55 $(info $.make extraclean
-- like maintainer-clean
, and also delete
)
56 $(info $. backup and autosave files
)
57 $(info $.make bootstrap
-- delete
all compiled files to
force a new bootstrap
)
58 $(info $. from a
clean slate
, then build in the normal way
)
59 $(info $.make
uninstall -- remove files installed by
'make install')
60 $(info $.make
check -- run the Emacs
test suite
)
61 $(info $.make docs
-- generate Emacs documentation in
info format
)
62 $(info $.make html
-- generate documentation in html format
)
63 $(info $.make ps
-- generate documentation in ps format
)
64 $(info $.make pdf
-- generate documentation in pdf format
)
71 # If a Makefile already exists, just use it.
73 ifeq ($(wildcard Makefile
),Makefile
)
77 # If cleaning and Makefile does not exist, don't bother creating it.
78 # The source tree is already clean, or is in a weird state that
79 # requires expert attention.
81 ifeq ($(filter-out %clean,$(or
$(MAKECMDGOALS
),default
)),)
84 $(warning No Makefile
; skipping
$@.
)
88 # No Makefile, and not cleaning.
89 # If 'configure' does not exist, Emacs must have been checked
90 # out directly from the repository; run ./autogen.sh.
91 # Once 'configure' exists, run it.
92 # Finally, run the actual 'make'.
94 ORDINARY_GOALS
= $(filter-out configure Makefile bootstrap
,$(MAKECMDGOALS
))
96 default
$(ORDINARY_GOALS
): Makefile
97 $(MAKE
) -f Makefile
$(MAKECMDGOALS
)
98 # Execute in sequence, so that multiple user goals don't conflict.
102 $(warning There seems to be no
"configure" file in this directory.
)
103 $(warning Running .
/autogen.sh ...
)
105 @echo
>&2 '"configure" file built.'
108 $(warning There seems to be no Makefile in this directory.
)
109 ifeq ($(configure
),default
)
110 $(warning Running .
/configure ...
)
113 $(warning Running .
/configure
$(configure
)...
)
114 .
/configure
$(configure
)
116 @echo
>&2 'Makefile built.'
118 # 'make bootstrap' in a fresh checkout needn't run 'configure' twice.
120 $(MAKE
) -f Makefile bootstrap-all
122 .PHONY
: bootstrap default
$(ORDINARY_GOALS
)