| 1 | #!/bin/csh
 | 
|---|
| 2 | # $Id: mkmflib_save,v 1.3 2003-09-17 12:19:26 cmv Exp $
 | 
|---|
| 3 | 
 | 
|---|
| 4 | cd ../$1
 | 
|---|
| 5 | set libf='$(LIB)lib'$1'.a'
 | 
|---|
| 6 | 
 | 
|---|
| 7 | set hfcxxlibs = '-L$(LIB)' 
 | 
|---|
| 8 | set i = 1
 | 
|---|
| 9 | while ($i <= $#argv)
 | 
|---|
| 10 |   set hfcxxlibs = "$hfcxxlibs -l$argv[$i]"
 | 
|---|
| 11 |   @ i++
 | 
|---|
| 12 | end
 | 
|---|
| 13 | 
 | 
|---|
| 14 | 
 | 
|---|
| 15 | rm -f GNUmakefile
 | 
|---|
| 16 | 
 | 
|---|
| 17 | echo 'include ../Mgr/Makefile.h' >> GNUmakefile 
 | 
|---|
| 18 | 
 | 
|---|
| 19 | echo " " >> GNUmakefile
 | 
|---|
| 20 | echo 'all:' $libf  >> GNUmakefile 
 | 
|---|
| 21 | 
 | 
|---|
| 22 | echo 'clean:' >> GNUmakefile
 | 
|---|
| 23 | set toto='rm -f'
 | 
|---|
| 24 | foreach f (*.cc *.c) 
 | 
|---|
| 25 |   set toto= ( $toto '$(OBJ)'$f:r.o )
 | 
|---|
| 26 | end
 | 
|---|
| 27 | echo '  '$toto >> GNUmakefile
 | 
|---|
| 28 | echo '  rm -f '$libf >> GNUmakefile
 | 
|---|
| 29 | 
 | 
|---|
| 30 | if ( ! -f exclude ) touch exclude
 | 
|---|
| 31 | if ( ! $?TMPDIR ) set TMPDIR = /tmp
 | 
|---|
| 32 | sort exclude >! $TMPDIR/exclude.sort
 | 
|---|
| 33 | 
 | 
|---|
| 34 | echo $libf ':' \
 | 
|---|
| 35 |  `ls *.{c,cc} | comm -3 -1 $TMPDIR/exclude.sort - | sed -e 's/\.cc/.o/' | sed -e 's/\.c/.o/' | sed -e 's/^/$(OBJ)/'` >> GNUmakefile
 | 
|---|
| 36 | echo '  $(AR) $(ARFLAGS) $@ $?' >> GNUmakefile
 | 
|---|
| 37 | #  Pour faire compiler les instantiations automatique de cxx (DEC)
 | 
|---|
| 38 | echo 'ifeq ($(CXX),cxx)' >> GNUmakefile
 | 
|---|
| 39 | echo '  $(CXX) $? $(CPPFLAGS) $(CXXFLAGS)' $hfcxxlibs '-o $(OBJ)xx.x -Hf' >> GNUmakefile
 | 
|---|
| 40 | echo 'endif ' >> GNUmakefile
 | 
|---|
| 41 | 
 | 
|---|
| 42 | rm -f $TMPDIR/exclude.sort
 | 
|---|
| 43 | 
 | 
|---|
| 44 | echo " " >> GNUmakefile
 | 
|---|
| 45 | 
 | 
|---|
| 46 | set inc = $SOPHYADEVREP/Include
 | 
|---|
| 47 | set incxx = $inc/CxxInc
 | 
|---|
| 48 | 
 | 
|---|
| 49 | foreach f ( *.cc )
 | 
|---|
| 50 |   grep -q '^'$f'$' exclude && continue
 | 
|---|
| 51 |   gcc -MM -I$inc -I$incxx $f  \
 | 
|---|
| 52 |        | sed -e 's/.*\.o/\$(OBJ)&/'  \
 | 
|---|
| 53 |        | sed -e 's?'$incxx/'?$(CXI)?g' \
 | 
|---|
| 54 |        | sed -e 's?'$inc/'?$(INC)?g' >> GNUmakefile
 | 
|---|
| 55 | end
 | 
|---|
| 56 | 
 | 
|---|
| 57 | foreach f ( *.c )
 | 
|---|
| 58 |   grep -q '^'$f'$' exclude && continue
 | 
|---|
| 59 |   gcc -MM -I$inc -I$incxx $f  \
 | 
|---|
| 60 |        | sed -e 's/.*\.o/\$(OBJ)&/'  \
 | 
|---|
| 61 |        | sed -e 's?'$incxx/'?$(CXI)?g' \
 | 
|---|
| 62 |        | sed -e 's?'$inc/'?$(INC)?g' >> GNUmakefile
 | 
|---|
| 63 | end 
 | 
|---|
| 64 | 
 | 
|---|
| 65 | 
 | 
|---|
| 66 | 
 | 
|---|
| 67 | 
 | 
|---|