corrections for HP-UX (find usage)
[u/mrichter/AliRoot.git] / AliGeant4 / config / make_source.pl
CommitLineData
0f507a31 1#!/usr/local/bin/perl
2# $Id$
3# by I. Hrivnacova, 22.6. 2000
4#
5# This script creates source directory structured
6# according subcategories with links to the flat
7# source structure.
8
9# main categories (packages)
10@DIRLIST = "TGeant4";
11@DIRLIST = (@DIRLIST,"AliGeant4");
12
13# subcategories
14@CATLIST = "global";
15@CATLIST = (@CATLIST,"geometry");
16@CATLIST = (@CATLIST,"physics");
17@CATLIST = (@CATLIST,"event");
18@CATLIST = (@CATLIST,"run");
19@CATLIST = (@CATLIST,"visualization");
20
21# create source dir structure
22for( $i = 0 ; $i < $#DIRLIST+1 ; $i++ ) {
23 $DIR = @DIRLIST[$i];
24 $NAME = @NAMELIST[$i];
25 $DIRPATH = $ENV{'AG4_INSTALL'} . "/../" . $DIR;
26 chdir $DIRPATH;
27 if (! grep(/source/, `ls`)) {
28 `mkdir source ` ;
29 foreach $CAT (@CATLIST) {
30 $CATDIRPATH = "source" . "/" . $CAT;
31 $INCLUDEPATH = $CATDIRPATH . "/" . "include";
32 $SRCPATH = $CATDIRPATH . "/" . "src";
33 `mkdir $CATDIRPATH` ;
34 `mkdir $INCLUDEPATH` ;
35 `mkdir $SRCPATH` ;
36 }
37 print $DIR . "/source directory has been created." . "\n";
38 }
39}
40
41# link source files
42for( $i = 0 ; $i < $#DIRLIST+1 ; $i++ ) {
43 $DIR = @DIRLIST[$i];
44 $NAME = @NAMELIST[$i];
45 $DIRPATH = $ENV{'AG4_INSTALL'} . "/../" . $DIR;
46 $RELDIRPATH = "../../..";
47
48 foreach $CAT (@CATLIST) {
49 chdir $DIRPATH;
50
51 $CATSTRING = "\"Category: " . $CAT . "\"";
c429ee7b 52 @FILELIST_H = `find . -name \"*.h\" -exec grep -l $CATSTRING {} \\;`;
53 @FILELIST_ICC = `find . -name \"*.icc\" -exec grep -l $CATSTRING {} \\;`;
54 @FILELIST_CXX = `find . -name \"*.cxx\" -exec grep -l $CATSTRING {} \\;`;
0f507a31 55
56 print "Processing category: " . $CAT . "\n";
57 $CATDIRPATH = "source" . "/" . $CAT;
58 $INCLUDEPATH = $CATDIRPATH . "/" . "include";
59 $SRCPATH = $CATDIRPATH . "/" . "src";
60 $CVSBASE = $DIRPATH . "/CVS";
61
62 chdir $DIRPATH . "/" . $INCLUDEPATH;
63 `ln -s $CVSBASE "CVS" `;
64 foreach $FILEPATH (@FILELIST_H) {
65 @TEMP = split('/',$FILEPATH);
66 $FILE = @TEMP[@TEMP - 1];
67 chop $FILE;
68 print " Linking file " . $FILE . "\n";
69 $FILEBASE = $RELDIRPATH . "/" . $FILE;
70 `ln -s $FILEBASE $FILE`;
71 }
72
73 foreach $FILEPATH (@FILELIST_ICC) {
74 @TEMP = split('/',$FILEPATH);
75 $FILE = @TEMP[@TEMP - 1];
76 chop $FILE;
77 print " Linking file " . $FILE . "\n";
78 $FILEBASE = $RELDIRPATH . "/" . $FILE;
79 `ln -s $FILEBASE $FILE`;
80 }
81
82 chdir $DIRPATH . "/" . $SRCPATH;
83 `ln -s $CVSBASE "CVS" `;
84 foreach $FILEPATH (@FILELIST_CXX) {
85 @TEMP = split('/',$FILEPATH);
86 $FILE = @TEMP[@TEMP - 1];
87 chop $FILE;
c429ee7b 88 print " Linking file " . $FILE . "\n";
0f507a31 89 $FILEBASE = $RELDIRPATH . "/" . $FILE;
90 `ln -s $FILEBASE $FILE`;
91 }
92 }
93}