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