Mercurial > emacs
annotate admin/make-emacs @ 40188:cd1cd95ca64e
(File Name Components): Update the description of
file-name-sans-extension and file-name-extension.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Mon, 22 Oct 2001 16:12:55 +0000 |
parents | 6bd2a61edfa8 |
children | 1b65cbdd3bbd |
rev | line source |
---|---|
38850 | 1 #! /usr/bin/perl |
2 | |
3 # Copyright (C) 2001 Free Software Foundation, Inc. | |
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 2, or (at your option) | |
10 # 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; see the file COPYING. If not, write to the | |
19 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 # Boston, MA 02111-1307, USA. | |
21 | |
22 # Build Emacs with various options for profiling, debugging, | |
23 # with and without warnings enabled etc. | |
24 | |
25 require 5; | |
26 use Getopt::Long; | |
27 use File::Basename; | |
28 use Cwd; | |
29 | |
30 # Default CVS sandbox directory. Only used when called from outside | |
31 # of the sandbox. | |
32 | |
33 $root = $ENV{"EMACS_ROOT"}; | |
34 $root = "/gd/gnu/emacs" unless $root; | |
35 | |
36 # Default make command. | |
37 | |
38 $make = $ENV{"EMACS_MAKE"}; | |
39 $make = "gmake" unless $make; | |
40 | |
41 $rc = GetOptions ("help" => \$help, | |
42 "enable-checking" => \$enable_checking, | |
43 "no-warn" => \$no_warn, | |
44 "check-marked" => \$check_marked, | |
45 "all" => \$all, | |
46 "no-optim" => \$no_optim, | |
47 "union-type" => \$union_type, | |
48 "gprof" => \$profile, | |
49 "malloc-check" => \$malloc_check, | |
50 "no-mcheck" => \$no_mcheck, | |
51 "alias" => \$aliasing, | |
39871
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
52 "boot" => \$boot, |
38850 | 53 "wall" => \$wall, |
54 "gcc3" => \$gcc3, | |
55 "trace-selection" => \$trace_selection, | |
56 "stabs" => \$use_stabs, | |
57 "optim" => \$optim); | |
58 | |
59 if ($rc == 0 || $help) | |
60 { | |
61 print <<USAGE; | |
62 make-emacs [options] ... | |
63 | |
64 Build Emacs. | |
65 | |
66 --help show this help | |
67 --all make clean versionclean first | |
39871
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
68 --boot make boostrap, log to boot.log |
38850 | 69 --enable-checking ENABLE_CHECKING=1 (implies Lisp union type) |
70 --no-warn disable warnings | |
71 --check-marked GC_CHECK_MARKED_OBJECTS=1 | |
72 --optim no debug defines | |
73 --gprof make Emacs for profiling | |
74 --union-type define USE_LISP_UNION_TYPE (bad for GDB) | |
75 --malloc-check define GC_MALLOC_CHECK | |
76 --no-mcheck dont define GC_MCHECK | |
77 --wall compile with -Wall | |
78 --gcc3 use GCC 3.0 (30% slower compilation, slower code) | |
79 --trace-selection print traces in xselect.c | |
80 --stabs use -gstabs instead -g | |
81 | |
82 Default is to compile with warnings, with -DGC_MCHECK=1, and | |
83 with -DGLYPH_DEBUG=1. | |
84 | |
85 USAGE | |
86 exit 1; | |
87 } | |
88 | |
89 # Chdir to the top-level directory of the tree. If not in a tree | |
90 # containing Emacs, use the default. | |
91 | |
92 while (! -f "src/emacs.c" && cwd () ne "/") | |
93 { | |
94 chdir ".."; | |
95 } | |
96 | |
97 chdir $root if cwd () eq "/"; | |
98 chdir "./src"; | |
99 print "Build in ", cwd (), "\n"; | |
100 | |
101 # If first arg is `all' or if `--all' specified, ensure a clean | |
102 # build. | |
103 | |
104 if (@ARGV && $ARGV[0] eq "all") | |
105 { | |
106 $all = 1; | |
107 shift @ARGV; | |
108 } | |
109 | |
110 system ("$make clean versionclean") if $all; | |
111 | |
112 if ($wall) | |
113 { | |
114 $warn = "-Wall"; | |
115 } | |
116 elsif (!$no_warn) | |
117 { | |
118 $warn = "-Wpointer-arith -Wchar-subscripts -Wformat -Wimplicit-int"; | |
119 $warn = "$warn -Wreturn-type -Wswitch -Wuninitialized"; | |
120 } | |
121 | |
122 $defs = "-DGLYPH_DEBUG=1" unless $optim; | |
123 $defs = "$defs -DGC_CHECK_MARKED_OBJECTS=1" if $check_marked; | |
124 $defs = "$defs -DENABLE_CHECKING=1" if $enable_checking; | |
125 | |
126 if ($profile) | |
127 { | |
128 $opts = "-pg"; | |
129 $defs = "$defs -DPROFILING=1"; | |
130 } | |
131 else | |
132 { | |
133 if ($use_stabs) | |
134 { | |
135 $opts = "-gstabs"; | |
136 } | |
137 else | |
138 { | |
139 $opts = "-g"; | |
140 } | |
141 } | |
142 | |
143 $defs = "$defs -DUSE_LISP_UNION_TYPE" if $union_type; | |
144 $defs = "$defs -DGC_MALLOC_CHECK=1 -DGC_PROTECT_MALLOC_STATE=1" if $malloc_check; | |
145 $defs = "$defs -DGC_MCHECK=1" unless $no_mcheck; | |
146 | |
147 $defs = "$defs -DTRACE_SELECTION" if $trace_selection; | |
148 | |
149 # arch=pentium leads to slightly faster code than without. | |
150 $opts = "$opts -march=pentiumpro"; | |
151 | |
152 if ($optim) | |
153 { | |
154 $opts = "$opts -pipe -O3"; | |
155 } | |
156 elsif ($no_optim) | |
157 { | |
158 $opts = "$opts -pipe -fno-inline"; | |
159 } | |
160 else | |
161 { | |
162 $opts = "$opts -O -pipe -fno-inline"; | |
163 } | |
164 | |
165 $opts = "$opts -fstrict-aliasing" if $aliasing; | |
166 | |
167 $opts = "$opts $defs" if $defs; | |
168 $opts = "$opts $warn" if $warn; | |
169 | |
170 $cc = "/usr/bin/gcc"; | |
171 $cc = "/gd/local/bin/gcc" if $gcc3; | |
172 | |
39871
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
173 if ($boot) |
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
174 { |
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
175 chdir ".."; |
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
176 system "mv boot.log boot.log.old" if -f "boot.log"; |
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
177 exit system "script boot.log $make CC=\"$cc\" CFLAGS=\"$opts\" bootstrap"; |
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
178 } |
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
179 |
38850 | 180 exit system "$make CC=\"$cc\" CFLAGS=\"$opts\" @ARGV"; |
181 | |
182 # Local Variables: | |
183 # mode: cperl | |
184 # End: |