Mercurial > emacs
annotate admin/make-emacs @ 92662:4b12e6633ee4
*** empty log message ***
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sat, 08 Mar 2008 22:39:09 +0000 |
parents | 107ccd98fa12 |
children | 606f2d163a64 e6db9ee945b8 |
rev | line source |
---|---|
38850 | 1 #! /usr/bin/perl |
2 | |
79744 | 3 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
75348 | 4 # Free Software Foundation, Inc. |
38850 | 5 # |
6 # This file is part of GNU Emacs. | |
7 # | |
8 # GNU Emacs is free software; you can redistribute it and/or modify | |
9 # it under the terms of the GNU General Public License as published by | |
78240
450fa81c5930
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75348
diff
changeset
|
10 # the Free Software Foundation; either version 3, or (at your option) |
38850 | 11 # any later version. |
12 # | |
13 # GNU Emacs is distributed in the hope that it will be useful, | |
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 # GNU General Public License for more details. | |
17 # | |
18 # You should have received a copy of the GNU General Public License | |
19 # along with GNU Emacs; see the file COPYING. If not, write to the | |
64079 | 20 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 # Boston, MA 02110-1301, USA. | |
38850 | 22 |
23 # Build Emacs with various options for profiling, debugging, | |
24 # with and without warnings enabled etc. | |
25 | |
26 require 5; | |
27 use Getopt::Long; | |
28 use File::Basename; | |
29 use Cwd; | |
30 | |
31 # Default CVS sandbox directory. Only used when called from outside | |
32 # of the sandbox. | |
33 | |
34 $root = $ENV{"EMACS_ROOT"}; | |
35 $root = "/gd/gnu/emacs" unless $root; | |
36 | |
37 # Default make command. | |
38 | |
39 $make = $ENV{"EMACS_MAKE"}; | |
40 $make = "gmake" unless $make; | |
41 | |
42 $rc = GetOptions ("help" => \$help, | |
43 "enable-checking" => \$enable_checking, | |
44 "no-warn" => \$no_warn, | |
45 "check-marked" => \$check_marked, | |
46 "all" => \$all, | |
47 "no-optim" => \$no_optim, | |
48 "union-type" => \$union_type, | |
49 "gprof" => \$profile, | |
50 "malloc-check" => \$malloc_check, | |
51 "no-mcheck" => \$no_mcheck, | |
52 "alias" => \$aliasing, | |
39871
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
53 "boot" => \$boot, |
38850 | 54 "wall" => \$wall, |
55 "gcc3" => \$gcc3, | |
56 "trace-selection" => \$trace_selection, | |
41841 | 57 "trace-move" => \$trace_move, |
38850 | 58 "stabs" => \$use_stabs, |
59 "optim" => \$optim); | |
60 | |
61 if ($rc == 0 || $help) | |
62 { | |
63 print <<USAGE; | |
64 make-emacs [options] ... | |
65 | |
66 Build Emacs. | |
67 | |
68 --help show this help | |
69 --all make clean versionclean first | |
39871
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
70 --boot make boostrap, log to boot.log |
85357 | 71 --enable-checking ENABLE_CHECKING=1 |
38850 | 72 --no-warn disable warnings |
73 --check-marked GC_CHECK_MARKED_OBJECTS=1 | |
74 --optim no debug defines | |
75 --gprof make Emacs for profiling | |
76 --union-type define USE_LISP_UNION_TYPE (bad for GDB) | |
77 --malloc-check define GC_MALLOC_CHECK | |
78 --no-mcheck dont define GC_MCHECK | |
79 --wall compile with -Wall | |
80 --gcc3 use GCC 3.0 (30% slower compilation, slower code) | |
81 --trace-selection print traces in xselect.c | |
41841 | 82 --trace-move print traces for move_it* functions |
38850 | 83 --stabs use -gstabs instead -g |
84 | |
85 Default is to compile with warnings, with -DGC_MCHECK=1, and | |
86 with -DGLYPH_DEBUG=1. | |
87 | |
88 USAGE | |
89 exit 1; | |
90 } | |
91 | |
92 # Chdir to the top-level directory of the tree. If not in a tree | |
93 # containing Emacs, use the default. | |
94 | |
95 while (! -f "src/emacs.c" && cwd () ne "/") | |
96 { | |
97 chdir ".."; | |
98 } | |
99 | |
100 chdir $root if cwd () eq "/"; | |
101 chdir "./src"; | |
102 print "Build in ", cwd (), "\n"; | |
103 | |
104 # If first arg is `all' or if `--all' specified, ensure a clean | |
105 # build. | |
106 | |
107 if (@ARGV && $ARGV[0] eq "all") | |
108 { | |
109 $all = 1; | |
110 shift @ARGV; | |
111 } | |
112 | |
113 system ("$make clean versionclean") if $all; | |
114 | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41841
diff
changeset
|
115 if ($wall) |
38850 | 116 { |
117 $warn = "-Wall"; | |
118 } | |
119 elsif (!$no_warn) | |
120 { | |
121 $warn = "-Wpointer-arith -Wchar-subscripts -Wformat -Wimplicit-int"; | |
122 $warn = "$warn -Wreturn-type -Wswitch -Wuninitialized"; | |
123 } | |
124 | |
125 $defs = "-DGLYPH_DEBUG=1" unless $optim; | |
126 $defs = "$defs -DGC_CHECK_MARKED_OBJECTS=1" if $check_marked; | |
127 $defs = "$defs -DENABLE_CHECKING=1" if $enable_checking; | |
128 | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41841
diff
changeset
|
129 if ($profile) |
38850 | 130 { |
131 $opts = "-pg"; | |
132 $defs = "$defs -DPROFILING=1"; | |
133 } | |
134 else | |
135 { | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41841
diff
changeset
|
136 if ($use_stabs) |
38850 | 137 { |
138 $opts = "-gstabs"; | |
139 } | |
140 else | |
141 { | |
142 $opts = "-g"; | |
143 } | |
144 } | |
145 | |
146 $defs = "$defs -DUSE_LISP_UNION_TYPE" if $union_type; | |
147 $defs = "$defs -DGC_MALLOC_CHECK=1 -DGC_PROTECT_MALLOC_STATE=1" if $malloc_check; | |
148 $defs = "$defs -DGC_MCHECK=1" unless $no_mcheck; | |
149 | |
150 $defs = "$defs -DTRACE_SELECTION" if $trace_selection; | |
41841 | 151 $defs = "$defs -DDEBUG_TRACE_MOVE" if $trace_move; |
38850 | 152 |
153 # arch=pentium leads to slightly faster code than without. | |
154 $opts = "$opts -march=pentiumpro"; | |
155 | |
156 if ($optim) | |
157 { | |
158 $opts = "$opts -pipe -O3"; | |
159 } | |
160 elsif ($no_optim) | |
161 { | |
162 $opts = "$opts -pipe -fno-inline"; | |
163 } | |
164 else | |
165 { | |
166 $opts = "$opts -O -pipe -fno-inline"; | |
167 } | |
168 | |
169 $opts = "$opts -fstrict-aliasing" if $aliasing; | |
170 | |
171 $opts = "$opts $defs" if $defs; | |
172 $opts = "$opts $warn" if $warn; | |
173 | |
174 $cc = "/usr/bin/gcc"; | |
175 $cc = "/gd/local/bin/gcc" if $gcc3; | |
176 | |
39871
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
177 if ($boot) |
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 chdir ".."; |
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
180 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
|
181 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
|
182 } |
6bd2a61edfa8
Add --boot switch for bootstrapping. Logs to
Gerd Moellmann <gerd@gnu.org>
parents:
38850
diff
changeset
|
183 |
38850 | 184 exit system "$make CC=\"$cc\" CFLAGS=\"$opts\" @ARGV"; |
185 | |
186 # Local Variables: | |
187 # mode: cperl | |
188 # End: | |
52401 | 189 |
190 # arch-tag: 5c3f9713-9ece-4a12-b3f8-deaff15974ba |