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