| 1 | #!/bin/csh
 | 
|---|
| 2 | # $Id: mkmflien,v 1.13 2003-09-17 12:19:26 cmv Exp $
 | 
|---|
| 3 | 
 | 
|---|
| 4 | # WARNING : mkmflien has to be runned FROM Mgr/
 | 
|---|
| 5 | # usage : mkmflien [-copy] [dir_dest]
 | 
|---|
| 6 | #  -copy : includes are copied (if not they are linked)
 | 
|---|
| 7 | #  -clean : after copy/link file are deleted if not existing (empty link)
 | 
|---|
| 8 | #  dir_dest : link/copy to dir_dest/
 | 
|---|
| 9 | #             default : $SOPHYADEVREP/Include
 | 
|---|
| 10 | 
 | 
|---|
| 11 | #######################
 | 
|---|
| 12 | #### Decodage arguments
 | 
|---|
| 13 | #######################
 | 
|---|
| 14 | unset dst
 | 
|---|
| 15 | set cpln = "ln -sf"
 | 
|---|
| 16 | unset clln
 | 
|---|
| 17 | if( $?SOPHYADEVREP ) then
 | 
|---|
| 18 |   set dst = $SOPHYADEVREP/Include
 | 
|---|
| 19 | endif
 | 
|---|
| 20 | 
 | 
