Fix previous change to include scalable/mimetypes directory.
[emacs.git] / admin / make-emacs
blobf54bc481cfaccd836d498d8f9c6662cef75822f1
1 #! /usr/bin/perl
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)
11 # any later version.
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.
26 require 5;
27 use Getopt::Long;
28 use File::Basename;
29 use Cwd;
31 # Default CVS sandbox directory. Only used when called from outside
32 # of the sandbox.
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,
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,
53 "boot" => \$boot,
54 "wall" => \$wall,
55 "gcc3" => \$gcc3,
56 "trace-selection" => \$trace_selection,
57 "trace-move" => \$trace_move,
58 "stabs" => \$use_stabs,
59 "optim" => \$optim);
61 if ($rc == 0 || $help)
63 print <<USAGE;
64 make-emacs [options] ...
66 Build Emacs.
68 --help show this help
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
86 with -DGLYPH_DEBUG=1.
88 USAGE
89 exit 1;
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 "/")
97 chdir "..";
100 chdir $root if cwd () eq "/";
101 chdir "./src";
102 print "Build in ", cwd (), "\n";
104 # If first arg is `all' or if `--all' specified, ensure a clean
105 # build.
107 if (@ARGV && $ARGV[0] eq "all")
109 $all = 1;
110 shift @ARGV;
113 system ("$make clean versionclean") if $all;
115 if ($wall)
117 $warn = "-Wall";
119 elsif (!$no_warn)
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;
129 if ($profile)
131 $opts = "-pg";
132 $defs = "$defs -DPROFILING=1";
134 else
136 if ($use_stabs)
138 $opts = "-gstabs";
140 else
142 $opts = "-g";
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";
156 if ($optim)
158 $opts = "$opts -pipe -O3";
160 elsif ($no_optim)
162 $opts = "$opts -pipe -fno-inline";
164 else
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;
177 if ($boot)
179 chdir "..";
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";
186 # Local Variables:
187 # mode: cperl
188 # End:
190 # arch-tag: 5c3f9713-9ece-4a12-b3f8-deaff15974ba