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

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

ajout var oubliees, retrait variables inexistantes, gestion $inc... cmv 19/05/05

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