Coding conventions
[u/mrichter/AliRoot.git] / Makefile
1 ############################### Main Makefile #################################
2
3 # Include machine specific definitions
4
5 include $(ALICE_ROOT)/conf/GeneralDef
6 include $(ALICE_ROOT)/conf/MachineDef.$(ALICE_TARGET)
7
8 MAKEFLAGS += -s
9
10 ##### MACROS #####
11
12 PACKAGE = Main
13
14 DOTS = " ................................................................................"
15
16 PRETTY =  $(AWK) '{print $$0 substr($(DOTS),1,79-length($$0))}'
17
18 ##### Module libraries #####
19
20 ALIROOT_DIRS            = STEER TGeant3 TRD PHOS TPC ZDC MUON PMD FMD TOF ITS \
21                           CASTOR RICH START STRUCT EVGEN RALICE ALIFAST \
22                           THijing CONTAINERS MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN
23
24 ##### TARGETS #####
25  
26 default:      lib bin alilibs aliroot
27
28 lib bin:
29         @mkdir $@
30
31 alilibs:  lib
32         echo MAKEFLAGS = $(MAKEFLAGS)
33         for i in $(ALIROOT_DIRS) ; do \
34            echo "Making headers in $$i" | $(PRETTY); \
35            ${MAKE} -C $$i headers ; \
36         done
37         @for i in $(ALIROOT_DIRS) ; do \
38            echo "Making dependencies in $$i" | $(PRETTY); \
39            ${MAKE} -C $$i depend ; \
40         done
41         @for i in $(ALIROOT_DIRS) ; do \
42            echo "Making in $$i" | $(PRETTY); \
43            ${MAKE} -C $$i ; \
44         done
45
46 aliroot geant321 minicern pdf pythia6 hijing: FORCE
47         @DIR=`echo $@ | $(AWK) '{print toupper($$0)}'` ; \
48         echo "Making dependencies in $$DIR" | $(PRETTY); \
49         ${MAKE} -C $$DIR depend;\
50         echo "Making in $$DIR" | $(PRETTY); \
51         ${MAKE} -C $$DIR
52
53 TGeant4 AliGeant4 AliFluka : FORCE
54         @DIR=$@; \
55         echo "Making dependencies in $$DIR" | $(PRETTY); \
56         ${MAKE} -C $$DIR depend;\
57         echo "Making in $$DIR" | $(PRETTY); \
58         ${MAKE} -C $$DIR
59
60 cernlibs: geant321 pythia6 minicern pdf hijing
61
62 geant4: TGeant4 AliGeant4
63
64 Flugg: FORCE
65         @DIR=$@; \
66         echo "Making in $$DIR" | $(PRETTY); \
67         ${MAKE} -C $$DIR/source
68
69 fluka:  Flugg TGeant4 AliGeant4 AliFluka
70
71 all:    cernlibs default
72
73 FORCE:
74
75 ############################### General Macros ################################
76
77 # include $(ALICE_ROOT)/conf/GeneralMacros
78
79 ############################### Specific Macros ###############################
80
81 STRUCT_DIRS     = html conf macros data share include Euclid picts \
82                   doc etc Makefile .rootrc
83
84 LIBRARY_DIRS    = MINICERN GEANT321 PYTHIA6 PDF HIJING
85
86 dist: AliRoot$(VERSION).tar.gz
87
88 AliRoot$(VERSION).tar.gz: $(STRUCT_DIRS) $(ALIROOT_DIRS) ALIROOT
89
90 distall: AliOffline$(VERSION).tar.gz
91
92 AliOffline$(VERSION).tar.gz: $(STRUCT_DIRS) $(ALIROOT_DIRS) $(LIBRARY_DIRS) ALIROOT
93
94 distlib: AliLibs$(VERSION).tar.gz
95
96 AliLibs$(VERSION).tar.gz: $(LIBRARY_DIRS)
97
98 AliRoot$(VERSION).tar.gz AliLibs$(VERSION).tar.gz AliOffline$(VERSION).tar.gz:
99                 @rm -f $(ALICE)/$@ 
100                 @rm -f `find . -name '*~' -print` \
101                        `find . -name '*.bak' -print` \
102                        `find . -name '.*~' -print` \
103                        `find . -name '*\#*' -print` 
104                 @rm -f /tmp/saves
105                 @ls -1d $^ | sed -e "s/^/$(ALICE_LEVEL)\//" > /tmp/saves
106                 @cd $(ALICE) ; \
107                 gtar cvfz $@ --exclude '*.o' --exclude '*Cint.*' \
108                 --exclude 'roothtml' --exclude 'CVS' \
109                 --exclude Make-depend --exclude '*html/gif' \
110                 --exclude "*tgt_*" --exclude check \
111                 `cat /tmp/saves` 
112
113 htmldocnew:             FORCE
114                 @for i in $(ALIROOT_DIRS) ; do \
115                     echo "Making HTML doc for $$i" ; \
116                     rm -rf $(ALICE_ROOT)/$$i/html ; \
117                     cd $(ALICE_ROOT)/$$i ; \
118                     aliroot -b -q mkhtml.C > /dev/null; \
119                     for j in `ls *.C` ; do \
120                        echo $$j ; \
121                        aliroot -b -q "mkhtml.C(\"$$j\")" > /dev/null; \
122                     done \
123                 done
124
125
126 htmldoc:                FORCE
127                 @rm -rf html/roothtml
128                 @rm -f  html/picts
129                 @rm -f /tmp/macros
130                 @cd html ;\
131                 aliroot -q -b "mkhtml.C(0,1)" ;\
132                 ls ../macros/*.C > /tmp/macros ;\
133                 for i in $(ALIROOT_DIRS) ; do \
134                         ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\
135                 done ;\
136                 for i in `cat /tmp/macros` ; do \
137                         echo $$i ; \
138                         aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
139                 done ;\
140                 ./makeExampleList ;
141                 @ln -s ../picts html/picts
142                 @ln -s ../../picts html/roothtml/picts
143                 @ln -s ../../../picts html/roothtml/src/picts
144                 @ln -s ../../../picts html/roothtml/examples/picts
145
146 clean:  FORCE
147                 @rm -f *~ \#*
148                 @rm -f include/*
149                 @for i in $(ALIROOT_DIRS) ALIROOT; do \
150                     ${MAKE} -C $$i macroclean ; \
151                 done
152                 ifdef G4INSTALL
153                   @for i in TGeant4 AliGeant4; do \
154                     ${MAKE} -C $$i macroclean ; \
155                   done
156                 endif  
157
158 libclean:  FORCE
159                 @rm -f *~ \#*
160                 @for i in $(LIBRARY_DIRS) ; do \
161                     ${MAKE} -C $$i macroclean ; \
162                 done
163
164 allclean: libclean clean
165
166 # IRST coding rule check
167 CHECK_DIRS = $(ALIROOT_DIRS) ALIROOT TGeant4 AliGeant4
168 check:     
169                 @for i in $(CHECK_DIRS) ; do \
170                     echo "Checking $$i" ; \
171                     ${MAKE} -C $$i check ; \
172                 done
173
174 REVENG_DIRS = $(ALIROOT_DIRS)
175
176 reveng:
177         @for i in $(REVENG_DIRS) ; do \
178                 echo "Reverse engineering $$i" ; \
179                 ${MAKE} -C $$i reveng ; \
180         done
181
182
183
184
185
186
187
188