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

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

add comment for -ldxml vs -lblas for some OSF1 versions cmv 25/04/05

  • Property svn:executable set to *
File size: 10.9 KB
RevLine 
[218]1#!/bin/csh
[2685]2# $Id: mkmf,v 1.23 2005-04-25 08:23:13 cmv 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 :'
[1821]61rm -f GNUmakefile; touch GNUmakefile
[218]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
[2424]93echo '' >> GNUmakefile
[740]94echo 'cxxextlibs: ' $extmodules_pres >> GNUmakefile
[218]95
[2424]96# pour creer les repertoires et les liens
[218]97
[2424]98echo '#--- Create directory and copy includes for install' >> GNUmakefile
99echo 'depend:' >> GNUmakefile
[2437]100echo 'ifdef SOPHYADEVREP' >> GNUmakefile
101echo 'ifdef SOPHYACXX' >> GNUmakefile
[2424]102echo ' @echo "Sophya will be installed under:"' >> GNUmakefile
[2437]103echo ' @echo " $(SOPHYADEVREP)/Include" ' >> GNUmakefile
104echo ' @echo " $(SOPHYADEVREP)/`uname`-$(SOPHYACXX)" ' >> GNUmakefile
[2424]105echo ' if [ -d Mgr ] ; then cd Mgr; \' >> GNUmakefile
[2437]106echo ' ./crerep_sophya $(SOPHYADEVREP) `uname`-$(SOPHYACXX); \' >> GNUmakefile
[2424]107echo ' ./makefileuser.csh; \' >> GNUmakefile
108echo ' ./mkmflien -copy ; \' >> GNUmakefile
109echo ' fi' >> GNUmakefile
110echo 'else' >> GNUmakefile
[2437]111echo ' @echo "Variable SOPHYACXX must be define with setenv"' >> GNUmakefile
[2424]112echo 'endif' >> GNUmakefile
113echo 'else' >> GNUmakefile
[2437]114echo ' @echo "Variable SOPHYADEVREP must be define with setenv"' >> GNUmakefile
[2424]115echo 'endif' >> GNUmakefile
116echo '#--------------------------------------------------------------------' >> GNUmakefile
117echo '' >> GNUmakefile
118
[751]119# Attention, ne pas changer l'ordre de libnames dependances cxx ?????
[740]120set libnames = ($modules_pres $extmodules_pres)
[218]121set i = 1
122set j = $#libnames ; @ j--
123while ($i <= $#libnames)
124 set f = $libnames[$i]
125 set k = $i ; @ k++
[1783]126 if ( -d ../$f && ! -f ../$f/no_mkmf ) then
[751]127 set cmd = "./mkmflib $f "
[218]128 echo "mkmf: Creation makefile lib $f"
129 echo " execution $cmd"
[740]130 $DODBG $cmd
[218]131 endif
132 echo '.PHONY: ' $f >> GNUmakefile
133 echo $f':' >> GNUmakefile
134 echo ' if [ -d '$f' ] ; then cd ' $f '; $(MAKE) ; fi' >> GNUmakefile
[2424]135 echo '' >> GNUmakefile
[218]136 @ i++
137end
138
139
140if ( -d ../PI ) then
[1603]141 set cmd = './mkmfPI PI BaseTools'
[218]142 echo "mkmf: Creation makefile lib PI"
143 echo " execution $cmd"
[740]144 $DODBG $cmd
[218]145endif
[1834]146if ( -d ../PIGcont ) then
147 set cmd = './mkmfPI PIGcont BaseTools'
148 echo "mkmf: Creation makefile lib PIGcont"
149 echo " execution $cmd"
150 $DODBG $cmd
151endif
[218]152if ( -d ../PIext ) then
[740]153 set cmd = "./mkmfPI PIext $libnames PI"
[218]154 echo "mkmf: Creation makefile lib PIext"
155 echo " execution $cmd"
[740]156 $DODBG $cmd
[218]157endif
158echo '.PHONY: PI' >> GNUmakefile
159echo 'PI:' >> GNUmakefile
160echo ' if [ -d PI ] ; then cd PI ; $(MAKE) ; fi' >> GNUmakefile
[1834]161echo ' if [ -d PIGcont ] ; then cd PIGcont ; $(MAKE) ; fi' >> GNUmakefile
[218]162echo ' if [ -d PIext ] ; then cd PIext ; $(MAKE) ; fi' >> GNUmakefile
163
164
[751]165echo 'mkmf: Writing shared library building part of the makefile :'
[1783]166if ( `uname` == "Darwin" ) then
167 set sosfx = "dylib"
168else
169 set sosfx = "so"
170endif
[740]171
172echo '# Shared library creation part of the Makefile' >> GNUmakefile
[2424]173echo '' >> GNUmakefile
[740]174echo '# List of libraries (.a)' >> GNUmakefile
175echo 'PSLB = ' $module_libnames >> GNUmakefile
176echo 'EXTPSLB = ' $extmodule_libnames >> GNUmakefile
[2424]177echo 'PIPSLB = $(LIB)libPI.a $(LIB)libPIGcont.a $(LIB)libPIext.a' >> GNUmakefile
[740]178echo '# List of external library references' >> GNUmakefile
[2424]179echo 'EXTLIBL = -L$(EXTLIBPATH)' $extlib_list >> GNUmakefile
180echo 'EXTSLBL = -L$(EXTSLBPATH)' $extslb_list >> GNUmakefile
181echo '' >> GNUmakefile
182echo '# defining the other external libraries needed on different systems' >> GNUmakefile
183echo '' >> GNUmakefile
[2560]184echo '# On Linux lapack and blas and f2c/g2c are needed' >> GNUmakefile
[2424]185echo 'ifeq ($(MACHEROS),Linux)' >> GNUmakefile
186echo '#EXTLIB = $(EXTLIBL) -llapack -lblas -lf2c' >> GNUmakefile
187echo '#EXTSLB = $(EXTSLBL) -llapack -lblas -lf2c' >> GNUmakefile
188echo 'EXTLIB = $(EXTLIBL) -llapack -lblas -lg2c' >> GNUmakefile
189echo 'EXTSLB = $(EXTSLBL) -llapack -lblas -lg2c' >> GNUmakefile
190echo 'endif' >> GNUmakefile
[2560]191echo '# On OSF1 libdxml contains part of Lapack, and the fortran support library is needed' >> GNUmakefile
192echo '# (we still need to add liblapack.a to supply missing lapack routines in dxml)' >> GNUmakefile
[2685]193echo '# (some OSF dxml versions are not OK, please use -lblas instead of -ldxml)' >> GNUmakefile
[2424]194echo 'ifeq ($(MACHEROS),OSF1)' >> GNUmakefile
[2579]195echo 'EXTLIB = $(EXTLIBL) -llapack -ldxml -lfor' >> GNUmakefile
[2573]196echo '###EXTLIB = $(EXTLIBL) -llapack -lblas -lfor' >> GNUmakefile
[2579]197echo 'EXTSLB = $(EXTSLBL) -llapack -ldxml -lfor' >> GNUmakefile
[2573]198echo '###EXTSLB = $(EXTSLBL) -llapack -lblas -lfor' >> GNUmakefile
[2424]199echo 'endif' >> GNUmakefile
200echo '' >> GNUmakefile
201echo '# On IRIX , complib.sgimath contains Lapack' >> GNUmakefile
202echo 'ifeq ($(MACHEROS),IRIX64)' >> GNUmakefile
203echo 'EXTLIB = $(EXTLIBL) -lcomplib.sgimath ' >> GNUmakefile
204echo 'EXTSLB = $(EXTSLBL) -lcomplib.sgimath ' >> GNUmakefile
205echo 'endif' >> GNUmakefile
206echo '' >> GNUmakefile
[740]207echo 'XPILIBS = $(LIBXPIPATH) $(LIBXPILIST)' >> GNUmakefile
[1783]208echo '' >> GNUmakefile
209echo '# main dependence list' >> GNUmakefile
210echo 'slball : slb slbext slbpi ' >> GNUmakefile
211echo 'slb : $(SLB)libsophya.'$sosfx >> GNUmakefile
212echo 'slbext : $(SLB)libextsophya.'$sosfx >> GNUmakefile
213echo 'slbpi : $(SLB)libPI.'$sosfx >> GNUmakefile
[2424]214echo '' >> GNUmakefile
[740]215
216echo '# List of .o files for each module' >> GNUmakefile
217set objalls = ''
218foreach f ($modules_pres)
219 echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)' >> GNUmakefile
220 set objalls = ( $objalls '$(OBJ'$f')' )
221end
222echo 'ALLOBJS =' $objalls >> GNUmakefile
[2424]223echo '' >> GNUmakefile
[740]224
225echo '# List of .o files modules with reference to external libraries' >> GNUmakefile
226set objalls = ''
227foreach f ($extmodules_pres)
228 echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)' >> GNUmakefile
229 set objalls = ( $objalls '$(OBJ'$f')' )
230end
231echo 'ALLEXTOBJS =' $objalls >> GNUmakefile
[2424]232echo '' >> GNUmakefile
[740]233
234echo '# List of .o files for PI modules ' >> GNUmakefile
235set objalls = ''
[1834]236foreach f (PI PIGcont PIext)
[740]237 echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)' >> GNUmakefile
238 set objalls = ( $objalls '$(OBJ'$f')' )
239end
240echo 'ALLPIOBJS =' $objalls >> GNUmakefile
[2424]241echo '' >> GNUmakefile
[740]242
243echo '# Building Sophya shared library' >> GNUmakefile
[1783]244echo '$(SLB)libsophya.'$sosfx' : $(PSLB)' >> GNUmakefile
[740]245echo ' $(CMDTILSHL) ' >> GNUmakefile
246echo ' cd $(OBJ); \' >> GNUmakefile
[1783]247echo ' $(CMDSHLCXX) -o $(SLB)libsophya.'$sosfx' \' >> GNUmakefile
[740]248echo ' $(FGSHLACXX) $(ALLOBJS) $(FGSHLNCXX)\' >> GNUmakefile
249echo ' -L$(SLB) $(LIBLSHL)' >> GNUmakefile
[2424]250echo '' >> GNUmakefile
[740]251
252echo '# Building ExtSophya shared library' >> GNUmakefile
[1783]253echo '$(SLB)libextsophya.'$sosfx' : $(EXTPSLB)' >> GNUmakefile
[740]254echo ' $(CMDTILSHL) ' >> GNUmakefile
255echo ' cd $(OBJ); \' >> GNUmakefile
[1783]256echo ' $(CMDSHLCXX) -o $(SLB)libextsophya.'$sosfx' \' >> GNUmakefile
[740]257echo ' $(FGSHLACXX) $(ALLEXTOBJS) $(FGSHLNCXX)\' >> GNUmakefile
[751]258echo ' -L$(SLB) -lsophya $(EXTLIB) $(LIBLSHL)' >> GNUmakefile
[2424]259echo '' >> GNUmakefile
[740]260
261echo '# Building PI shared library' >> GNUmakefile
[1783]262echo '$(SLB)libPI.'$sosfx' : $(PIPSLB)' >> GNUmakefile
[740]263echo ' $(CMDTILSHL) ' >> GNUmakefile
264echo ' cd $(OBJ); \' >> GNUmakefile
[1783]265echo ' $(CMDSHLCXX) -o $(SLB)libPI.'$sosfx' \' >> GNUmakefile
[751]266echo ' $(FGSHLACXX) $(ALLPIOBJS) $(FGSHLNCXX) \' >> GNUmakefile
267echo ' -L$(SLB) -lsophya -lextsophya $(EXTLIB) $(XPILIBS) $(LIBLSHL)' >> GNUmakefile
[2424]268echo '' >> GNUmakefile
[740]269
270
[218]271cat >> GNUmakefile << __END__
272
273clean:
274 if [ -d \$(LIB) ] ; then cd \$(LIB)/. ; rm -f *.a ; fi
[1783]275 if [ -d \$(SLB) ] ; then cd \$(SLB)/. ; rm -f *.$sosfx ; fi
[740]276 if [ -d \$(OBJ) ] ; then cd \$(OBJ)/. ; rm -f *.o rm -rf cxxrep* ; fi
277# if [ -d PI ] ; then cd PI/. ; \$(MAKE) clean ; fi
[218]278
279__END__
280
281mv GNUmakefile ../GNUmakefile
282
283echo '*** mkmf done ***'
284
Note: See TracBrowser for help on using the repository browser.