Update of the flat makefiles (J.-E. Revsbech)
[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
21
22ifdef DHDR
23WITHDICT=YES
24else
25WITHDICT=
26endif
27
f347de98 28# Headerfiles exported to common place:
29@PACKAGE@EXPORT:=$(EXPORT)
30@PACKAGE@EXPORTDEST:=$(patsubst %,$(EXPORTDIR)/%,$(EXPORT))
31
32
f0a26826 33#Extra include,libs etc.
f347de98 34#@PACKAGE@INC:=$(patsubst %,-I@MODULE@/%,$(EINCLUDE)) -I@MODULE@
35
36@PACKAGE@INC:=$(patsubst %,-I%,$(EINCLUDE)) -I@MODULE@
37
f0a26826 38@PACKAGE@ELIBS:=$(patsubst %,-l%,$(ELIBS))
39@PACKAGE@ELIBSDIR:=$(patsubst %,-L%,$(ELIBSDIR))
40
41#c sources and headers
42
43@PACKAGE@CS:=$(patsubst %,$(MODDIR)/%,$(CSRCS))
44@PACKAGE@CH:=$(patsubst %,$(MODDIR)/%,$(CHDRS))
45
46#Fortran sources
47@PACKAGE@FS:=$(patsubst %,$(MODDIR)/%,$(FSRCS))
48
49#c++ sources and header
50@PACKAGE@S:=$(patsubst %,$(MODDIR)/%,$(SRCS))
f347de98 51@PACKAGE@H:=$(patsubst %,$(MODDIR)/%,$(HDRS)) $(EHDRS)
52
53#############################################################################
54#
55# If special rootcint headerfiles is specified use them
56# else use all headers
f0a26826 57
f347de98 58ifndef CINTHDRS
59@PACKAGE@CINTHDRS:=$(@PACKAGE@H)
60else
61@PACKAGE@CINTHDRS:=$(CINTHDRS)
62endif
63#############################################################################
f0a26826 64
65# Package Dictionary
66
67@PACKAGE@DH:=$(MODDIR)/$(DHDR)
68
69
70#All objects
71@PACKAGE@CO:=$(patsubst %,$(MODDIRO)/%, $(CSRCS:.c=.o))
72TEMP:=$(FSRCS:.F=.o)
73@PACKAGE@FO:=$(patsubst %,$(MODDIRO)/%, $(TEMP:.f=.o))
74@PACKAGE@O:= $(patsubst %,$(MODDIRO)/%, $(SRCS:.cxx=.o)) $(@PACKAGE@FO) $(@PACKAGE@CO)
75
76ifdef WITHDICT
77 @PACKAGE@DS:=$(MODDIRO)/G__@PACKAGE@.cxx
78 @PACKAGE@DO:=$(MODDIRO)/G__@PACKAGE@.o
79 @PACKAGE@DDEP:=$(@PACKAGE@DO:.o=.d)
80 @PACKAGE@DEP:=$(@PACKAGE@O:.o=.d) $(@PACKAGE@DDEP)
81else
82 @PACKAGE@DS:=
83 @PACKAGE@DO:=
84 @PACKAGE@DDEP:=
85 @PACKAGE@DEP:=$(@PACKAGE@O:.o=.d)
86endif
87
88
89#The actual library file
90
91@PACKAGE@LIB:=$(LIBPATH)/lib@PACKAGE@.$(SOEXT)
92
93#The actual binary file
94
95@PACKAGE@BIN:=$(BINPATH)/@PACKAGE@
96
97
f347de98 98# Use in the main Makefile
f0a26826 99
100ifeq ($(TYPE),lib)
101ALLLIBS += $(@PACKAGE@LIB)
102BINLIBS += -l@PACKAGE@
103else
104ALLEXECS += $(@PACKAGE@BIN)
105endif
106
107# include all dependency files
108INCLUDEFILES +=$(@PACKAGE@DEP)
109
f347de98 110EXPORTFILES += $(@PACKAGE@EXPORTDEST)
f0a26826 111
112#local rules
113
f347de98 114#The exportfiles only include if any!!
115
116ifdef @PACKAGE@EXPORT
896cb507 117#$(@PACKAGE@EXPORTDEST): $(patsubst %,@MODULE@/%,$(@PACKAGE@EXPORT))
118
119$(@PACKAGE@EXPORTDEST): $(EXPORTDIR)/%.h: @MODULE@/%.h
ca816b72 120 @echo "***** Copying file @MODULE@/$(notdir $@) to $@ *****"
f347de98 121 @[ -d $(dir $@) ] || mkdir $(dir $@)
896cb507 122 @cp @MODULE@/$(notdir $@) $@
f347de98 123endif
124
f0a26826 125$(@PACKAGE@LIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
126 @echo "***** Linking library $@ *****"
a544e979 127 $(SHLD) $(SOFLAGS) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) -o $@ $(@PACKAGE@O) $(@PACKAGE@DO) $(SHLIB)
f347de98 128
f0a26826 129$(@PACKAGE@BIN):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
130 @echo "***** Makeing executable $@ *****"
f347de98 131 $(LD) $(LDFLAGS) $(@PACKAGE@O) $(@PACKAGE@DO) $(BINLIBDIRS) $(LIBS) $(@PACKAGE@ELIBS) $(EXEFLAGS) -o $@
f0a26826 132
f347de98 133$(@PACKAGE@DS): $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH)
f0a26826 134 @echo "***** Creating $@ *****";
135 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
f347de98 136 rootcint -f $@ -c $(CINTFLAGS) $(@PACKAGE@INC) $^
f0a26826 137
138$(@PACKAGE@DO): $(@PACKAGE@DS)
139 @echo "***** (Re)compiling $< *****";
f347de98 140 $(CXX) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CXXFLAGS)
f0a26826 141
142#Different targets for the module
143
144all-@PACKAGE@: $(@PACKAGE@LIB)
145
f0a26826 146depend-@PACKAGE@: $(@PACKAGE@DEP)
147
148# determination of object files
149$(MODDIRO)/%.o: $(MODDIR)/%.cxx $(MODDIRO)/%.d
150 @echo "***** (Re)compiling $< *****";
151 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
f347de98 152 $(CXX) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CXXFLAGS)
f0a26826 153
154$(MODDIRO)/%.o: $(MODDIR)/%.F $(MODDIRO)/%.d
155 @echo "***** (Re)compiling $< *****";
156 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
157 $(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS)
158
159$(MODDIRO)/%.o: $(MODDIR)/%.f $(MODDIRO)/%.d
160 @echo "***** (Re)compiling $< *****";
161 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
162 $(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS)
163
164$(MODDIRO)/%.o: $(MODDIR)/%.c $(MODDIRO)/%.d
165 @echo "***** (Re)compiling $< *****";
166 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
f347de98 167 $(CC) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CFLAGS)
f0a26826 168
169$(@PACKAGE@DDEP): $(@PACKAGE@DS)
170 @echo "***** Making dependencies for $< *****";
171 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
172 @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
173
896cb507 174$(MODDIRO)/%.d: $(MODDIRS)/%.cxx
f0a26826 175 @echo "***** Making dependencies for $< *****";
176 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
896cb507 177 @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
178$(MODDIRO)/%.d: $(MODDIRS)/%.f
f0a26826 179 @echo "***** Making dependencies for $< *****";
180 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
896cb507 181 @share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
182$(MODDIRO)/%.d: $(MODDIRS)/%.F
f0a26826 183 @echo "***** Making dependencies for $< *****";
184 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
f347de98 185 share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
896cb507 186$(MODDIRO)/%.d: $(MODDIRS)/%.c
f0a26826 187 @echo "***** Making dependencies for $< *****";
188 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
896cb507 189 @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
f0a26826 190
191
192#Directory creation
193
194#$(MODDIRO):
195# @echo "***** Making $@ *****"
196# mkdir -p $@
197
198
199
200
201
202
203
204
205
206
207