| [1980] | 1 | #!/bin/csh | 
|---|
|  | 2 | # $Id: smkmflien,v 1.1 2002-05-03 15:05:31 ansari Exp $ | 
|---|
|  | 3 |  | 
|---|
|  | 4 | # ################## ArchTOIPipe-With-Sophya #################### | 
|---|
|  | 5 | #Adaptation SOPHYA/Mgr/mkmflien a smkmflien pour ArchTOIPipe | 
|---|
|  | 6 | #                             Reza - Mai 2002 | 
|---|
|  | 7 | # usage : smkmflien [-copy] [dir_dest] | 
|---|
|  | 8 | #  -copy : includes are copied (if not they are linked) | 
|---|
|  | 9 | #  -clean : after copy/link file are deleted if not existing (empty link) | 
|---|
|  | 10 | #  dir_dest : link/copy to dir_dest/ | 
|---|
|  | 11 | #             default : $ARCHPDEVREP/Include | 
|---|
|  | 12 |  | 
|---|
|  | 13 | ####################### | 
|---|
|  | 14 | #### Decodage arguments | 
|---|
|  | 15 | ####################### | 
|---|
|  | 16 | unset dst | 
|---|
|  | 17 | set cpln = "ln -sf" | 
|---|
|  | 18 | unset clln | 
|---|
|  | 19 | if( $?ARCHPDEVREP ) then | 
|---|
|  | 20 | set dst = $ARCHPDEVREP/Include | 
|---|
|  | 21 | endif | 
|---|
|  | 22 |  | 
|---|
|  | 23 | while( $#argv > 0 ) | 
|---|
|  | 24 | if( "$1" == "-copy" ) then | 
|---|
|  | 25 | set cpln = "cp" | 
|---|
|  | 26 | else if( "$1" == "-clean" ) then | 
|---|
|  | 27 | set clln | 
|---|
|  | 28 | else | 
|---|
|  | 29 | set dst = $1 | 
|---|
|  | 30 | endif | 
|---|
|  | 31 | shift | 
|---|
|  | 32 | end | 
|---|
|  | 33 |  | 
|---|
|  | 34 | if( ! $?dst ) then | 
|---|
|  | 35 | echo "Variable ARCHPDEVREP must be set" | 
|---|
|  | 36 | echo "OR you must give a directory for linking/copying" | 
|---|
|  | 37 | exit -1 | 
|---|
|  | 38 | endif | 
|---|
|  | 39 |  | 
|---|
|  | 40 | ############################################################# | 
|---|
|  | 41 | #### repertoire contenant les liens a creer pour les includes | 
|---|
|  | 42 | ############################################################# | 
|---|
|  | 43 | if ( ! -d $dst/ ) then | 
|---|
|  | 44 | echo repertoire $dst inconnu | 
|---|
|  | 45 | exit -1 | 
|---|
|  | 46 | endif | 
|---|
|  | 47 |  | 
|---|
|  | 48 | ######################################################### | 
|---|
|  | 49 | #### repertoire contenant les repertoires du code+include | 
|---|
|  | 50 | ######################################################### | 
|---|
|  | 51 | #RZCOMM--- pushd ../. > /dev/null | 
|---|
|  | 52 | set src = `pwd | sed 's?/tmp_mnt??'` | 
|---|
|  | 53 | set src = `echo $src | sed 's?/.automount/dapservfic/root??'` | 
|---|
|  | 54 | #RZCOMM--- popd       > /dev/null | 
|---|
|  | 55 |  | 
|---|
|  | 56 | ######################################################### | 
|---|
|  | 57 | ### Les includes a mettre dans Include pour les Makefiles | 
|---|
|  | 58 | ######################################################### | 
|---|
|  | 59 | if( -d $src ) then | 
|---|
|  | 60 | cd $src/. | 
|---|
|  | 61 | echo $cpln from src | 
|---|
|  | 62 | set FILE = ( SMakefile.h ) | 
|---|
|  | 63 | pushd $dst/. > /dev/null | 
|---|
|  | 64 | rm -f $FILE | 
|---|
|  | 65 | foreach f ( $FILE ) | 
|---|
|  | 66 | if( -e $src/$f ) then | 
|---|
|  | 67 | $cpln $src/$f ./ | 
|---|
|  | 68 | endif | 
|---|
|  | 69 | end | 
|---|
|  | 70 | popd       > /dev/null | 
|---|
|  | 71 | endif | 
|---|
|  | 72 |  | 
|---|
|  | 73 |  | 
|---|
|  | 74 | #################################################### | 
|---|
|  | 75 | ####  Les includes du code C++ a mettre dans Include | 
|---|
|  | 76 | #################################################### | 
|---|
|  | 77 | foreach d (Kernel Processors ProcWSophya ) | 
|---|
|  | 78 | if ( -d $src/$d ) then | 
|---|
|  | 79 | cd $src/$d/. | 
|---|
|  | 80 | echo $cpln from $d | 
|---|
|  | 81 | set FILE = ( *.h ) | 
|---|
|  | 82 | pushd $dst/. > /dev/null | 
|---|
|  | 83 | rm -f $FILE | 
|---|
|  | 84 | $cpln $src/$d/*.h ./ | 
|---|
|  | 85 | popd         > /dev/null | 
|---|
|  | 86 | endif | 
|---|
|  | 87 | end | 
|---|
|  | 88 |  | 
|---|
|  | 89 | ############################################ | 
|---|
|  | 90 | ####  Le cas particulier de sophya_config.h | 
|---|
|  | 91 | ############################################ | 
|---|
|  | 92 | if ( -e $src/sophya_config.h ) then | 
|---|
|  | 93 | echo $cpln from $src/sophya_config.h | 
|---|
|  | 94 | $cpln $src/sophya_config.h $dst/config.h | 
|---|
|  | 95 | endif | 
|---|
|  | 96 |  | 
|---|
|  | 97 | ############################### | 
|---|
|  | 98 | ####  Nettoyage des liens vides | 
|---|
|  | 99 | ############################### | 
|---|
|  | 100 | if( $?clln ) then | 
|---|
|  | 101 | foreach f ( $dst/*.h ) | 
|---|
|  | 102 | if( ! -e $f ) then | 
|---|
|  | 103 | echo remove empty link : $f | 
|---|
|  | 104 | rm -f $f | 
|---|
|  | 105 | endif | 
|---|
|  | 106 | end | 
|---|
|  | 107 | endif | 
|---|
|  | 108 |  | 
|---|
|  | 109 | exit 0 | 
|---|