|---|
| 21 | while( $#argv > 0 )
 | 
|---|
| 22 |   if( "$1" == "-copy" ) then
 | 
|---|
| 23 |     set cpln = "cp"
 | 
|---|
| 24 |   else if( "$1" == "-clean" ) then
 | 
|---|
| 25 |     set clln
 | 
|---|
| 26 |   else
 | 
|---|
| 27 |     set dst = $1
 | 
|---|
| 28 |   endif
 | 
|---|
| 29 |   shift
 | 
|---|
| 30 | end
 | 
|---|
| 31 | 
 | 
|---|
| 32 | if( ! $?dst ) then
 | 
|---|
| 33 |   echo "Variable SOPHYADEVREP must be set"
 | 
|---|
| 34 |   echo "OR you must give a directory for linking/copying"
 | 
|---|
| 35 |   exit -1
 | 
|---|
| 36 | endif
 | 
|---|
| 37 | 
 | 
|---|
| 38 | #############################################################
 | 
|---|
| 39 | #### repertoire contenant les liens a creer pour les includes
 | 
|---|
| 40 | #############################################################
 | 
|---|
| 41 | if ( ! -d $dst/ ) then
 | 
|---|
| 42 |   echo repertoire $dst inconnu
 | 
|---|
| 43 |   exit -1
 | 
|---|
| 44 | endif
 | 
|---|
| 45 | 
 | 
|---|
| 46 | #########################################################
 | 
|---|
| 47 | #### repertoire contenant les repertoires du code+include
 | 
|---|
| 48 | #########################################################
 | 
|---|
| 49 | pushd ../. > /dev/null
 | 
|---|
| 50 | set src = `pwd | sed 's?/tmp_mnt??'`
 | 
|---|
| 51 | set src = `echo $src | sed 's?/.automount/dapservfic/root??'`
 | 
|---|
| 52 | popd       > /dev/null
 | 
|---|
| 53 | 
 | 
|---|
| 54 | #########################################################
 | 
|---|
| 55 | ### Les includes a mettre dans Include pour les Makefiles
 | 
|---|
| 56 | #########################################################
 | 
|---|
| 57 | if( -d $src/Mgr ) then
 | 
|---|
| 58 |   cd $src/Mgr/.
 | 
|---|
| 59 |   echo $cpln from Mgr
 | 
|---|
| 60 |   set FILE = ( Makefile.h Makefile.slb MakefileUser.h )
 | 
|---|
| 61 |   pushd $dst/. > /dev/null
 | 
|---|
| 62 |   rm -f $FILE
 | 
|---|
| 63 |   foreach f ( $FILE )
 | 
|---|
| 64 |     if( -e $src/Mgr/$f ) then
 | 
|---|
| 65 |       $cpln $src/Mgr/$f ./
 | 
|---|
| 66 |     endif
 | 
|---|
| 67 |   end
 | 
|---|
| 68 |   popd       > /dev/null
 | 
|---|
| 69 | endif
 | 
|---|
| 70 | 
 | 
|---|
| 71 | #############################################
 | 
|---|
| 72 | ####  Les includes de Blitz++ lien ds Include
 | 
|---|
| 73 | #############################################
 | 
|---|
| 74 | if( -d $src/Blitz ) then
 | 
|---|
| 75 |   cd $src/Blitz/.
 | 
|---|
| 76 |   foreach d ( blitz blitz/meta blitz/array )
 | 
|---|
| 77 |     if( -d $d ) then
 | 
|---|
| 78 |       echo $cpln from Blitz/$d
 | 
|---|
| 79 |       if( ! -d $dst/$d ) mkdir $dst/$d
 | 
|---|
| 80 |       pushd $d > /dev/null
 | 
|---|
| 81 |       set FILE = ( *.h *.cc )
 | 
|---|
| 82 |       popd     > /dev/null
 | 
|---|
| 83 |       pushd $dst/$d/. > /dev/null
 | 
|---|
| 84 |       rm -f $FILE
 | 
|---|
| 85 |       $cpln $src/Blitz/$d/*.h ./
 | 
|---|
| 86 |       $cpln $src/Blitz/$d/*.cc ./
 | 
|---|
| 87 |       popd       > /dev/null
 | 
|---|
| 88 |     endif
 | 
|---|
| 89 |   end
 | 
|---|
| 90 | endif
 | 
|---|
| 91 | 
 | 
|---|
| 92 | ####################################################
 | 
|---|
| 93 | ####  Les includes du code C++ a mettre dans Include
 | 
|---|
| 94 | ####################################################
 | 
|---|
| 95 | foreach d (`cat ../Mgr/libdirs` `cat ../Mgr/extlibdirs` `cat ../Mgr/PIlibdirs`   )
 | 
|---|
| 96 |   if ( -d $src/$d ) then
 | 
|---|
| 97 |     cd $src/$d/.
 | 
|---|
| 98 |     echo $cpln from $d
 | 
|---|
| 99 |     set FILE = ( *.h )
 | 
|---|
| 100 |     pushd $dst/. > /dev/null
 | 
|---|
| 101 |     rm -f $FILE
 | 
|---|
| 102 |     $cpln $src/$d/*.h ./
 | 
|---|
| 103 |     popd         > /dev/null
 | 
|---|
| 104 |   endif
 | 
|---|
| 105 | end
 | 
|---|
| 106 | 
 | 
|---|
| 107 | ######################################
 | 
|---|
| 108 | ####  Le cas particulier de machdefs.h
 | 
|---|
| 109 | ######################################
 | 
|---|
| 110 | if ( -e $src/BaseTools/machdefs_mkmf.h ) then
 | 
|---|
| 111 |   echo $cpln from BaseTools/machdefs_mkmf.h
 | 
|---|
| 112 |   $cpln $src/BaseTools/machdefs_mkmf.h $dst/machdefs.h
 | 
|---|
| 113 | endif
 | 
|---|
| 114 | 
 | 
|---|
| 115 | ###############################
 | 
|---|
| 116 | ####  Nettoyage des liens vides
 | 
|---|
| 117 | ###############################
 | 
|---|
| 118 | if( $?clln ) then
 | 
|---|
| 119 |   foreach f ( $dst/*.h )
 | 
|---|
| 120 |     if( ! -e $f ) then
 | 
|---|
| 121 |       echo remove empty link : $f
 | 
|---|
| 122 |       rm -f $f
 | 
|---|
| 123 |     endif
 | 
|---|
| 124 |   end
 | 
|---|
| 125 | endif
 | 
|---|
| 126 | 
 | 
|---|
| 127 | exit 0
 | 
|---|