]> git.uio.no Git - u/mrichter/AliRoot.git/blob - share/alibtool
Changes to avoid warnings (I.Hrivnacova)
[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.4  2002/10/14 14:57:45  hristov
9 # Merging the VirtualMC branch to the main development branch (HEAD)
10 #
11 # Revision 1.3.6.1  2002/07/09 12:24:49  alibrary
12 # Corrections for new MC
13 #
14 # Revision 1.3  2002/02/22 07:57:35  alibrary
15 # Reduce verbose output
16 #
17 # Revision 1.2  2001/11/14 17:52:48  hristov
18 # Updated version of the flat makefiles (J.-E.Revsbech)
19 #
20 # Revision 1.1  2001/10/09 13:45:57  hristov
21 # alibtool is added
22 #
23 #
24 # SYNOPSIS
25 # alirun <command> <commandparameters>
26 #
27 # command must be one of the following:
28 #
29 #         mkmodule
30 #         depend
31 #         dependF
32 #
33 #
34 # DESCRIPTION
35 #
36 # 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
37 #
38 #   alibtool mkmoudle STEER > STEER/module.mk
39 #
40 # The command is one of the following
41 #
42 # depend
43 #        Makes the dependencies for the file specified as second argument (c and cxx files)
44 #
45 # dependF
46 #        Makes the dependencies for the file specified as second argument (fortran files)
47 #
48 # mkmoudle
49 #        Creates the module.mk for the the given directory specified as the second argument.
50 #
51 # MKMOUDLE
52 #
53 # 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@.
54 #
55 # PKG FILES
56 #
57 #
58 # 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 the variable ELIBSDIR would be set to lib/tgt_$ALICE_TARGET. 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.
59 #
60 #
61 # DEPEND
62
63 # 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.
64 #
65 #
66 # DEPENDF
67 #
68 # The same as depend, but for fortran files.
69 #
70 #C<
71 ###########################################################################
72  
73
74 MkDepend()
75 {
76 IPATH="-I$ROOTSYS/cint/include"
77 IPATH=$IPATH" -I/usr/include/g++-2"                   #Linux gcc 2.x
78 IPATH=$IPATH" -I/opt/SUNWspro/WS6U1/include/CC/Cstd"  #Sun CC5
79 IPATH=$IPATH" -I/usr/include/cxx"                     #DEC cxx
80 IPATH=$IPATH" -I/opt/aCC/include"                     #HP-UX aCC
81 rmkdepend -f- -w 3000 -- $IPATH $* | sed -e "s@^\(.*\)\/\(.*\)\.o:@\1\/tgt_${ALICE_TARGET}\/\2.d \1\/tgt_${ALICE_TARGET}/\\2.o:@" -e 's@^#.*$@@' -e '/^$/d'
82 }
83 MkDependF()
84 {
85 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'
86 }
87
88 MkModule()
89 {
90 module=$1
91 #This one gets all the library pkg files
92 tempo=`find ${module} -name "lib*.pkg"  | sed -e "sQ${module}/libQQ" -e "sQ\.pkgQQ"`
93
94 echo "#**************************************************************************";
95 echo "#**** This file is automatically generated from the mkmodules script  *****";
96 echo "#****          DO NOT EDIT!!                                          *****";
97 echo "#**************************************************************************";
98
99 for i in $tempo; do
100     package=$i;
101     type=lib;
102     MkModuleLib $package
103 done;
104
105 #This one gets all the binary(executable) pkg files
106 tempo=`find ${module} -name "bin*.pkg"  | sed -e "sQ${module}/binQQ" -e "sQ\.pkgQQ"`
107
108 for i in $tempo; do
109     package=$i;
110     type=bin;
111     MkModuleLib $package 
112 done;
113
114 #Now make general bottom for every module (Clean and so on)
115     cat build/clean.tpl | sed -e "sQ\@MODULE@Q${module}Qg"
116 }
117
118 MkModuleLib()
119 {
120     file=$module/$type$i.pkg
121     cat build/header.tpl | sed -e "sQ\@MODULE@Q${module}Qg"  -e "sQ@PACKAGE@Q${package}Qg" -e "sQ\@TYPE@Q${type}Qg"
122     echo;
123     cat $file;
124     echo;
125     cat build/module.tpl | sed -e "sQ\@MODULE@Q${module}Qg"  -e "sQ@PACKAGE@Q${package}Qg" -e "sQ\@TYPE@Q${type}Qg"
126
127 }
128
129 case $1 in
130 depend)
131     MkDepend $2
132     ;;
133 dependF)
134     MkDependF $2
135     ;;
136 mkmodule)
137     MkModule $2
138     ;;
139 esac;
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157