Added EDEFINE with the flags from Geant4
[u/mrichter/AliRoot.git] / build / README
CommitLineData
f347de98 1****************************************************
2* *
3* Flat makefile for AliRoot *
4* *
5* This README describes how to use the *
6* Makefile.flat for AliRoot *
7* *
8* Author: Jan-Erik Revsbech <revsbech@fys.ku.dk> *
9*****************************************************
10
11** RUNNING **
12
13Use these makefile with
14
15make -f Makefile.flat
16
17
18** DESCRIPTION **
19
20As the name suggests this is a flat makefile structure for
21Aliroot. That means that there is only one makefile for aliroot and
22not as before on makefile for every package. This way the
23Makefile.flat knows about all dependencies and does not have to
24recursively go through all directories several time.
25
26Instead of having a makefile for each package, all the packages have
27one module.mk file. This file contains information about the package.
28Each package can contain several libraries
29and binaries to be made. The module.mk file is automatically created
30by a script, by using a template. The script must know about what
31files each desired library or binary consists of. This is specified
32in .pkg files. For example a module in directory STEER could make two
33libraries libSTEER and libSTEERDummy.so and one binary called
34STEERTest. In this example the directory STEER would contain three
35files: libSTEER.pkg, libSTEERDummy.pkg and binSTEERTest.pkg. These
36files will contain information about which source and header files the
37library or binary consists of and specific options. See the section package file for
38further information about what the pkg files contains.
39The libraries are put in the directory LIBPATH, set in Makefile.flat
40and binaries in BINPATH. These directories are set to
41bin/tgt_$ALICE_TARGET and lib/tgt_$ALICE_TARGET respectively.
42In this example we would produce three outoutfiles called libSTEER.so,
43libSTEERDummy.so and STEERTest. These names are created from the name
44of the .pkg files!!
45
46The module.mk files will be automatically generated by Makefile.flat
47if they do not exist. Also the build/moudle.dep contains a list of
48dependencies for the module.mk files. This means that for the above
49example the build/module.dep would contain a line like this:
50
51STEER/module.mk: libSTEER.pkg libSTEERDummy.pkg binSTEERTest.pkg
52
53In this way if a change is made to one of the package-files (a
54source-file is added or something), the module.mk file will be re-generated.
55
56The Makefile.flat has in the start a variable called MODULES, this
57variables lists all the subdirectories to look for module.mk files.
58
59** PACKAGE FILES **
60
61The .pkg files uses make syntax, so be careful with tabs!!!
62
63As a minimum all package files must specify which source-code files and
64headers it consist of. This is done with the variables
65HDRS,SRCS,FSRCS,CSRCS which is Heades, C++ sources, Fortran sources
66and C-source-files.
67
68For example the Package libSTEERDummy.pkg could consist of
69
70SRCS:= AliSTEERDummy.cxx
71
72FSRCS:= AliSTEERFortranRoutines.f
73
74HDRS:= AliSTEERDummy.cxx
75
76Since the pkg files use make syntax HDRS can also be specified as
77
78HDRS:=$(SRCS:.cxx=.h)
79
80which is useful if there is a lot of files.
81
82If the library (or binary) uses include files in other directories
83than its own it should be specified in the variable EHDRS (for External
84headers). By default the Makefile.flat will look in $ALICE_ROOT,
85$ALICE_ROOT/MODULE (in this case $ALICE_ROOT/STEER), $ROOTSYS/inlude
86and in $ALICE_ROOT/include. If more include directories is needed it
87can be specified with the variable EINCLUDE. *DO NOT* put the -I flag
88it will be put automatically, just write the name of the directory.
89
90If the package exports any header files fo use by other libraries it can be put
91in the variable EXPORT. These files will be copied to
92$ALICE_ROOT/include and can be used by other libraries without directly
93including this module.
94
95If a root dictionary file is used it can be specified with
96
97DHDR:= STEERLinkdef.h
98
99This will be processed with rootcint with all the header-files
100(specified in HDRS), and default cint includedir (set in CINTFLAGS)
101plus the directories specified in EINCLUDE
102
103By default all libraries are linked against libraries specified in
104SHLIB and binaries against LIBS. If desired extra libraries can be
105specified with the ELIBS variable. *DO NOT* specify the -l flag, just
106write the library like
107
108ELIBS:= CONTAINERS
109
110this will be translated into -lCONTAINERS
111
112Extra library directories can be specified with ELIBSDIR
113
114If very special compilation flags is needed it can be specified with
115the three variables:
116
117PACKFFLAGS:=
118PACKCXXFLAGS:=
119PACKCFLAGS:=
120
121*WARNING* if these flags are set, the default FFLAGS,CXXFLAGS and CFLAGS
122 will be overwritten. Normally they will be used like this:
123
124PACKCXXFLAGS:= $(filter-out -O%,CXXFLAGS)
125
126This will set the C++ compiler-flags to the default ones, but without
127optimisation.
128
129** LIST OF Variables in .pkg files **
130
131SRCS:=
132HDRS:=
133FSRCS:=
134DHDR:=
135CSRCS:=
136CHDRS:=
137EINCLUDE:=
138ELIBS:=
139ELIBSDIR:=
140PACKFFLAGS:=
141PACKCXXFLAGS:=
142PACKCFLAGS:=
143EXPORT:=
144EHDRS:=
145
146
147** ADDING NEW DIRECTORIES **
148
149When adding a new direcotry you must make a new .pkg file. If your
150library is going to be libEXAMPLE.so then make a new file called
151libEXAMPLE.pkg in the new direcotry. Now you need to add this
152direcotry to the Makefile.flat. Add it to the MODULES variable.
153A last step is to edit the build/module.dep file. Add a line like
154this:
155
156NEWDIR/module.mk: libEXAMPLE.pkg
157
158Please let the module.mk file depend on all .pkg files in the new
159directory. If you want aliroot to be linked against it, then edit
160ALIROOT/binaliroot.pkg and add you new lirbrary to the ELIBS variable.
161
162