]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - build/module.tpl
Force remove shared lib
[u/mrichter/AliRoot.git] / build / module.tpl
index 5aebb6b01e9b658820cf19c2cc7f9821286cf445..589c5346b418dda8204e53a04e6d6d6da0677ee1 100644 (file)
@@ -1,4 +1,5 @@
 
+
 ifndef PACKFFLAGS
 @PACKAGE@FFLAGS:=$(FFLAGS)
 else
@@ -24,8 +25,17 @@ else
 WITHDICT=
 endif
 
-#Extra include,libs etc.
-@PACKAGE@INC:=$(patsubst %,-I$(MODDIR)/%,$(EINCLUDE))
+# Headerfiles exported to common place:
+@PACKAGE@EXPORT:=$(EXPORT)
+@PACKAGE@EXPORTDEST:=$(patsubst %,$(EXPORTDIR)/%,$(EXPORT))
+
+
+#Extra include,libs, defines etc.
+
+@PACKAGE@DEFINE:=$(EDEFINE)
+
+@PACKAGE@INC:=$(patsubst %,-I%,$(EINCLUDE)) -I@MODULE@
+
 @PACKAGE@ELIBS:=$(patsubst %,-l%,$(ELIBS))
 @PACKAGE@ELIBSDIR:=$(patsubst %,-L%,$(ELIBSDIR))
 
@@ -39,8 +49,19 @@ endif
 
 #c++ sources and header
 @PACKAGE@S:=$(patsubst %,$(MODDIR)/%,$(SRCS))
-@PACKAGE@H:=$(patsubst %,$(MODDIR)/%,$(HDRS))
+@PACKAGE@H:=$(patsubst %,$(MODDIR)/%,$(HDRS)) $(EHDRS)
 
+#############################################################################
+#
+#            If special rootcint headerfiles is specified use them
+#                         else use all headers
+
+ifndef CINTHDRS
+@PACKAGE@CINTHDRS:=$(@PACKAGE@H) 
+else
+@PACKAGE@CINTHDRS:=$(CINTHDRS)
+endif
+#############################################################################
 
 # Package Dictionary 
 
@@ -53,6 +74,8 @@ TEMP:=$(FSRCS:.F=.o)
 @PACKAGE@FO:=$(patsubst %,$(MODDIRO)/%, $(TEMP:.f=.o))
 @PACKAGE@O:= $(patsubst %,$(MODDIRO)/%, $(SRCS:.cxx=.o)) $(@PACKAGE@FO) $(@PACKAGE@CO)
 
+
+
 ifdef WITHDICT
   @PACKAGE@DS:=$(MODDIRO)/G__@PACKAGE@.cxx
   @PACKAGE@DO:=$(MODDIRO)/G__@PACKAGE@.o
@@ -70,12 +93,17 @@ endif
 
 @PACKAGE@LIB:=$(LIBPATH)/lib@PACKAGE@.$(SOEXT)
 
+#Add this to the modules libs
+@MODULE@LIBS += $(@PACKAGE@LIB)
+
 #The actual binary file
 
 @PACKAGE@BIN:=$(BINPATH)/@PACKAGE@
 
+#Add to modules list of binaries
+@MODULE@BINS += $(@PACKAGE@BIN)
 
-# for using in the main Makefile
+# Use in the main Makefile
 
 ifeq ($(TYPE),lib)
 ALLLIBS += $(@PACKAGE@LIB)
@@ -87,90 +115,124 @@ endif
 # include all dependency files
 INCLUDEFILES +=$(@PACKAGE@DEP)
 
+EXPORTFILES += $(@PACKAGE@EXPORTDEST)
 
 #local rules
 
+#The exportfiles only include if any!!
+
+ifdef @PACKAGE@EXPORT
+#$(@PACKAGE@EXPORTDEST): $(patsubst %,@MODULE@/%,$(@PACKAGE@EXPORT))
+
+$(@PACKAGE@EXPORTDEST): $(EXPORTDIR)/%.h: @MODULE@/%.h
+ifndef ALIQUIET
+         @echo "***** Copying file $^ to $@ *****"
+endif
+         @[ -d $(dir $@) ] || mkdir $(dir $@)
+         @cp $^ $@     
+endif
+
 $(@PACKAGE@LIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
+ifndef ALIQUIET
          @echo "***** Linking library $@ *****"
-         $(SHLD) $(SOFLAGS) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(SHLIB)  -o $@ $(@PACKAGE@O) $(@PACKAGE@DO)
-         
+endif
+         $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \
+         export TMPDIR; mkdir $$TMPDIR ; cd $$TMPDIR ; \
+         find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\
+      rm -f $@ ;\
+         $(SHLD) $(SOFLAGS) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) -o $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(SHLIB) ;\
+      cd $(CURDIR) ; rm -rf $$TMPDIR
+         $(MUTE)chmod a-w $@
 $(@PACKAGE@BIN):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
-         @echo "***** Makeing executable $@ *****"
-         $(LD) $(LDFLAGS) $(@PACKAGE@O) $(@PACKAGE@DO) $(BINLIBDIRS)  $(LIBS) $(@PACKAGE@ELIBS) $(EXEFLAGS) -o $@ 
+ifndef ALIQUIET
+         @echo "***** Making executable $@ *****"
+endif
+         $(MUTE)$(LD) $(LDFLAGS) $(@PACKAGE@O) $(@PACKAGE@DO) $(BINLIBDIRS) $(LIBS) $(@PACKAGE@ELIBS) $(EXEFLAGS) -o $@ 
 
