| 1 | #!/bin/csh | 
|---|
| 2 |  | 
|---|
| 3 | # ################## ArchTOIPipe-With-Sophya #################### | 
|---|
| 4 | # ##### LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA ##### | 
|---|
| 5 | #  Script for ArchTOIPipe library module makefile generation | 
|---|
| 6 | #  Usage: ./mkmflib lib_module_name | 
|---|
| 7 | # ############################################################### | 
|---|
| 8 |  | 
|---|
| 9 | cd $1 | 
|---|
| 10 |  | 
|---|
| 11 | if ( ! -f exclude ) touch exclude | 
|---|
| 12 | if ( ! -f flags_compil ) touch flags_compil | 
|---|
| 13 | if ( ! -f extlib_list ) touch extlib_list | 
|---|
| 14 | if ( ! -f extslb_list ) touch extslb_list | 
|---|
| 15 |  | 
|---|
| 16 | if ( ! $?TMPDIR ) set TMPDIR = /tmp | 
|---|
| 17 | sort exclude >! $TMPDIR/exclude.sort | 
|---|
| 18 |  | 
|---|
| 19 | ############################################## | 
|---|
| 20 | ########### fichier de la liste des .o ####### | 
|---|
| 21 | ############################################## | 
|---|
| 22 |  | 
|---|
| 23 | set liblist = $1.o.list | 
|---|
| 24 | rm -f $liblist | 
|---|
| 25 | touch $liblist | 
|---|
| 26 | ls -1 *.{c,cc} | comm -3 -1 $TMPDIR/exclude.sort - | sed -e 's/\.cc/.o/' | sed -e 's/\.c/.o/' >> $liblist | 
|---|
| 27 | unset liblist | 
|---|
| 28 |  | 
|---|
| 29 | ############################################## | 
|---|
| 30 | ########### Creation de GNUmakefile ########## | 
|---|
| 31 | ############################################## | 
|---|
| 32 |  | 
|---|
| 33 | set libf='$(MYLIB)lib'$1'.a' | 
|---|
| 34 |  | 
|---|
| 35 | #set hfcxxlibs = '-L$(LIB)' | 
|---|
| 36 | #set i = 1 | 
|---|
| 37 | #while ($i <= $#argv) | 
|---|
| 38 | #  set hfcxxlibs = "$hfcxxlibs -l$argv[$i]" | 
|---|
| 39 | #  @ i++ | 
|---|
| 40 | #end | 
|---|
| 41 |  | 
|---|
| 42 | #set extlib_list = `cat extlib_list` | 
|---|
| 43 | #set hfcxxlibs = ($hfcxxlibs '-L$(EXTLIBPATH)' $extlib_list) | 
|---|
| 44 |  | 
|---|
| 45 | rm -f GNUmakefile | 
|---|
| 46 | touch GNUmakefile | 
|---|
| 47 |  | 
|---|
| 48 | cat flags_compil >> GNUmakefile | 
|---|
| 49 | echo 'include ../SMakefile.h' >> GNUmakefile | 
|---|
| 50 |  | 
|---|
| 51 | echo " " >> GNUmakefile | 
|---|
| 52 | echo 'all:' $libf  >> GNUmakefile | 
|---|
| 53 |  | 
|---|
| 54 | echo 'clean:' >> GNUmakefile | 
|---|
| 55 | set toto='rm -f' | 
|---|
| 56 | foreach f (*.cc *.c) | 
|---|
| 57 | set toto= ( $toto '$(OBJ)'$f:r.o ) | 
|---|
| 58 | end | 
|---|
| 59 | echo '  '$toto >> GNUmakefile | 
|---|
| 60 | echo '  rm -f '$libf >> GNUmakefile | 
|---|
| 61 |  | 
|---|
| 62 | echo $libf ':' \ | 
|---|
| 63 | `ls -1 *.{c,cc} | comm -3 -1 $TMPDIR/exclude.sort - | sed -e 's/\.cc/.o/' | sed -e 's/\.c/.o/' | sed -e 's/^/$(OBJ)/'` >> GNUmakefile | 
|---|
| 64 | echo '  $(ARCXX) $(ARCXXFLAGS) $@ $($(ARARGS))' >> GNUmakefile | 
|---|
| 65 | #  Pour faire compiler les instantiations automatique de cxx (DEC) | 
|---|
| 66 | echo 'ifeq ($(CXX),cxx)' >> GNUmakefile | 
|---|
| 67 | #echo ' $(CXX) $? $(CPPFLAGS) $(CXXFLAGS)' $hfcxxlibs '-o $(OBJ)xx.x -Hf' >> GNUmakefile | 
|---|
| 68 | echo '  $(CXX) $? $(CPPFLAGS) $(CXXFLAGS) -o $(OBJ)xx.x -Hf' >> GNUmakefile | 
|---|
| 69 | echo 'endif ' >> GNUmakefile | 
|---|
| 70 |  | 
|---|
| 71 | rm -f $TMPDIR/exclude.sort | 
|---|
| 72 |  | 
|---|
| 73 | echo " " >> GNUmakefile | 
|---|
| 74 |  | 
|---|
| 75 | set inc = $DPCBASEREP/Include | 
|---|
| 76 | # set incxx = $inc/CxxInc | 
|---|
| 77 | set incext = $EXTLIBDIR/Include | 
|---|
| 78 | set incfitsio = $EXTLIBDIR/Include/FitsIO | 
|---|
| 79 | set ainc = $ARCHPDEVREP/Include | 
|---|
| 80 | set nomsys = `uname` | 
|---|
| 81 |  | 
|---|
| 82 | foreach f ( *.cc ) | 
|---|
| 83 | grep -q '^'$f'$' exclude && continue | 
|---|
| 84 | gcc -MM -D$nomsys -I$ainc -I$inc -I$incext -I$incfitsio $f  \ | 
|---|
| 85 | #       | grep -v -e $inc -e $incfitsio -e $incext \ | 
|---|
| 86 | | sed -e 's/.*\.o/\$(OBJ)&/'  >> GNUmakefile | 
|---|
| 87 | #       | sed -e 's?'$inc/'?$(AINC)?g' \ | 
|---|
| 88 | #       | sed -e 's?'$incext/'?$(EXTINCPATH)?g' >> GNUmakefile | 
|---|
| 89 | end | 
|---|
| 90 |  | 
|---|
| 91 | foreach f ( *.c ) | 
|---|
| 92 | grep -q '^'$f'$' exclude && continue | 
|---|
| 93 | gcc -MM -D$nomsys -I$ainc -I$inc -I$incext -I$incfitsio $f  \ | 
|---|
| 94 | | sed -e 's/.*\.o/\$(OBJ)&/'  >> GNUmakefile | 
|---|
| 95 | #       | sed -e 's?'$ainc/'?$(AINC)?g' >> GNUmakefile | 
|---|
| 96 | #       | sed -e 's?'$incext/'?$(EXTINCPATH)?g' >> GNUmakefile | 
|---|
| 97 | end | 
|---|
| 98 |  | 
|---|
| 99 |  | 
|---|
| 100 |  | 
|---|
| 101 |  | 
|---|