Updated version of the non-recursive Makefiles. See doc/README.FlatMakefile and build...
[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
117$(@PACKAGE@EXPORTDEST): $(patsubst %,@MODULE@/%,$(@PACKAGE@EXPORT))
118 @echo "***** Copying file @MODULE@/$(notdir $@) to $@ WRONG !!!*****"
119 @[ -d $(dir $@) ] || mkdir $(dir $@)
120 cp @MODULE@/$(notdir $@) $@
121endif
122
f0a26826 123$(@PACKAGE@LIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
124 @echo "***** Linking library $@ *****"
125 $(SHLD) $(SOFLAGS) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(SHLIB) -o $@ $(@PACKAGE@O) $(@PACKAGE@DO)
f347de98 126
f0a26826 127$(@PACKAGE@BIN):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
128 @echo "***** Makeing executable $@ *****"
f347de98 129 $(LD) $(LDFLAGS) $(@PACKAGE@O) $(@PACKAGE@DO) $(BINLIBDIRS) $(LIBS) $(@PACKAGE@ELIBS) $(EXEFLAGS) -o $@
f0a26826 130
f347de98 131$(@PACKAGE@DS): $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH)
f0a26826 132 @echo "***** Creating $@ *****";
133 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
f347de98 134 rootcint -f $@ -c $(CINTFLAGS) $(@PACKAGE@INC) $^
f0a26826 135
136$(@PACKAGE@DO): $(@PACKAGE@DS)
137 @echo "***** (Re)compiling $< *****";
f347de98 138 $(CXX) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CXXFLAGS)
f0a26826 139
140#Different targets for the module
141
142all-@PACKAGE@: $(@PACKAGE@LIB)
143
144
145depend-@PACKAGE@: $(@PACKAGE@DEP)
146
147# determination of object files
148$(MODDIRO)/%.o: $(MODDIR)/%.cxx $(MODDIRO)/%.d
149 @echo "***** (Re)compiling $< *****";
150 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
f347de98 151 $(CXX) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CXXFLAGS)
f0a26826 152
153$(MODDIRO)/%.o: $(MODDIR)/%.F $(MODDIRO)/%.d
154 @echo "***** (Re)compiling $< *****";
155 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
156 $(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS)
157
158$(MODDIRO)/%.o: $(MODDIR)/%.f $(MODDIRO)/%.d
159 @echo "***** (Re)compiling $< *****";
160 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
161 $(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS)
162
163$(MODDIRO)/%.o: $(MODDIR)/%.c $(MODDIRO)/%.d
164 @echo "***** (Re)compiling $< *****";
165 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
f347de98 166 $(CC) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CFLAGS)
f0a26826 167
168$(@PACKAGE@DDEP): $(@PACKAGE@DS)
169 @echo "***** Making dependencies for $< *****";
170 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
171 @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
172
f347de98 173$(MODDIRO)/%.d: $(MODDIRS)/%.cxx $(EXPORTFILES)
f0a26826 174 @echo "***** Making dependencies for $< *****";
175 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
f347de98 176 share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
177$(MODDIRO)/%.d: $(MODDIRS)/%.f $(EXPORTFILES)
f0a26826 178 @echo "***** Making dependencies for $< *****";
179 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
f347de98 180 share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
181$(MODDIRO)/%.d: $(MODDIRS)/%.F $(EXPORTFILES)
f0a26826 182 @echo "***** Making dependencies for $< *****";
183 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
f347de98 184 share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
185$(MODDIRO)/%.d: $(MODDIRS)/%.c $(EXPORTFILES)
f0a26826 186 @echo "***** Making dependencies for $< *****";
187 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
f347de98 188 share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
f0a26826 189
190
191#Directory creation
192
193#$(MODDIRO):
194# @echo "***** Making $@ *****"
195# mkdir -p $@
196
197
198
199
200
201
202
203
204
205
206