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

Last change on this file since 1614 was 1603, checked in by ansari, 24 years ago

Adaptation a la restructuration de la base CVS (creation de BaseTools,Utils) - cmv+Reza 30/7/2001

  • Property svn:executable set to *
File size: 7.9 KB
RevLine 
[218]1#!/bin/csh
[1603]2# $Id: mkmf,v 1.14 2001-07-30 16:36:54 ansari Exp $
[218]3
[740]4# Pour debugger
5set DODBG = 'echo'
[742]6set DODBG = ''
[740]7
8# Librairies externe
[737]9if( ! $?EXTLIBDIR ) then
[740]10 echo 'mkmf- WARNING (External libraries) EXTLIBDIR variable not set'
[554]11endif
12
[218]13# creation de MakefileUser.h a partir de Makefile.h
[968]14chmod +x ./makefileuser.csh
15$DODBG ./makefileuser.csh
[218]16
17# creation des liens pour les includes
[554]18echo 'mkmf: Creating links for *.h (call mkmflien)'
[968]19chmod +x ./mkmflien
[1493]20$DODBG ./mkmflien -clean
[218]21
[740]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
[554]60echo 'mkmf: Creating makefile global :'
[218]61rm -f GNUmakefile
62
[740]63echo '# include files defining compiler/linker options ' >> GNUmakefile
64echo 'MODULECXXREPNAME := PI' >> GNUmakefile
[218]65echo 'include Mgr/Makefile.h' >> GNUmakefile
[740]66echo 'include Mgr/Makefile.slb' >> GNUmakefile
67echo '' >> GNUmakefile
[218]68
69echo 'LIBF = ' `sed -e 's/.*/$(LIB)lib&.a/' libdirs` >> GNUmakefile
[823]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
[218]76
77cat >> GNUmakefile <<EOF
78
79defaut: libs
80
[740]81all: libs extlibs PI
[218]82
[740]83libs: cxxlibs
[218]84
[740]85extlibs: cxxextlibs
86
87EOF
88
[218]89# Dans cet ordre pour les templates de cxx, a cause des dependances
90# pour instantiation automatique/manuels
91
[740]92echo 'cxxlibs: ' $modules_pres >> GNUmakefile
93echo ' ' >> GNUmakefile
94echo 'cxxextlibs: ' $extmodules_pres >> GNUmakefile
[218]95
96
[751]97# Attention, ne pas changer l'ordre de libnames dependances cxx ?????
[740]98set libnames = ($modules_pres $extmodules_pres)
[218]99set i = 1
100set j = $#libnames ; @ j--
101while ($i <= $#libnames)
102 set f = $libnames[$i]
103 set k = $i ; @ k++
104 if ( -d ../$f ) then
[751]105 set cmd = "./mkmflib $f "
[218]106 echo "mkmf: Creation makefile lib $f"
107 echo " execution $cmd"
[740]108 $DODBG $cmd
[218]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
[1603]119 set cmd = './mkmfPI PI BaseTools'
[218]120 echo "mkmf: Creation makefile lib PI"
121 echo " execution $cmd"
[740]122 $DODBG $cmd
[218]123endif
124if ( -d ../PIext ) then
[740]125 set cmd = "./mkmfPI PIext $libnames PI"
[218]126 echo "mkmf: Creation makefile lib PIext"
127 echo " execution $cmd"
[740]128 $DODBG $cmd
[218]129endif
130echo '.PHONY: PI' >> GNUmakefile
131echo 'PI:' >> GNUmakefile
132echo ' if [ -d PI ] ; then cd PI ; $(MAKE) ; fi' >> GNUmakefile
133echo ' if [ -d PIext ] ; then cd PIext ; $(MAKE) ; fi' >> GNUmakefile
134
135
[751]136echo 'mkmf: Writing shared library building part of the makefile :'
[740]137
138echo '# Shared library creation part of the Makefile' >> GNUmakefile
139echo ' ' >> GNUmakefile
140echo '# List of libraries (.a)' >> GNUmakefile
141echo 'PSLB = ' $module_libnames >> GNUmakefile
142echo 'EXTPSLB = ' $extmodule_libnames >> GNUmakefile
143echo 'PIPSLB = $(LIB)libPI.a $(LIB)libPIext.a' >> GNUmakefile
144echo '# List of external library references' >> GNUmakefile
145echo 'EXTLIB = -L$(EXTLIBPATH)' $extlib_list >> GNUmakefile
[751]146echo 'EXTSLB = -L$(EXTSLBPATH)' $extslb_list >> GNUmakefile
[740]147echo 'XPILIBS = $(LIBXPIPATH) $(LIBXPILIST)' >> GNUmakefile
148echo '' >> GNUmakefile
149echo '# main dependence list' >> GNUmakefile
150echo 'slball : slb slbext slbpi ' >> GNUmakefile
151echo 'slb : $(SLB)libsophya.so ' >> GNUmakefile
152echo 'slbext : $(SLB)libextsophya.so ' >> GNUmakefile
153echo 'slbpi : $(SLB)libPI.so' >> GNUmakefile
154echo ' ' >> GNUmakefile
155
156echo '# List of .o files for each module' >> GNUmakefile
157set objalls = ''
158foreach f ($modules_pres)
159 echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)' >> GNUmakefile
160 set objalls = ( $objalls '$(OBJ'$f')' )
161end
162echo 'ALLOBJS =' $objalls >> GNUmakefile
163echo ' ' >> GNUmakefile
164
165echo '# List of .o files modules with reference to external libraries' >> GNUmakefile
166set objalls = ''
167foreach f ($extmodules_pres)
168 echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)' >> GNUmakefile
169 set objalls = ( $objalls '$(OBJ'$f')' )
170end
171echo 'ALLEXTOBJS =' $objalls >> GNUmakefile
172echo ' ' >> GNUmakefile
173
174echo '# List of .o files for PI modules ' >> GNUmakefile
175set objalls = ''
176foreach f (PI PIext)
177 echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)' >> GNUmakefile
178 set objalls = ( $objalls '$(OBJ'$f')' )
179end
180echo 'ALLPIOBJS =' $objalls >> GNUmakefile
181echo ' ' >> GNUmakefile
182
183echo '# Building Sophya shared library' >> GNUmakefile
184echo '$(SLB)libsophya.so : $(PSLB)' >> GNUmakefile
185echo ' $(CMDTILSHL) ' >> GNUmakefile
186echo ' cd $(OBJ); \' >> GNUmakefile
187echo ' $(CMDSHLCXX) -o $(SLB)libsophya.so \' >> GNUmakefile
188echo ' $(FGSHLACXX) $(ALLOBJS) $(FGSHLNCXX)\' >> GNUmakefile
189echo ' -L$(SLB) $(LIBLSHL)' >> GNUmakefile
190echo ' ' >> GNUmakefile
191
192echo '# Building ExtSophya shared library' >> GNUmakefile
193echo '$(SLB)libextsophya.so : $(EXTPSLB)' >> GNUmakefile
194echo ' $(CMDTILSHL) ' >> GNUmakefile
195echo ' cd $(OBJ); \' >> GNUmakefile
196echo ' $(CMDSHLCXX) -o $(SLB)libextsophya.so \' >> GNUmakefile
197echo ' $(FGSHLACXX) $(ALLEXTOBJS) $(FGSHLNCXX)\' >> GNUmakefile
[751]198echo ' -L$(SLB) -lsophya $(EXTLIB) $(LIBLSHL)' >> GNUmakefile
[740]199echo ' ' >> GNUmakefile
200
201echo '# Building PI shared library' >> GNUmakefile
202echo '$(SLB)libPI.so : $(PIPSLB)' >> GNUmakefile
203echo ' $(CMDTILSHL) ' >> GNUmakefile
204echo ' cd $(OBJ); \' >> GNUmakefile
205echo ' $(CMDSHLCXX) -o $(SLB)libPI.so \' >> GNUmakefile
[751]206echo ' $(FGSHLACXX) $(ALLPIOBJS) $(FGSHLNCXX) \' >> GNUmakefile
207echo ' -L$(SLB) -lsophya -lextsophya $(EXTLIB) $(XPILIBS) $(LIBLSHL)' >> GNUmakefile
[740]208echo ' ' >> GNUmakefile
209
210
[218]211cat >> GNUmakefile << __END__
212
213clean:
214 if [ -d \$(LIB) ] ; then cd \$(LIB)/. ; rm -f *.a ; fi
215 if [ -d \$(SLB) ] ; then cd \$(SLB)/. ; rm -f *.so ; fi
[740]216 if [ -d \$(OBJ) ] ; then cd \$(OBJ)/. ; rm -f *.o rm -rf cxxrep* ; fi
217# if [ -d PI ] ; then cd PI/. ; \$(MAKE) clean ; fi
[218]218
219__END__
220
221mv GNUmakefile ../GNUmakefile
222
223echo '*** mkmf done ***'
224
Note: See TracBrowser for help on using the repository browser.