source: Sophya/trunk/SophyaLib/BuildMgr/mkmflib@ 2743

Last change on this file since 2743 was 2739, checked in by cmv, 20 years ago

suite nouvelle structure cmv 20/05/05

  • Property svn:executable set to *
File size: 3.1 KB
RevLine 
[2720]1#!/bin/csh
2# Script de generation des Makefile/smakefile pour modules
3# librairies SOPHYA
4# C. Magneville / R. Ansari - Mai 2005
[2739]5#------
[2720]6# Option controlant la generation des smakefile OU Makefile
7# smakefile utilise pour le developpement - contient une reference
8# a $(SOPHYABASE)/include/sophyamake.inc
9# les Makefile reference ../BuildMgr/sophyamake.inc
[2739]10#------
[2720]11
[2739]12if ( ! $?TMPDIR ) set TMPDIR = /tmp
[2720]13set makname = "Makefile"
14unset targetdir
15
[2739]16if ( $#argv < 1) then
17 echo ' Usage: mkmflib [-dev] [-sbase SOPHYABASE] ModuleName '
18 exit -1
19endif
20
[2720]21while ( $#argv > 0 )
22 if( "$1" == "-h" ) then
23 echo ' Usage: mkmflib [-dev] [-sbase SOPHYABASE] ModuleName '
24 exit -1
25 else if ( "$1" == "-dev" ) then
26 set makname = "smakefile"
27 else if( "$1" == "-sbase" ) then
28 setenv SOPHYABASE $2
29 shift
30 else
31 set targetdir = $1
32 endif
33 shift
34end
35
36if( ! $?SOPHYABASE ) then
37 echo 'ERROR: (mkmflib) define SOPHYABASE or use script arguments'
38 exit -2
39endif
40
41if( ! $?targetdir ) then
42 echo 'ERROR: (mkmflib) No target module (directory) specified'
43 exit -3
44endif
45
46cd ../$targetdir
47
[2739]48#--- fichier des fichiers a exclure
[2720]49if ( ! -f exclude ) touch exclude
[2739]50sort exclude >! $TMPDIR/exclude.sort
51set exclfile = 'exclude'
[2720]52
53echo "mkmflib: Creating $targetdir/objlist.list , $targetdir/$makname"
54
[2739]55#--- fichier de la liste des .o
[2720]56set liblist = objlist.list
57rm -f $liblist
58touch $liblist
59ls -1 *.{c,cc} | comm -3 -1 $TMPDIR/exclude.sort - | sed -e 's/\.cc/.o/' | sed -e 's/\.c/.o/' >> $liblist
60unset liblist
61
[2739]62#--- Creation de smakefile
[2720]63set libf='$(SOPHYALIBP)lib'$targetdir'.a'
[2739]64rm -f $makname; touch $makname
[2720]65
66if ($makname == "smakefile") then
67 echo 'include $(SOPHYABASE)/include/sophyamake.inc' >> $makname
68else
69 echo 'include ../BuildMgr/sophyamake.inc' >> $makname
70endif
71
[2739]72echo ' ' >> $makname
[2720]73echo 'all:' $libf >> $makname
74echo ' ' >> $makname
75
76echo 'clean:' >> $makname
77set toto='rm -f'
[2739]78foreach f ( *.cc *.c )
[2720]79 set toto= ( $toto '$(SOPHYAOBJP)'$f:r.o )
80end
[2739]81echo ' ' $toto >> $makname
[2720]82echo ' rm -f '$libf >> $makname
83echo ' ' >> $makname
84
85echo $libf ':' \
86 `ls -1 *.{c,cc} | comm -3 -1 $TMPDIR/exclude.sort - | sed -e 's/\.cc/.o/' | sed -e 's/\.c/.o/' | sed -e 's/^/$(SOPHYAOBJP)/'` >> $makname
87echo ' $(AR) $(ARFLAGS) $@ $? ' >> $makname
88rm -f $TMPDIR/exclude.sort
89
90echo " " >> $makname
91
[2739]92
93#--- Creation des dependances
94set inc = `echo $SOPHYABASE/include | sed "s?//?/?g" | sed 's?/$??'`
[2720]95set nomsys = `uname`
96
97foreach f ( *.cc )
98 grep -q '^'$f'$' $exclfile && continue
99 gcc -MM -D$nomsys -I$inc $f \
100 | sed -e 's/.*\.o/\$(SOPHYAOBJP)&/' \
101 | sed -e 's?'$inc/'?$(SOPHYAINCP)?g' >> $makname
102 echo ' $(CXXCOMPILE) -o $@ $<' >> $makname
103 echo ' ' >> $makname
104end
105
106foreach f ( *.c )
107 grep -q '^'$f'$' $exclfile && continue
108 gcc -MM -D$nomsys -I$inc $f \
109 | sed -e 's/.*\.o/\$(SOPHYAOBJP)&/' \
110 | sed -e 's?'$inc/'?$(SOPHYAINCP)?g' >> $makname
111 echo ' $(CCOMPILE) -o $@ $<' >> $makname
112 echo ' ' >> $makname
113end
114
[2739]115foreach f ( *.f )
116 grep -q '^'$f'$' $exclfile && continue
117 echo '$(SOPHYAOBJP)'$f:r'.o: '$f >> $makname
118 echo ' $(FCOMPILE) -o $@ $<' >> $makname
119 echo ' ' >> $makname
120end
121
[2734]122exit 0
Note: See TracBrowser for help on using the repository browser.