Using make to compile and link phat

The product make is used to selectively compile and link phat, cleverly keeping
track of which files have been changed and need to be recompiled. This is
almost trivial and automatic. Sometimes, however, it gets confused, leading
to compilation or linking errors which are incorrectly attributed to phat.
Here's a description of make from  Patrick Decowski, which tells you how
to react when the magic command leads to compilation errors. Of course, it
occasionally happens that there really is bad code released, in which case
make can't help you...

Note: you can find a description here of how to make sure that make exists on your platform.


'make' - synonym for 'make all': this target is the one you usually
want to invoke, it goes through all the directories, sets up the
dependencies if necessary and builds 'phat'. phat is currently being
built including all the debugging information.

- 'make depend': this target is used to setup the
dependencies. basically, it determines what classes depend on what
include files. for example, TPhVertex inherits from TPhDataObject,
when TPhDataObject gets changed and recompiled you also need to
recompile TPhVertex. 'make depend' tries to establish these rules
automatically. unfortunately it only goes so far. if you update your
copy of Phat from the repository and new classes (in separate files)
are added, 'make depend' needs to be rerun to recalculate the
dependencies. there is no general mechanism of doing this
automatically. so often if you see errors like 'can't find include
file xxx.h' it can get solved by rerunning 'make depend' at the top
level and compiling again.

- 'make clean': this removes all the *.o and *.so files, the
executables and also mkconfig.in (the auto-generated configuration
file). keep in mind that generally, when you find that phat does not
build after doing a 'cvs update', you can often solve the problems by
doing a 'make depend; make' instead of 'make clean; make'. you will
find that this can speed up the updated/recompile cycle
massively. however, sometimes you really do need to do a 'make
clean' and start afresh. this is especially true when you upgrade to a
new version of Root.

the above targets are defined in every module directory in phat
(eg. you can run 'make clean' in phatrecon/src). the targets below are
only defined in the top directory ($PHATHOME) and in the phatpmc
module:

- 'make phatpmc': this builds the 'phatpmc' executable, by first making
'phat' and then looping over the 'phatpmc' directory. you need to have
the script 'cernlib' (comes with the CERN libraries) in your path for
this to work. if you can run 'paw' from the command line, then you
should be OK.

- 'make pmc': makes the 'pmc' stand-alone executable (fortran only)
by going to the 'phatpmc' directory and only compiling the *.f files
and linking with geant etc. again, you need 'cernlib' in your path.