Mercurial > emacs
comparison admin/make-emacs @ 38850:f87dbbd87498
*** empty log message ***
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 16 Aug 2001 15:23:50 +0000 |
parents | |
children | 6bd2a61edfa8 |
comparison
equal
deleted
inserted
replaced
38849:4998d97a9215 | 38850:f87dbbd87498 |
---|---|
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, | |
52 "wall" => \$wall, | |
53 "gcc3" => \$gcc3, | |
54 "trace-selection" => \$trace_selection, | |
55 "stabs" => \$use_stabs, | |
56 "optim" => \$optim); | |
57 | |
58 if ($rc == 0 || $help) | |
59 { | |
60 print <<USAGE; | |
61 make-emacs [options] ... | |
62 | |
63 Build Emacs. | |
64 | |
65 --help show this help | |
66 --all make clean versionclean first | |
67 --enable-checking ENABLE_CHECKING=1 (implies Lisp union type) | |
68 --no-warn disable warnings | |
69 --check-marked GC_CHECK_MARKED_OBJECTS=1 | |
70 --optim no debug defines | |
71 --gprof make Emacs for profiling | |
72 --union-type define USE_LISP_UNION_TYPE (bad for GDB) | |
73 --malloc-check define GC_MALLOC_CHECK | |
74 --no-mcheck dont define GC_MCHECK | |
75 --wall compile with -Wall | |
76 --gcc3 use GCC 3.0 (30% slower compilation, slower code) | |
77 --trace-selection print traces in xselect.c | |
78 --stabs use -gstabs instead -g | |
79 | |
80 Default is to compile with warnings, with -DGC_MCHECK=1, and | |
81 with -DGLYPH_DEBUG=1. | |
82 | |
83 USAGE | |
84 exit 1; | |
85 } | |
86 | |
87 # Chdir to the top-level directory of the tree. If not in a tree | |
88 # containing Emacs, use the default. | |
89 | |
90 while (! -f "src/emacs.c" && cwd () ne "/") | |
91 { | |
92 chdir ".."; | |
93 } | |
94 | |
95 chdir $root if cwd () eq "/"; | |
96 chdir "./src"; | |
97 print "Build in ", cwd (), "\n"; | |
98 | |
99 # If first arg is `all' or if `--all' specified, ensure a clean | |
100 # build. | |
101 | |
102 if (@ARGV && $ARGV[0] eq "all") | |
103 { | |
104 $all = 1; | |
105 shift @ARGV; | |
106 } | |
107 | |
108 system ("$make clean versionclean") if $all; | |
109 | |
110 if ($wall) | |
111 { | |
112 $warn = "-Wall"; | |
113 } | |
114 elsif (!$no_warn) | |
115 { | |
116 $warn = "-Wpointer-arith -Wchar-subscripts -Wformat -Wimplicit-int"; | |
117 $warn = "$warn -Wreturn-type -Wswitch -Wuninitialized"; | |
118 } | |
119 | |
120 $defs = "-DGLYPH_DEBUG=1" unless $optim; | |
121 $defs = "$defs -DGC_CHECK_MARKED_OBJECTS=1" if $check_marked; | |
122 $defs = "$defs -DENABLE_CHECKING=1" if $enable_checking; | |
123 | |
124 if ($profile) | |
125 { | |
126 $opts = "-pg"; | |
127 $defs = "$defs -DPROFILING=1"; | |
128 } | |
129 else | |
130 { | |
131 if ($use_stabs) | |
132 { | |
133 $opts = "-gstabs"; | |
134 } | |
135 else | |
136 { | |
137 $opts = "-g"; | |
138 } | |
139 } | |
140 | |
141 $defs = "$defs -DUSE_LISP_UNION_TYPE" if $union_type; | |
142 $defs = "$defs -DGC_MALLOC_CHECK=1 -DGC_PROTECT_MALLOC_STATE=1" if $malloc_check; | |
143 $defs = "$defs -DGC_MCHECK=1" unless $no_mcheck; | |
144 | |
145 $defs = "$defs -DTRACE_SELECTION" if $trace_selection; | |
146 | |
147 # arch=pentium leads to slightly faster code than without. | |
148 $opts = "$opts -march=pentiumpro"; | |
149 | |
150 if ($optim) | |
151 { | |
152 $opts = "$opts -pipe -O3"; | |
153 } | |
154 elsif ($no_optim) | |
155 { | |
156 $opts = "$opts -pipe -fno-inline"; | |
157 } | |
158 else | |
159 { | |
160 $opts = "$opts -O -pipe -fno-inline"; | |
161 } | |
162 | |
163 $opts = "$opts -fstrict-aliasing" if $aliasing; | |
164 | |
165 $opts = "$opts $defs" if $defs; | |
166 $opts = "$opts $warn" if $warn; | |
167 | |
168 $cc = "/usr/bin/gcc"; | |
169 $cc = "/gd/local/bin/gcc" if $gcc3; | |
170 | |
171 exit system "$make CC=\"$cc\" CFLAGS=\"$opts\" @ARGV"; | |
172 | |
173 # Local Variables: | |
174 # mode: cperl | |
175 # End: |