3 # Copyright (C) 2001 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 2, or (at your option)
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; see the file COPYING. If not, write to the
19 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 # Boston, MA 02110-1301, USA.
22 # Build Emacs with various options for profiling, debugging,
23 # with and without warnings enabled etc.
30 # Default CVS sandbox directory. Only used when called from outside
33 $root = $ENV{"EMACS_ROOT"};
34 $root = "/gd/gnu/emacs" unless $root;
36 # Default make command.
38 $make = $ENV{"EMACS_MAKE"};
39 $make = "gmake" unless $make;
41 $rc = GetOptions
("help" => \
$help,
42 "enable-checking" => \
$enable_checking,
43 "no-warn" => \
$no_warn,
44 "check-marked" => \
$check_marked,
46 "no-optim" => \
$no_optim,
47 "union-type" => \
$union_type,
49 "malloc-check" => \
$malloc_check,
50 "no-mcheck" => \
$no_mcheck,
51 "alias" => \
$aliasing,
55 "trace-selection" => \
$trace_selection,
56 "trace-move" => \
$trace_move,
57 "stabs" => \
$use_stabs,
60 if ($rc == 0 || $help)
63 make-emacs [options] ...
68 --all make clean versionclean first
69 --boot make boostrap, log to boot.log
70 --enable-checking ENABLE_CHECKING=1 (implies Lisp union type)
71 --no-warn disable warnings
72 --check-marked GC_CHECK_MARKED_OBJECTS=1
73 --optim no debug defines
74 --gprof make Emacs for profiling
75 --union-type define USE_LISP_UNION_TYPE (bad for GDB)
76 --malloc-check define GC_MALLOC_CHECK
77 --no-mcheck dont define GC_MCHECK
78 --wall compile with -Wall
79 --gcc3 use GCC 3.0 (30% slower compilation, slower code)
80 --trace-selection print traces in xselect.c
81 --trace-move print traces for move_it* functions
82 --stabs use -gstabs instead -g
84 Default is to compile with warnings, with -DGC_MCHECK=1, and
91 # Chdir to the top-level directory of the tree. If not in a tree
92 # containing Emacs, use the default.
94 while (! -f
"src/emacs.c" && cwd
() ne "/")
99 chdir $root if cwd
() eq "/";
101 print "Build in ", cwd
(), "\n";
103 # If first arg is `all' or if `--all' specified, ensure a clean
106 if (@ARGV && $ARGV[0] eq "all")
112 system ("$make clean versionclean") if $all;
120 $warn = "-Wpointer-arith -Wchar-subscripts -Wformat -Wimplicit-int";
121 $warn = "$warn -Wreturn-type -Wswitch -Wuninitialized";
124 $defs = "-DGLYPH_DEBUG=1" unless $optim;
125 $defs = "$defs -DGC_CHECK_MARKED_OBJECTS=1" if $check_marked;
126 $defs = "$defs -DENABLE_CHECKING=1" if $enable_checking;
131 $defs = "$defs -DPROFILING=1";
145 $defs = "$defs -DUSE_LISP_UNION_TYPE" if $union_type;
146 $defs = "$defs -DGC_MALLOC_CHECK=1 -DGC_PROTECT_MALLOC_STATE=1" if $malloc_check;
147 $defs = "$defs -DGC_MCHECK=1" unless $no_mcheck;
149 $defs = "$defs -DTRACE_SELECTION" if $trace_selection;
150 $defs = "$defs -DDEBUG_TRACE_MOVE" if $trace_move;
152 # arch=pentium leads to slightly faster code than without.
153 $opts = "$opts -march=pentiumpro";
157 $opts = "$opts -pipe -O3";
161 $opts = "$opts -pipe -fno-inline";
165 $opts = "$opts -O -pipe -fno-inline";
168 $opts = "$opts -fstrict-aliasing" if $aliasing;
170 $opts = "$opts $defs" if $defs;
171 $opts = "$opts $warn" if $warn;
173 $cc = "/usr/bin/gcc";
174 $cc = "/gd/local/bin/gcc" if $gcc3;
179 system "mv boot.log boot.log.old" if -f
"boot.log";
180 exit system "script boot.log $make CC=\"$cc\" CFLAGS=\"$opts\" bootstrap";
183 exit system "$make CC=\"$cc\" CFLAGS=\"$opts\" @ARGV";
189 # arch-tag: 5c3f9713-9ece-4a12-b3f8-deaff15974ba