Commit | Line | Data |
---|---|---|
427c285b PE |
1 | # Build Emacs from a fresh tarball or version-control checkout. |
2 | ||
ab422c4d | 3 | # Copyright (C) 2011-2013 Free Software Foundation, Inc. |
427c285b PE |
4 | # |
5 | # This file is part of GNU Emacs. | |
6 | # | |
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. | |
11 | # | |
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. | |
16 | # | |
17 | # You should have received a copy of the GNU General Public License | |
18 | # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
19 | # | |
20 | # written by Paul Eggert | |
21 | ||
22 | ||
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. | |
29 | ||
30 | # If you are using a non-GNU 'make', or if you want non-default build | |
31 | # options, or if you want to build in an out-of-source tree, please | |
32 | # run "configure" by hand. But run autogen.sh first, if the source | |
33 | # was checked out directly from the repository. | |
34 | ||
224e1caa EZ |
35 | ifneq ($(MSYSTEM),) |
36 | CFG = CONFIG_SITE=$(CURDIR)/nt/mingw-cfg.site | |
37 | else | |
38 | CFG = | |
39 | endif | |
427c285b PE |
40 | |
41 | # If a Makefile already exists, just use it. | |
42 | ||
43 | ifeq ($(wildcard Makefile),Makefile) | |
44 | include Makefile | |
45 | else | |
46 | ||
47 | # If cleaning and Makefile does not exist, don't bother creating it. | |
48 | # The source tree is already clean, or is in a weird state that | |
49 | # requires expert attention. | |
50 | ||
51 | ifeq ($(filter-out %clean,$(or $(MAKECMDGOALS),default)),) | |
52 | ||
53 | $(MAKECMDGOALS): | |
54 | @echo >&2 'No Makefile; skipping $@.' | |
55 | ||
56 | else | |
57 | ||
58 | # No Makefile, and not cleaning. | |
59 | # If 'configure' does not exist, Emacs must have been checked | |
60 | # out directly from the repository; run ./autogen.sh. | |
61 | # Once 'configure' exists, run it. | |
62 | # Finally, run the actual 'make'. | |
63 | ||
64 | default $(filter-out configure Makefile,$(MAKECMDGOALS)): Makefile | |
65 | $(MAKE) -f Makefile $(MAKECMDGOALS) | |
66 | # Execute in sequence, so that multiple user goals don't conflict. | |
67 | .NOTPARALLEL: | |
68 | ||
69 | configure: | |
70 | @echo >&2 'There seems to be no "configure" file in this directory.' | |
71 | @echo >&2 'Running ./autogen.sh || autogen/copy_autogen ...' | |
72 | ./autogen.sh || autogen/copy_autogen | |
73 | @echo >&2 '"configure" file built.' | |
74 | ||
75 | Makefile: configure | |
76 | @echo >&2 'There seems to be no Makefile in this directory.' | |
77 | @echo >&2 'Running ./configure ...' | |
224e1caa | 78 | $(CFG) ./configure |
427c285b PE |
79 | @echo >&2 'Makefile built.' |
80 | ||
81 | endif | |
82 | endif |