]> git.uio.no Git - u/mrichter/AliRoot.git/blame - share/alibtool
replace abs() and fabs() by TMath::Abs().
[u/mrichter/AliRoot.git] / share / alibtool
CommitLineData
50d05f91 1#!/bin/sh
88cb7938 2
3# $Id$
4
50d05f91 5#############################################################################
6# alibtool - a shell script to help makeing modules for AliRoot Makefile
7#############################################################################
8#
9# modification history
10# $Log$
fca451e0 11# Revision 1.7 2003/11/10 15:02:38 rdm
12# re-direct warnings of rmkdepend about not found system include files
13# to /dev/null. Only generate dependencies on ROOT and AliRoot, not on
14# system or compiler specific files.
15#
08d48be9 16# Revision 1.6 2003/07/13 09:26:14 hristov
17# Transition to NewIO
18#
88cb7938 19# Revision 1.5 2003/05/02 15:11:52 hristov
20# Changes to avoid warnings (I.Hrivnacova)
21#
df52615e 22# Revision 1.4 2002/10/14 14:57:45 hristov
23# Merging the VirtualMC branch to the main development branch (HEAD)
24#
b9d0a01d 25# Revision 1.3.6.1 2002/07/09 12:24:49 alibrary
26# Corrections for new MC
27#
28# Revision 1.3 2002/02/22 07:57:35 alibrary
29# Reduce verbose output
30#
15142e2f 31# Revision 1.2 2001/11/14 17:52:48 hristov
32# Updated version of the flat makefiles (J.-E.Revsbech)
33#
d47d6108 34# Revision 1.1 2001/10/09 13:45:57 hristov
35# alibtool is added
36#
50d05f91 37#
38# SYNOPSIS
39# alirun <command> <commandparameters>
40#
41# command must be one of the following:
42#
43# mkmodule
44# depend
45# dependF
46#
47#
48# DESCRIPTION
49#
fca451e0 50# This scipts is called with a primary command and a command parameter.
51# It generates output on stdout, so normally it is called with a redirection,
52# like:
50d05f91 53#
08d48be9 54# alibtool mkmodule STEER > STEER/module.mk
50d05f91 55#
fca451e0 56# The command is one of the following:
50d05f91 57#
58# depend
fca451e0 59# Makes the dependencies for the file specified as second argument
60# (for c and cxx files)
50d05f91 61#
62# dependF
fca451e0 63# Makes the dependencies for the file specified as second argument
64# (for fortran files)
50d05f91 65#
08d48be9 66# mkmodule
fca451e0 67# Creates the module.mk for the the given directory specified as
68# the second argument
69#
70# MKMODULE
71#
72# When alibtool is called with the mkmodule command it searches the directory
73# given as the second argument for files called *.pkg. If a file (possibly
74# several) is found, it will create a file called module.mk based on these
75# files. For example if running alibtool mkmodule STEER, it will search the
76# STEER directory and create STEER/module.mk based on all .pkg files is
77# STEER directory. If a file called libSTEER.pkg is found, then module.mk
78# will have a section devoted to makeing library libSTEER.so with alle the
79# sourcefiles specified in libSTEER.pkg. If a file called binSTEER.pkg is
80# found the module.mk file will create an executable called STEER. Several
81# *.pkg files can be placed in the same directory. The module.mk files is
82# created on background of build/header.tpl and build/module.mk by variable
83# substituion of variables @MODULE@ @PACKAGE@ and @TYPE@.
50d05f91 84#
85# PKG FILES
86#
87#
fca451e0 88# The syntax for the pkg file is very simple. You specify the sources, headers
89# and possibly extra include or link options. The *.pkg files is just
90# inserted "as is" in the module.mk file, so normal Makefile syntax can
91# be used. These variables can be specified: SRCS, FSRCS, CSRCS, HDRS, CHDRS,
92# DHDR, EINCLUDE, ELIBS, ELIBSDIR, PACKFFLAGS, PACKCFLAGS, PACKCXXFLAGS.
93# The first five is just the C++ sources, fortran sources, C sources,
94# C++ headers and C headers. DHDR is the dictionary header and is the
95# LinkDef file. EINCLUDE, ELIBS and ELIBSDIR is extra includedirs,
96# libraries and library search paths. If for example a binary is to be
97# linked against the variable ELIBSDIR would be set to lib/tgt_$ALICE_TARGET.
98# Notice that -L and -l is not needed. If the PACKFFLAGS, PACKCFLAGS or
99# PACKCXXFLAGS is not set it will be set to the default options (set in
100# config/Makefile.$ALICE_TARGET. For example on Linux GEANT321 has to be
101# compiled without -O options, so a line like
102# PACKFFLAGS := $(filter-out -O%,$(FFLAGS))
103# is needed.
50d05f91 104#
105#
106# DEPEND
107#
fca451e0 108# If alibtool is called with the depend command it will generate a dependecy
109# file for the sourcefile given as second argument. This only goes for C++
110# and C files. If dependencies for fortran-fiels is needed, call alibtool
111# with command dependF. The dependencies are made with rmkdepend.
50d05f91 112#
113#
114# DEPENDF
115#
116# The same as depend, but for fortran files.
117#
118#C<
119###########################################################################
120
121
122MkDepend()
123{
08d48be9 124rmkdepend -f- -Y -w 3000 -- $* 2>/dev/null | sed -e "s@^\(.*\)\/\(.*\)\.o:@\1\/tgt_${ALICE_TARGET}\/\2.d \1\/tgt_${ALICE_TARGET}/\\2.o:@" -e 's@^#.*$@@' -e '/^$/d'
50d05f91 125}
126MkDependF()
127{
08d48be9 128rmkdepend -f- -Y -w 3000 -- $* 2>/dev/null | sed -e "s@^\(.*\)\/\(.*\)\.o:@\1\/tgt_${ALICE_TARGET}\/\2.d \1\/tgt_${ALICE_TARGET}/\\2.o:@" -e 's@^#.*$@@' -e '/^$/d'
50d05f91 129}
130
131MkModule()
132{
133module=$1
134#This one gets all the library pkg files
135tempo=`find ${module} -name "lib*.pkg" | sed -e "sQ${module}/libQQ" -e "sQ\.pkgQQ"`
136
137echo "#**************************************************************************";
138echo "#**** This file is automatically generated from the mkmodules script *****";
139echo "#**** DO NOT EDIT!! *****";
140echo "#**************************************************************************";
d47d6108 141
50d05f91 142for i in $tempo; do
143 package=$i;
144 type=lib;
145 MkModuleLib $package
146done;
147
148#This one gets all the binary(executable) pkg files
149tempo=`find ${module} -name "bin*.pkg" | sed -e "sQ${module}/binQQ" -e "sQ\.pkgQQ"`
150
151for i in $tempo; do
152 package=$i;
153 type=bin;
154 MkModuleLib $package
155done;
156
d47d6108 157#Now make general bottom for every module (Clean and so on)
158 cat build/clean.tpl | sed -e "sQ\@MODULE@Q${module}Qg"
50d05f91 159}
160
161MkModuleLib()
162{
163 file=$module/$type$i.pkg
164 cat build/header.tpl | sed -e "sQ\@MODULE@Q${module}Qg" -e "sQ@PACKAGE@Q${package}Qg" -e "sQ\@TYPE@Q${type}Qg"
165 echo;
166 cat $file;
167 echo;
168 cat build/module.tpl | sed -e "sQ\@MODULE@Q${module}Qg" -e "sQ@PACKAGE@Q${package}Qg" -e "sQ\@TYPE@Q${type}Qg"
169
170}
171
172case $1 in
173depend)
174 MkDepend $2
175 ;;
176dependF)
177 MkDependF $2
178 ;;
179mkmodule)
180 MkModule $2
181 ;;
182esac;