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