3 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
4 # Free Software Foundation, Inc.
6 # This file is part of GNU Emacs.
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
10 # the Free Software Foundation; either version 3, or (at your option)
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.
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
20 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 # Boston, MA 02110-1301, USA.
23 # Build Emacs with various options for profiling, debugging,
24 # with and without warnings enabled etc.
31 # Default CVS sandbox directory. Only used when called from outside
34 $root = $ENV{"EMACS_ROOT"};
35 $root = "/gd/gnu/emacs" unless $root;
37 # Default make command.
39 $make = $ENV{"EMACS_MAKE"};
40 $make = "gmake" unless $make;
42 $rc = GetOptions
("help" => \
$help,
43 "enable-checking" => \
$enable_checking,
44 "no-warn" => \
$no_warn,
45 "check-marked" => \
$check_marked,
47 "no-optim" => \
$no_optim,
48 "union-type" => \
$union_type,
50 "malloc-check" => \
$malloc_check,
51 "no-mcheck" => \
$no_mcheck,
52 "alias" => \
$aliasing,
56 "trace-selection" => \
$trace_selection,
57 "trace-move" => \
$trace_move,
58 "stabs" => \
$use_stabs,
61 if ($rc == 0 || $help)
64 make-emacs [options] ...
69 --all make clean versionclean first
70 --boot make boostrap, log to boot.log
71 --enable-checking ENABLE_CHECKING=1
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
82 --trace-move print traces for move_it* functions
83 --stabs use -gstabs instead -g
85 Default is to compile with warnings, with -DGC_MCHECK=1, and
92 # Chdir to the top-level directory of the tree. If not in a tree
93 # containing Emacs, use the default.
95 while (! -f
"src/emacs.c" && cwd
() ne "/")
100 chdir $root if cwd
() eq "/";
102 print "Build in ", cwd
(), "\n";
104 # If first arg is `all' or if `--all' specified, ensure a clean
107 if (@ARGV && $ARGV[0] eq "all")
113 system ("$make clean versionclean") if $all;
121 $warn = "-Wpointer-arith -Wchar-subscripts -Wformat -Wimplicit-int";
122 $warn = "$warn -Wreturn-type -Wswitch -Wuninitialized";
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;
132 $defs = "$defs -DPROFILING=1";
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;
150 $defs = "$defs -DTRACE_SELECTION" if $trace_selection;
151 $defs = "$defs -DDEBUG_TRACE_MOVE" if $trace_move;
153 # arch=pentium leads to slightly faster code than without.
154 $opts = "$opts -march=pentiumpro";
158 $opts = "$opts -pipe -O3";
162 $opts = "$opts -pipe -fno-inline";
166 $opts = "$opts -O -pipe -fno-inline";
169 $opts = "$opts -fstrict-aliasing" if $aliasing;
171 $opts = "$opts $defs" if $defs;
172 $opts = "$opts $warn" if $warn;
174 $cc = "/usr/bin/gcc";
175 $cc = "/gd/local/bin/gcc" if $gcc3;
180 system "mv boot.log boot.log.old" if -f
"boot.log";
181 exit system "script boot.log $make CC=\"$cc\" CFLAGS=\"$opts\" bootstrap";
184 exit system "$make CC=\"$cc\" CFLAGS=\"$opts\" @ARGV";
190 # arch-tag: 5c3f9713-9ece-4a12-b3f8-deaff15974ba