-$(@PACKAGE@DS): $(@PACKAGE@H) $(@PACKAGE@DH)
+$(@PACKAGE@DS): $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH) @MODULE@/module.mk
+ifndef ALIQUIET
         @echo "***** Creating $@ *****";       
+endif
         @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
-        @rootcint -f $@ -c $(CINTFLAGS) $^
+        $(MUTE)rootcint -f $@ -c $(@PACKAGE@DEFINE) $(CINTFLAGS) $(@PACKAGE@INC) $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH) 
 
 $(@PACKAGE@DO): $(@PACKAGE@DS)
-               @echo "***** (Re)compiling $< *****";
-               @$(CXX) -c $< -o $@ $(CXXFLAGS)
+ifndef ALIQUIET
+               @echo "***** Compiling $< *****";
+endif
+               $(MUTE)$(CXX) -c $(@PACKAGE@INC)  -I$(ALICE_ROOT) $< -o $@ $(@PACKAGE@CXXFLAGS)
 
 #Different targets for the module
 
 all-@PACKAGE@: $(@PACKAGE@LIB)
 
-
 depend-@PACKAGE@: $(@PACKAGE@DEP)
 
 # determination of object files
+$(MODDIRO)/%.o: $(MODDIRO)/%.cxx $(MODDIRO)/%.d 
+ifndef ALIQUIET
+       @echo "***** Compiling $< *****";
+endif
+       @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
+       $(MUTE)$(CXX) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC)   $< -o $@ $(@PACKAGE@CXXFLAGS)
+
 $(MODDIRO)/%.o: $(MODDIR)/%.cxx $(MODDIRO)/%.d 
-       @echo "***** (Re)compiling $< *****";
+ifndef ALIQUIET
+       @echo "***** Compiling $< *****";
+endif
        @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
-       $(CXX) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CXXFLAGS)
+       $(MUTE)$(CXX) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC)   $< -o $@ $(@PACKAGE@CXXFLAGS)
 
 $(MODDIRO)/%.o: $(MODDIR)/%.F $(MODDIRO)/%.d 
-       @echo "***** (Re)compiling $< *****";
+ifndef ALIQUIET
+       @echo "***** Compiling $< *****";
+endif
        @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
-       $(F77) -c $(@PACKAGE@INC)  $< -o $@ $(@PACKAGE@FFLAGS)
+       $(MUTE)$(F77) -c $(@PACKAGE@INC)  $< -o $@ $(@PACKAGE@FFLAGS)
 
 $(MODDIRO)/%.o: $(MODDIR)/%.f $(MODDIRO)/%.d 
-       @echo "***** (Re)compiling $< *****";
+ifndef ALIQUIET
+       @echo "***** Compiling $< *****";
+endif
        @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
-       $(F77) -c $(@PACKAGE@INC)  $< -o $@ $(@PACKAGE@FFLAGS)
+       $(MUTE)$(F77) -c $(@PACKAGE@INC)  $< -o $@ $(@PACKAGE@FFLAGS)
 
 $(MODDIRO)/%.o: $(MODDIR)/%.c $(MODDIRO)/%.d 
-       @echo "***** (Re)compiling $< *****";
+ifndef ALIQUIET
+       @echo "***** Compiling $< *****";
+endif
        @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
-       $(CC) -c $< -o $@ $(@PACKAGE@INC)  $(@PACKAGE@CFLAGS)
+       $(MUTE)$(CC) $(@PACKAGE@DEFINE) -c  $(@PACKAGE@INC)  $< -o $@   $(@PACKAGE@CFLAGS)
 
 $(@PACKAGE@DDEP): $(@PACKAGE@DS)
+ifndef ALIQUIET
                @echo "***** Making dependencies for $< *****";
+endif
                @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
                @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC)  $<" > $@
 
 $(MODDIRO)/%.d: $(MODDIRS)/%.cxx
+ifndef ALIQUIET
                @echo "***** Making dependencies for $< *****";
+endif
                @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
-               @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC)  $<" > $@
+               @share/alibtool depend "$(@PACKAGE@DEFINE) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC)  $<" > $@
 $(MODDIRO)/%.d: $(MODDIRS)/%.f
+ifndef ALIQUIET
                @echo "***** Making dependencies for $< *****";
+endif
                @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
                @share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC)  $<" > $@
-$(MODDIRO)/%.d: $(MODDIRS)/%.F 
+$(MODDIRO)/%.d: $(MODDIRS)/%.F
+ifndef ALIQUIET
                @echo "***** Making dependencies for $< *****";
+endif
                @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
-               @share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC)  $<" > $@
-$(MODDIRO)/%.d: $(MODDIRS)/%.c 
+               $(MUTE)share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC)  $<" > $@
+$(MODDIRO)/%.d: $(MODDIRS)/%.c
+ifndef ALIQUIET
                @echo "***** Making dependencies for $< *****";
+endif
                @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
-               @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
-
-
-#Directory creation
-
-#$(MODDIRO):
-#      @echo "***** Making $@ *****"
-#      mkdir -p $@
-   
-
-
-
-
-
-
-
-
-
-
+               @share/alibtool depend "$(@PACKAGE@DEFINE) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@