Possibility to make only the executable
[u/mrichter/AliRoot.git] / build / module.tpl
CommitLineData
f0a26826 1
f347de98 2
f0a26826 3ifndef PACKFFLAGS
4@PACKAGE@FFLAGS:=$(FFLAGS)
5else
6@PACKAGE@FFLAGS:=$(PACKFFLAGS)
7endif
8
9ifndef PACKCFLAGS
10@PACKAGE@CFLAGS:=$(CFLAGS)
11else
12@PACKAGE@CFLAGS:=$(PACKCFLAGS)
13endif
14
15ifndef PACKCXXFLAGS
16@PACKAGE@CXXFLAGS:=$(CXXFLAGS)
17else
18@PACKAGE@CXXFLAGS:=$(PACKCXXFLAGS)
19endif
20
810722e6 21ifndef PACKDCXXFLAGS
22ifeq ($(PLATFORM),linuxicc)
23@PACKAGE@DCXXFLAGS:=$(filter-out -O%,$(CXXFLAGS)) -O0
24else
25@PACKAGE@DCXXFLAGS:=$(filter-out -O%,$(CXXFLAGS))
26endif
27else
28@PACKAGE@DCXXFLAGS:=$(PACKCXXFLAGS)
29endif
30
f0a26826 31
32ifdef DHDR
33WITHDICT=YES
34else
35WITHDICT=
36endif
37
f347de98 38# Headerfiles exported to common place:
39@PACKAGE@EXPORT:=$(EXPORT)
40@PACKAGE@EXPORTDEST:=$(patsubst %,$(EXPORTDIR)/%,$(EXPORT))
41
42
67fd7264 43#Extra include,libs, defines etc.
44
45@PACKAGE@DEFINE:=$(EDEFINE)
f347de98 46
47@PACKAGE@INC:=$(patsubst %,-I%,$(EINCLUDE)) -I@MODULE@
48
f0a26826 49@PACKAGE@ELIBS:=$(patsubst %,-l%,$(ELIBS))
50@PACKAGE@ELIBSDIR:=$(patsubst %,-L%,$(ELIBSDIR))
51
52#c sources and headers
53
54@PACKAGE@CS:=$(patsubst %,$(MODDIR)/%,$(CSRCS))
55@PACKAGE@CH:=$(patsubst %,$(MODDIR)/%,$(CHDRS))
56
57#Fortran sources
58@PACKAGE@FS:=$(patsubst %,$(MODDIR)/%,$(FSRCS))
59
60#c++ sources and header
61@PACKAGE@S:=$(patsubst %,$(MODDIR)/%,$(SRCS))
f347de98 62@PACKAGE@H:=$(patsubst %,$(MODDIR)/%,$(HDRS)) $(EHDRS)
63
64#############################################################################
65#
66# If special rootcint headerfiles is specified use them
67# else use all headers
f0a26826 68
f347de98 69ifndef CINTHDRS
70@PACKAGE@CINTHDRS:=$(@PACKAGE@H)
71else
72@PACKAGE@CINTHDRS:=$(CINTHDRS)
73endif
74#############################################################################
f0a26826 75
76# Package Dictionary
77
78@PACKAGE@DH:=$(MODDIR)/$(DHDR)
79
80
81#All objects
82@PACKAGE@CO:=$(patsubst %,$(MODDIRO)/%, $(CSRCS:.c=.o))
83TEMP:=$(FSRCS:.F=.o)
84@PACKAGE@FO:=$(patsubst %,$(MODDIRO)/%, $(TEMP:.f=.o))
85@PACKAGE@O:= $(patsubst %,$(MODDIRO)/%, $(SRCS:.cxx=.o)) $(@PACKAGE@FO) $(@PACKAGE@CO)
86
d47d6108 87
88
f0a26826 89ifdef WITHDICT
90 @PACKAGE@DS:=$(MODDIRO)/G__@PACKAGE@.cxx
91 @PACKAGE@DO:=$(MODDIRO)/G__@PACKAGE@.o
92 @PACKAGE@DDEP:=$(@PACKAGE@DO:.o=.d)
93 @PACKAGE@DEP:=$(@PACKAGE@O:.o=.d) $(@PACKAGE@DDEP)
94else
95 @PACKAGE@DS:=
96 @PACKAGE@DO:=
97 @PACKAGE@DDEP:=
98 @PACKAGE@DEP:=$(@PACKAGE@O:.o=.d)
99endif
100
101
102#The actual library file
103
104@PACKAGE@LIB:=$(LIBPATH)/lib@PACKAGE@.$(SOEXT)
105
d47d6108 106#Add this to the modules libs
107@MODULE@LIBS += $(@PACKAGE@LIB)
108
f0a26826 109#The actual binary file
110
111@PACKAGE@BIN:=$(BINPATH)/@PACKAGE@
112
d47d6108 113#Add to modules list of binaries
114@MODULE@BINS += $(@PACKAGE@BIN)
f0a26826 115
f347de98 116# Use in the main Makefile
f0a26826 117
118ifeq ($(TYPE),lib)
119ALLLIBS += $(@PACKAGE@LIB)
120BINLIBS += -l@PACKAGE@
121else
122ALLEXECS += $(@PACKAGE@BIN)
123endif
124
125# include all dependency files
126INCLUDEFILES +=$(@PACKAGE@DEP)
127
f347de98 128EXPORTFILES += $(@PACKAGE@EXPORTDEST)
f0a26826 129
130#local rules
131
f347de98 132#The exportfiles only include if any!!
133
134ifdef @PACKAGE@EXPORT
896cb507 135#$(@PACKAGE@EXPORTDEST): $(patsubst %,@MODULE@/%,$(@PACKAGE@EXPORT))
136
137$(@PACKAGE@EXPORTDEST): $(EXPORTDIR)/%.h: @MODULE@/%.h
15142e2f 138ifndef ALIQUIET
ba419e66 139 @echo "***** Copying file $^ to $@ *****"
15142e2f 140endif
f347de98 141 @[ -d $(dir $@) ] || mkdir $(dir $@)
ba419e66 142 @cp $^ $@
f347de98 143endif
144
f0a26826 145$(@PACKAGE@LIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
15142e2f 146ifndef ALIQUIET
f0a26826 147 @echo "***** Linking library $@ *****"
15142e2f 148endif
faeab8a4 149 $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \
150 export TMPDIR; mkdir $$TMPDIR ; cd $$TMPDIR ; \
151 find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\
631ac73d 152 rm -f $(CURDIR)/$@ ;\
faeab8a4 153 $(SHLD) $(SOFLAGS) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) -o $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(SHLIB) ;\
72b9e86f 154 cd $(CURDIR) ; rm -rf $$TMPDIR
f3a14d41 155 $(MUTE)chmod a-w $@
810722e6 156
f0a26826 157$(@PACKAGE@BIN):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
15142e2f 158ifndef ALIQUIET
159 @echo "***** Making executable $@ *****"
160endif
810722e6 161 $(MUTE)$(LD) $(LDFLAGS) $(@PACKAGE@O) $(@PACKAGE@DO) $(BINLIBDIRS) $(@PACKAGE@ELIBS) $(LIBS) $(EXEFLAGS) -o $@
f0a26826 162
6bb8c070 163$(@PACKAGE@DS): $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH) @MODULE@/module.mk
15142e2f 164ifndef ALIQUIET
f0a26826 165 @echo "***** Creating $@ *****";
15142e2f 166endif
f0a26826 167 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 168 $(MUTE)rootcint -f $@ -c $(@PACKAGE@DEFINE) $(CINTFLAGS) $(@PACKAGE@INC) $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH)
f0a26826 169
170$(@PACKAGE@DO): $(@PACKAGE@DS)
15142e2f 171ifndef ALIQUIET
172 @echo "***** Compiling $< *****";
173endif
810722e6 174 $(MUTE)$(CXX) -c $(@PACKAGE@INC) -I$(ALICE_ROOT) $< -o $@ $(@PACKAGE@DCXXFLAGS)
f0a26826 175
176#Different targets for the module
177
5edd655b 178ifeq ($(TYPE),lib)
f0a26826 179all-@PACKAGE@: $(@PACKAGE@LIB)
5edd655b 180else
181all-@PACKAGE@: $(@PACKAGE@BIN)
182endif
183
f0a26826 184
f0a26826 185depend-@PACKAGE@: $(@PACKAGE@DEP)
186
187# determination of object files
82910ea7 188$(MODDIRO)/%.o: $(MODDIRO)/%.cxx $(MODDIRO)/%.d
189ifndef ALIQUIET
190 @echo "***** Compiling $< *****";
191endif
192 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
193 $(MUTE)$(CXX) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CXXFLAGS)
194
f0a26826 195$(MODDIRO)/%.o: $(MODDIR)/%.cxx $(MODDIRO)/%.d
15142e2f 196ifndef ALIQUIET
197 @echo "***** Compiling $< *****";
198endif
f0a26826 199 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 200 $(MUTE)$(CXX) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CXXFLAGS)
f0a26826 201
202$(MODDIRO)/%.o: $(MODDIR)/%.F $(MODDIRO)/%.d
15142e2f 203ifndef ALIQUIET
204 @echo "***** Compiling $< *****";
205endif
f0a26826 206 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 207 $(MUTE)$(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS)
f0a26826 208
209$(MODDIRO)/%.o: $(MODDIR)/%.f $(MODDIRO)/%.d
15142e2f 210ifndef ALIQUIET
211 @echo "***** Compiling $< *****";
212endif
f0a26826 213 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 214 $(MUTE)$(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS)
f0a26826 215
216$(MODDIRO)/%.o: $(MODDIR)/%.c $(MODDIRO)/%.d
15142e2f 217ifndef ALIQUIET
218 @echo "***** Compiling $< *****";
219endif
f0a26826 220 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 221 $(MUTE)$(CC) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CFLAGS)
f0a26826 222
223$(@PACKAGE@DDEP): $(@PACKAGE@DS)
15142e2f 224ifndef ALIQUIET
f0a26826 225 @echo "***** Making dependencies for $< *****";
15142e2f 226endif
f0a26826 227 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
228 @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
229
d47d6108 230$(MODDIRO)/%.d: $(MODDIRS)/%.cxx
15142e2f 231ifndef ALIQUIET
f0a26826 232 @echo "***** Making dependencies for $< *****";
15142e2f 233endif
f0a26826 234 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 235 @share/alibtool depend "$(@PACKAGE@DEFINE) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
896cb507 236$(MODDIRO)/%.d: $(MODDIRS)/%.f
15142e2f 237ifndef ALIQUIET
f0a26826 238 @echo "***** Making dependencies for $< *****";
15142e2f 239endif
f0a26826 240 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
896cb507 241 @share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
242$(MODDIRO)/%.d: $(MODDIRS)/%.F
15142e2f 243ifndef ALIQUIET
f0a26826 244 @echo "***** Making dependencies for $< *****";
15142e2f 245endif
f0a26826 246 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 247 $(MUTE)share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
896cb507 248$(MODDIRO)/%.d: $(MODDIRS)/%.c
15142e2f 249ifndef ALIQUIET
f0a26826 250 @echo "***** Making dependencies for $< *****";
15142e2f 251endif
f0a26826 252 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 253 @share/alibtool depend "$(@PACKAGE@DEFINE) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@