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

Last change on this file since 4085 was 2766, checked in by ansari, 20 years ago

Gestion variable controle template CXXTEMPFLG - cmv+Reza 25/5/2005

  • Property svn:executable set to *
File size: 3.3 KB
Line 
1#!/bin/csh
2# Script de generation des Makefile/smakefile pour modules
3# librairies SOPHYA
4# C. Magneville / R. Ansari - Mai 2005
5#------
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
10#------
11
12if ( ! $?TMPDIR ) set TMPDIR = /tmp
13set makname = "Makefile"
14unset targetdir
15
16if ( $#argv < 1) then
17 echo ' Usage: mkmflib [-dev] [-sbase SOPHYABASE] ModuleName '
18 exit -1
19endif
20
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
48#--- fichier des fichiers a exclure
49if ( ! -f exclude ) touch exclude
50sort exclude >! $TMPDIR/exclude.sort
51set exclfile = 'exclude'
52
53echo "mkmflib: Creating $targetdir/objlist.list , $targetdir/$makname"
54
55#--- fichier de la liste des .o
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
62#--- Creation de smakefile
63set libf='$(SOPHYALIBP)lib'$targetdir'.a'
64rm -f $makname; touch $makname
65
66if ($makname == "smakefile") then
67 echo 'include $(SOPHYABASE)/include/sophyamake.inc' >> $makname
68else
69 echo 'include ../BuildMgr/sophyamake.inc' >> $makname
70endif
71
72echo ' ' >> $makname
73echo 'all:' $libf >> $makname
74echo ' ' >> $makname
75
76echo 'clean:' >> $makname
77set toto='rm -f'
78foreach f ( *.cc *.c )
79 set toto= ( $toto '$(SOPHYAOBJP)'$f:r.o )
80end
81echo ' ' $toto >> $makname
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
88set slbobjlist = libsophya.so
89if( -e shlibs.name ) set slbobjlist = `grep ^lib shlibs.name | head -1`
90set slbobjlist = $slbobjlist:r.objlist
91echo ' touch $(SOPHYAINCP)/SophyaConfInfo/'$slbobjlist >> $makname
92rm -f $TMPDIR/exclude.sort
93
94echo " " >> $makname
95
96
97#--- Creation des dependances
98set inc = `echo $SOPHYABASE/include | sed "s?//?/?g" | sed 's?/$??'`
99set nomsys = `uname`
100
101foreach f ( *.cc )
102 grep -q '^'$f'$' $exclfile && continue
103 gcc -MM -D$nomsys -I$inc $f \
104 | sed -e 's/.*\.o/\$(SOPHYAOBJP)&/' \
105 | sed -e 's?'$inc/'?$(SOPHYAINCP)?g' >> $makname
106 echo ' $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ ' $f >> $makname
107 echo ' ' >> $makname
108end
109
110foreach f ( *.c )
111 grep -q '^'$f'$' $exclfile && continue
112 gcc -MM -D$nomsys -I$inc $f \
113 | sed -e 's/.*\.o/\$(SOPHYAOBJP)&/' \
114 | sed -e 's?'$inc/'?$(SOPHYAINCP)?g' >> $makname
115 echo ' $(CCOMPILE) -o $@ ' $f >> $makname
116 echo ' ' >> $makname
117end
118
119foreach f ( *.f )
120 grep -q '^'$f'$' $exclfile && continue
121 echo '$(SOPHYAOBJP)'$f:r'.o: '$f >> $makname
122 echo ' $(FCOMPILE) -o $@ ' $f >> $makname
123 echo ' ' >> $makname
124end
125
126exit 0
Note: See TracBrowser for help on using the repository browser.