]> git.uio.no Git - u/mrichter/AliRoot.git/blob - share/alibtool
Functions renamed to get a prefix PHOS
[u/mrichter/AliRoot.git] / share / alibtool
1 #!/bin/sh
2 #############################################################################
3 # alibtool - a shell script to help makeing modules for AliRoot Makefile
4 #############################################################################
5 #
6 # modification history
7 # $Log$
8 # Revision 1.2  2001/11/14 17:52:48  hristov
9 # Updated version of the flat makefiles (J.-E.Revsbech)
10 #
11 # Revision 1.1  2001/10/09 13:45:57  hristov
12 # alibtool is added
13 #
14 #
15 # SYNOPSIS
16 # alirun <command> <commandparameters>
17 #
18 # command must be one of the following:
19 #
20 #         mkmodule
21 #         depend
22 #         dependF
23 #
24 #
25 # DESCRIPTION
26 #
27 # This scipts is called with a primary command and a commandparameter. It generates output on stdout, so normally it is called with a redirection like
28 #
29 #   alibtool mkmoudle STEER > STEER/module.mk
30 #
31 # The command is one of the following
32 #
33 # depend
34 #        Makes the dependencies for the file specified as second argument (c and cxx files)
35 #
36 # dependF
37 #        Makes the dependencies for the file specified as second argument (fortran files)
38 #
39 # mkmoudle
40 #        Creates the module.mk for the the given directory specified as the second argument.
41 #
42 # MKMOUDLE
43 #
44 # When alibtool is called with the mkmodule command it searches the directory given as the second argument for files called *.pkg. If a file (possibly several) is found, it will create a file called module.mk based on these files. For example if running alibtool mkmodule STEER, it will search the STEER directory and create STEER/module.mk based on all .pkg files is STEER directory. If a file called libSTEER.pkg is found, then module.mk will have a section devoted to makeing library libSTEER.so with alle the sourcefiles specified in libSTEER.pkg. If a file called binSTEER.pkg is found the module.mk file will create an executable called STEER. Several *.pkg files can be placed in the same directory. The module.mk files is created on background of build/header.tpl and build/module.mk by variable substituion of variables @MODULE@ @PACKAGE@ and @TYPE@.
45 #
46 # PKG FILES
47 #
48 #
49 # The syntax for the pkg file is very simple. You specify the sources, headers and possibly extra include or link options. The *.pkg files is just inserted "as is" in the module.mk file, so normal Makefile syntax can be used. These variables can be specified: SRCS, FSRCS, CSRCS, HDRS, CHDRS, DHDR, EINCLUDE, ELIBS, ELIBSDIR, PACKFFLAGS, PACKCFLAGS, PACKCXXFLAGS. The first five is just the c++ sources, fortran sources, c sources, c++ headers and c headers. DHDR is the dictionary header and is the LinkDef file. EINCLUDE, ELIBS and ELIBSDIR is extra includedirs, libraries and library search paths. If for example a binary is to be linked against $ALICE_ROOT/lib/tgt_$ALICE_TARGET/libminicern.so the variable ELIBSDIR would be set to lib/tgt_$ALICE_TARGET and ELIBS = minicern. Notice that -L and -l is not needed. If the PACKFFLAGS, PACKCFLAGS or PACKCXXFLAGS is not set it will be set to the default options (Set in config/Makefile.$ALICE_TARGET. For example on Linux GEANT321 has to be compiled without -O options, so a line like PACKFFLAGS := $(filter-out -O%,$(FFLAGS)) is needed.
50 #
51 #
52 # DEPEND
53
54 # If alibtool is called with the depend command it will generate a dependecy file for the sourcefile given as second argument. This only goes for c++ and c files. If dependencies for fortran-fiels is needed, call alibtool with command dependF. The dependencies is made with rmkdepend.
55 #
56 #
57 # DEPENDF
58 #
59 # The same as depend, but for fortran files.
60 #
61 #C<
62 ###########################################################################
63  
64
65 MkDepend()
66 {
67 rmkdepend -f- -w 3000 -- -I$ROOTSYS/cint/include $* | sed -e "s@^\(.*\)\/\(.*\)\.o:@\1\/tgt_${ALICE_TARGET}\/\2.d \1\/tgt_${ALICE_TARGET}/\\2.o:@" -e 's@^#.*$@@' -e '/^$/d'
68 }
69 MkDependF()
70 {
71 rmkdepend -f- -Y -w 3000 -- $* | sed -e "s@^\(.*\)\/\(.*\)\.o:@\1\/tgt_${ALICE_TARGET}\/\2.d \1\/tgt_${ALICE_TARGET}/\\2.o:@" -e 's@^#.*$@@' -e '/^$/d'
72 }
73
74 MkModule()
75 {
76 module=$1
77 #This one gets all the library pkg files
78 tempo=`find ${module} -name "lib*.pkg"  | sed -e "sQ${module}/libQQ" -e "sQ\.pkgQQ"`
79
80 echo "#**************************************************************************";
81 echo "#**** This file is automatically generated from the mkmodules script  *****";
82 echo "#****          DO NOT EDIT!!                                          *****";
83 echo "#**************************************************************************";
84
85 for i in $tempo; do
86     package=$i;
87     type=lib;
88     MkModuleLib $package
89 done;
90
91 #This one gets all the binary(executable) pkg files
92 tempo=`find ${module} -name "bin*.pkg"  | sed -e "sQ${module}/binQQ" -e "sQ\.pkgQQ"`
93
94 for i in $tempo; do
95     package=$i;
96     type=bin;
97     MkModuleLib $package 
98 done;
99
100 #Now make general bottom for every module (Clean and so on)
101     cat build/clean.tpl | sed -e "sQ\@MODULE@Q${module}Qg"
102 }
103
104 MkModuleLib()
105 {
106     file=$module/$type$i.pkg
107     cat build/header.tpl | sed -e "sQ\@MODULE@Q${module}Qg"  -e "sQ@PACKAGE@Q${package}Qg" -e "sQ\@TYPE@Q${type}Qg"
108     echo;
109     cat $file;
110     echo;
111     cat build/module.tpl | sed -e "sQ\@MODULE@Q${module}Qg"  -e "sQ@PACKAGE@Q${package}Qg" -e "sQ\@TYPE@Q${type}Qg"
112
113 }
114
115 case $1 in
116 depend)
117     MkDepend $2
118     ;;
119 dependF)
120     MkDependF $2
121     ;;
122 mkmodule)
123     MkModule $2
124     ;;
125 esac;
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143