= Compiling GiBUU = Compiling GiBUU usually is as easy as typing '''make''' in the GiBUU base directory. However, a couple of options are available for special situations. Before compiling, make sure that all [wiki:tools prerequisites] are fulfilled. If you compile GiBUU for the first time, you should start with '''make renew'''. This is also helpful sometimes when you want to redo the whole compilation instead of doing an incremental make or rebuild the dependencies. Note that the whole compilation process is steared by GNU make. GiBUU is always compiled statically, so that we get a monolithic executable which does not depend on system libraries (with the exception of Mac OS X where static linking is not supported). == Choosing a Compiler == By default the Makefile uses the first supported compiler which it finds on your system (ifort, gfortran, g95, sunf95 or lfc - in this order). But you can also tell the Makefile which compiler to use, by doing e.g.: {{{ make FORT=gfortran }}} In this way you can also specify the exact path of the compiler explicitly: {{{ make FORT=/opt/g95-install/bin/g95 }}} == Choosing an Optimization Level == By default GiBUU is compiled with debugging flags, which is good for development and bug tracking, but the produced executable may be quite slow. If you want an optimized executable, you should compile with {{{ make MODE=opt3 }}} This works with all compilers and lets you specify the optimization level (0-3). Another option is to use profiling flags: {{{ make MODE=prof }}} Currently this only works with ifort & gfortran, and produces an executable which is suitable for profiling with gprof. == Floating Point Exceptions == Checks for floating point exceptions are turned off by default. To change this you can use e.g. {{{ make FPE=0 }}} This sets the level for floating point exceptions, which can be 0-3, where FPE=3 means none and FPE=0 means all. FPE=3 is the default. This flag is only supported with ifort and gfortran. == Parallel Make == If you have a multi-core machine, you can speed up the compilation process by specifying the number of cores to be used by make. E.g. on a quad-code machine you could do {{{ make -j4 }}} This can potentially be up to four times faster than the standard single-threaded make ("-j1"), since four files can be compiled in parallel.