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