[Serdev] improved build / make system
Andrei Pelinescu-Onciul
andrei at iptel.org
Sat Jun 28 10:55:13 CEST 2008
Latest cvs HEAD comes with an improved, but also heavily modified build
system.
Now the configuration one uses to build ser will be saved automatically
the first time some make command is run on a clean (or better said
proper) build tree.
The configuration can be re-generated any time by running make cfg or
make config. Note that the configuration is deleted by make proper, so
after a make proper the configuration will also be regenerated.
The configuration contains the module list and all the compile flags and
defines (automatically detected by Makefile.defs or manually
overwritten).
For example to include mysql in the module list used for compile,
install, clean a.s.o and to compile in debug mode, one would use one of
the following equivalent commands:
make cfg include_modules=mysql mode=debug ; make all
or
rm config.mak ; make all include_modules=mysql mode=debug
All future make commands will use the saved options, unless they
specifically overwrite them on the command line (e.g. make install
will install also the mysql module, but make install skip_modules="mysql
print" will not install the mysql and print modules).
The main advantages of this approach are convenience (you don't have to
remember every time to add include_modules=mysql to make's command line)
and speed (see below).
The changes should be mostly transparent and all of the old ways of
running make should still work, just remember that the first
time you run make after a make proper, on freshly checkout sources or
after a Makefile.defs change (e.g. changed ser version) the config will be
rebuilt automatically and all the current options will be saved.
For example the following command sequence will result in make all
compiling only the print module, which might be a little unexpected:
touch Makefile.defs # or cvs update that changes Makefile.defs or make
# proper
make modules modules=modules/print
make all # it will compile only the print module because that was saved
# in the config
(to see what modules are going to be compiled, one can use
make print-modules)
Most of the config saved value can be temporarily overwritten without
changing the config, e.g.:
make cfg skip_modules=print CPU=athlon64
# compiles optimized for athlon64, skips the print modules
make all
# compiles also the print module
make all include_modules=print
# compiles only the print module, optimized for pentium-m
make modules modules=modules/print CPU=pentium-m
Speed tests:
1. make run inside a module (print in this case, because it has very
little code to compile and we want to measure make and not gcc):
compared to older ser 2.1: make proper is 11 times faster, make clean 12
times, make on fresh sources is 1.5 times faster, make on "configured"
sources is 3 times faster and a do-nothing make (make after make) is 17
times faster.
compared to ser 2.0 the numbers are: 10, 10, 1.05, 2.1, 24.
2. make from the main directory, with modules=modules/print (only the
print module + main ser + utils will be included):
compared to older ser 2.1: make proper is 15.7 times faster, make clean 8.8
times, make on fresh sources is 1.25 times faster, make on "configured"
sources is 2.6 times faster and a do-nothing make (make after make) is 8.8
times faster.
compared to ser 2.0 the numbers are: 16.6, 10, 0.81, 1.99, 5.17.
(note that in this case the compile values are not so great, because
2.1's core is bigger then 2.0)
If you find any problems (errors, things that worked before and don't
work anymore a.s.o), please drop me a mail and don't forget to include
make's version (make --version or gmake --version) and config.mak.
Andrei
More information about the Serdev
mailing list