source: Sophya/trunk/SophyaLib/Mgr/mkmf@ 2150

Last change on this file since 2150 was 1834, checked in by ansari, 24 years ago

Adaptation pour ajout module PIGcont - Reza 19/12/2001

  • Property svn:executable set to *
File size: 8.2 KB
Line 
1#!/bin/csh
2# $Id: mkmf,v 1.17 2001-12-19 18:34:11 ansari Exp $
3
4# Pour debugger
5set DODBG = 'echo'
6set DODBG = ''
7
8# Librairies externe
9if( ! $?EXTLIBDIR ) then
10 echo 'mkmf- WARNING (External libraries) EXTLIBDIR variable not set'
11endif
12
13# creation de MakefileUser.h a partir de Makefile.h
14chmod +x ./makefileuser.csh
15$DODBG ./makefileuser.csh
16
17# creation des liens pour les includes
18echo 'mkmf: Creating links for *.h (call mkmflien)'
19chmod +x ./mkmflien
20$DODBG ./mkmflien -clean
21
22# Liste des modules a construire
23# modules : Liste de module SOPHYA, sans dependance exterieure
24# extmodules : Liste de modules avec dependance exterieures
25# _pres : Liste des modules presents
26
27set modules = `cat libdirs`
28set extmodules = `cat extlibdirs`
29set modules_pres = ''
30set extmodules_pres = ''
31
32set module_libnames = ''
33set extmodule_libnames = ''
34set extlib_list = ''
35set extslb_list = ''
36# Constitution de la liste de modules present
37foreach f ($modules)
38 if (-d ../$f ) then
39 set modules_pres = ( $modules_pres $f )
40 set module_libnames = ( $module_libnames '$(LIB)lib'$f.a )
41 endif
42end
43foreach f ($extmodules)
44 if (-d ../$f ) then
45 set extmodules_pres = ( $extmodules_pres $f )
46 set extmodule_libnames = ( $extmodule_libnames '$(LIB)lib'$f.a )
47 set lil = "../$f/extlib_list"
48 if (-f $lil ) set extlib_list = ($extlib_list `sed -e 's/.*/-l&/' $lil`)
49 set lil = "../$f/extslb_list"
50 if (-f $lil ) set extslb_list = ($extslb_list `sed -e 's/.*/-l&/' $lil`)
51 endif
52end
53
54echo 'mkmf: List of modules '
55echo ' ... modules= ' $modules_pres
56echo $module_libnames
57echo ' ... extmodules= ' $extmodules_pres
58echo $extmodule_libnames
59
60echo 'mkmf: Creating makefile global :'
61rm -f GNUmakefile; touch GNUmakefile
62
63echo '# include files defining compiler/linker options ' >> GNUmakefile
64echo 'MODULECXXREPNAME := PI' >> GNUmakefile
65echo 'include Mgr/Makefile.h' >> GNUmakefile
66echo 'include Mgr/Makefile.slb' >> GNUmakefile
67echo '' >> GNUmakefile
68
69echo 'LIBF = ' `sed -e 's/.*/$(LIB)lib&.a/' libdirs` >> GNUmakefile
70# echo 'LIBS = -L$(LIB)' `sed -e 's/.*/-l&/' libdirs` '-lm' >> GNUmakefile
71echo 'LIBS = -L$(LIB)' `sed -e 's/.*/-l&/' libdirs` >> GNUmakefile
72# echo 'LIBG = -L$(GLB) -lstdc++' >> GNUmakefile
73# echo 'ifeq ($(HOSTTYPE), powerpc)' >> GNUmakefile
74# echo ' LIBG = -L$(GLB)' >> GNUmakefile
75# echo 'endif' >> GNUmakefile
76
77cat >> GNUmakefile <<EOF
78
79defaut: libs
80
81all: libs extlibs PI
82
83libs: cxxlibs
84
85extlibs: cxxextlibs
86
87EOF
88
89# Dans cet ordre pour les templates de cxx, a cause des dependances
90# pour instantiation automatique/manuels
91
92echo 'cxxlibs: ' $modules_pres >> GNUmakefile
93echo ' ' >> GNUmakefile
94echo 'cxxextlibs: ' $extmodules_pres >> GNUmakefile
95
96
97# Attention, ne pas changer l'ordre de libnames dependances cxx ?????
98set libnames = ($modules_pres $extmodules_pres)
99set i = 1
100set j = $#libnames ; @ j--
101while ($i <= $#libnames)
102 set f = $libnames[$i]
103 set k = $i ; @ k++
104 if ( -d ../$f && ! -f ../$f/no_mkmf ) then
105 set cmd = "./mkmflib $f "
106 echo "mkmf: Creation makefile lib $f"
107 echo " execution $cmd"
108 $DODBG $cmd
109 endif
110 echo '.PHONY: ' $f >> GNUmakefile
111 echo $f':' >> GNUmakefile
112 echo ' if [ -d '$f' ] ; then cd ' $f '; $(MAKE) ; fi' >> GNUmakefile
113 echo ' ' >> GNUmakefile
114 @ i++
115end
116
117
118if ( -d ../PI ) then
119 set cmd = './mkmfPI PI BaseTools'
120 echo "mkmf: Creation makefile lib PI"
121 echo " execution $cmd"
122 $DODBG $cmd
123endif
124if ( -d ../PIGcont ) then
125 set cmd = './mkmfPI PIGcont BaseTools'
126 echo "mkmf: Creation makefile lib PIGcont"
127 echo " execution $cmd"
128 $DODBG $cmd
129endif
130if ( -d ../PIext ) then
131 set cmd = "./mkmfPI PIext $libnames PI"
132 echo "mkmf: Creation makefile lib PIext"
133 echo " execution $cmd"
134 $DODBG $cmd
135endif
136echo '.PHONY: PI' >> GNUmakefile
137echo 'PI:' >> GNUmakefile
138echo ' if [ -d PI ] ; then cd PI ; $(MAKE) ; fi' >> GNUmakefile
139echo ' if [ -d PIGcont ] ; then cd PIGcont ; $(MAKE) ; fi' >> GNUmakefile
140echo ' if [ -d PIext ] ; then cd PIext ; $(MAKE) ; fi' >> GNUmakefile
141
142
143echo 'mkmf: Writing shared library building part of the makefile :'
144if ( `uname` == "Darwin" ) then
145 set sosfx = "dylib"
146else
147 set sosfx = "so"
148endif
149
150echo '# Shared library creation part of the Makefile' >> GNUmakefile
151echo ' ' >> GNUmakefile
152echo '# List of libraries (.a)' >> GNUmakefile
153echo 'PSLB = ' $module_libnames >> GNUmakefile
154echo 'EXTPSLB = ' $extmodule_libnames >> GNUmakefile
155echo 'PIPSLB = $(LIB)libPI.a $(LIB)libPIext.a' >> GNUmakefile
156echo '# List of external library references' >> GNUmakefile
157echo 'EXTLIB = -L$(EXTLIBPATH)' $extlib_list >> GNUmakefile
158echo 'EXTSLB = -L$(EXTSLBPATH)' $extslb_list >> GNUmakefile
159echo 'XPILIBS = $(LIBXPIPATH) $(LIBXPILIST)' >> GNUmakefile
160echo '' >> GNUmakefile
161echo '# main dependence list' >> GNUmakefile
162echo 'slball : slb slbext slbpi ' >> GNUmakefile
163echo 'slb : $(SLB)libsophya.'$sosfx >> GNUmakefile
164echo 'slbext : $(SLB)libextsophya.'$sosfx >> GNUmakefile
165echo 'slbpi : $(SLB)libPI.'$sosfx >> GNUmakefile
166echo ' ' >> GNUmakefile
167
168echo '# List of .o files for each module' >> GNUmakefile
169set objalls = ''
170foreach f ($modules_pres)
171 echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)' >> GNUmakefile
172 set objalls = ( $objalls '$(OBJ'$f')' )
173end
174echo 'ALLOBJS =' $objalls >> GNUmakefile
175echo ' ' >> GNUmakefile
176
177echo '# List of .o files modules with reference to external libraries' >> GNUmakefile
178set objalls = ''
179foreach f ($extmodules_pres)
180 echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)' >> GNUmakefile
181 set objalls = ( $objalls '$(OBJ'$f')' )
182end
183echo 'ALLEXTOBJS =' $objalls >> GNUmakefile
184echo ' ' >> GNUmakefile
185
186echo '# List of .o files for PI modules ' >> GNUmakefile
187set objalls = ''
188foreach f (PI PIGcont PIext)
189 echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)' >> GNUmakefile
190 set objalls = ( $objalls '$(OBJ'$f')' )
191end
192echo 'ALLPIOBJS =' $objalls >> GNUmakefile
193echo ' ' >> GNUmakefile
194
195echo '# Building Sophya shared library' >> GNUmakefile
196echo '$(SLB)libsophya.'$sosfx' : $(PSLB)' >> GNUmakefile
197echo ' $(CMDTILSHL) ' >> GNUmakefile
198echo ' cd $(OBJ); \' >> GNUmakefile
199echo ' $(CMDSHLCXX) -o $(SLB)libsophya.'$sosfx' \' >> GNUmakefile
200echo ' $(FGSHLACXX) $(ALLOBJS) $(FGSHLNCXX)\' >> GNUmakefile
201echo ' -L$(SLB) $(LIBLSHL)' >> GNUmakefile
202echo ' ' >> GNUmakefile
203
204echo '# Building ExtSophya shared library' >> GNUmakefile
205echo '$(SLB)libextsophya.'$sosfx' : $(EXTPSLB)' >> GNUmakefile
206echo ' $(CMDTILSHL) ' >> GNUmakefile
207echo ' cd $(OBJ); \' >> GNUmakefile
208echo ' $(CMDSHLCXX) -o $(SLB)libextsophya.'$sosfx' \' >> GNUmakefile
209echo ' $(FGSHLACXX) $(ALLEXTOBJS) $(FGSHLNCXX)\' >> GNUmakefile
210echo ' -L$(SLB) -lsophya $(EXTLIB) $(LIBLSHL)' >> GNUmakefile
211echo ' ' >> GNUmakefile
212
213echo '# Building PI shared library' >> GNUmakefile
214echo '$(SLB)libPI.'$sosfx' : $(PIPSLB)' >> GNUmakefile
215echo ' $(CMDTILSHL) ' >> GNUmakefile
216echo ' cd $(OBJ); \' >> GNUmakefile
217echo ' $(CMDSHLCXX) -o $(SLB)libPI.'$sosfx' \' >> GNUmakefile
218echo ' $(FGSHLACXX) $(ALLPIOBJS) $(FGSHLNCXX) \' >> GNUmakefile
219echo ' -L$(SLB) -lsophya -lextsophya $(EXTLIB) $(XPILIBS) $(LIBLSHL)' >> GNUmakefile
220echo ' ' >> GNUmakefile
221
222
223cat >> GNUmakefile << __END__
224
225clean:
226 if [ -d \$(LIB) ] ; then cd \$(LIB)/. ; rm -f *.a ; fi
227 if [ -d \$(SLB) ] ; then cd \$(SLB)/. ; rm -f *.$sosfx ; fi
228 if [ -d \$(OBJ) ] ; then cd \$(OBJ)/. ; rm -f *.o rm -rf cxxrep* ; fi
229# if [ -d PI ] ; then cd PI/. ; \$(MAKE) clean ; fi
230
231__END__
232
233mv GNUmakefile ../GNUmakefile
234
235echo '*** mkmf done ***'
236
Note: See TracBrowser for help on using the repository browser.