| [218] | 1 | #!/bin/csh 
 | 
|---|
| [2424] | 2 | # $Id: mkmf,v 1.18 2003-08-28 14:26:09 cmv Exp $
 | 
|---|
| [218] | 3 | 
 | 
|---|
| [740] | 4 | #  Pour debugger 
 | 
|---|
 | 5 | set DODBG = 'echo'
 | 
|---|
| [742] | 6 | set DODBG = ''
 | 
|---|
| [740] | 7 | 
 | 
|---|
 | 8 | # Librairies externe
 | 
|---|
| [737] | 9 | if( ! $?EXTLIBDIR ) then
 | 
|---|
| [740] | 10 |   echo 'mkmf- WARNING (External libraries) EXTLIBDIR variable not set'
 | 
|---|
| [554] | 11 | endif
 | 
|---|
 | 12 | 
 | 
|---|
| [218] | 13 | # creation de MakefileUser.h a partir de Makefile.h
 | 
|---|
| [968] | 14 | chmod +x ./makefileuser.csh
 | 
|---|
 | 15 | $DODBG ./makefileuser.csh
 | 
|---|
| [218] | 16 | 
 | 
|---|
 | 17 | # creation des liens pour les includes
 | 
|---|
| [554] | 18 | echo 'mkmf: Creating links for *.h (call mkmflien)'
 | 
|---|
| [968] | 19 | chmod +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 | 
 | 
|---|
 | 27 | set modules = `cat libdirs`
 | 
|---|
 | 28 | set extmodules = `cat extlibdirs` 
 | 
|---|
 | 29 | set modules_pres = ''
 | 
|---|
 | 30 | set extmodules_pres = ''
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | set module_libnames = ''
 | 
|---|
 | 33 | set extmodule_libnames = ''
 | 
|---|
 | 34 | set extlib_list = ''
 | 
|---|
 | 35 | set extslb_list = ''
 | 
|---|
 | 36 | #  Constitution de la liste de modules present
 | 
|---|
 | 37 | foreach 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
 | 
|---|
 | 42 | end
 | 
|---|
 | 43 | foreach 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
 | 
|---|
 | 52 | end
 | 
|---|
 | 53 | 
 | 
|---|
 | 54 | echo 'mkmf: List of modules ' 
 | 
|---|
 | 55 | echo '  ... modules= ' $modules_pres
 | 
|---|
 | 56 | echo $module_libnames 
 | 
|---|
 | 57 | echo '  ... extmodules= ' $extmodules_pres
 | 
|---|
 | 58 | echo $extmodule_libnames 
 | 
|---|
 | 59 | 
 | 
|---|
| [554] | 60 | echo 'mkmf: Creating makefile global :'
 | 
|---|
| [1821] | 61 | rm -f GNUmakefile; touch GNUmakefile
 | 
|---|
| [218] | 62 | 
 | 
|---|
| [740] | 63 | echo '# include files defining compiler/linker options '  >> GNUmakefile
 | 
|---|
 | 64 | echo 'MODULECXXREPNAME := PI'  >> GNUmakefile
 | 
|---|
| [218] | 65 | echo 'include Mgr/Makefile.h' >> GNUmakefile
 | 
|---|
| [740] | 66 | echo 'include Mgr/Makefile.slb' >> GNUmakefile
 | 
|---|
 | 67 | echo ''   >> GNUmakefile
 | 
|---|
| [218] | 68 | 
 | 
|---|
 | 69 | echo 'LIBF = ' `sed -e 's/.*/$(LIB)lib&.a/' libdirs` >> GNUmakefile
 | 
|---|
| [823] | 70 | # echo 'LIBS = -L$(LIB)' `sed -e 's/.*/-l&/' libdirs` '-lm' >> GNUmakefile
 | 
|---|
 | 71 | echo '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 | 
 | 
|---|
 | 77 | cat >> GNUmakefile <<EOF
 | 
|---|
 | 78 | 
 | 
|---|
 | 79 | defaut: libs
 | 
|---|
 | 80 | 
 | 
|---|
| [740] | 81 | all: libs extlibs PI
 | 
|---|
| [218] | 82 | 
 | 
|---|
| [740] | 83 | libs: cxxlibs
 | 
|---|
| [218] | 84 | 
 | 
|---|
| [740] | 85 | extlibs: cxxextlibs
 | 
|---|
 | 86 | 
 | 
|---|
 | 87 | EOF
 | 
|---|
 | 88 | 
 | 
|---|
| [218] | 89 | # Dans cet ordre pour les templates de cxx, a cause des dependances
 | 
|---|
 | 90 | # pour instantiation automatique/manuels
 | 
|---|
 | 91 | 
 | 
|---|
| [740] | 92 | echo 'cxxlibs: ' $modules_pres >>    GNUmakefile
 | 
|---|
| [2424] | 93 | echo '' >> GNUmakefile 
 | 
|---|
| [740] | 94 | echo 'cxxextlibs: ' $extmodules_pres >> GNUmakefile
 | 
|---|
| [218] | 95 | 
 | 
|---|
| [2424] | 96 | # pour creer les repertoires et les liens
 | 
|---|
| [218] | 97 | 
 | 
|---|
| [2424] | 98 | echo '#--- Create directory and copy includes for install' >> GNUmakefile
 | 
|---|
 | 99 | echo 'depend:' >> GNUmakefile
 | 
|---|
 | 100 | echo 'ifdef DPCDEVREP' >> GNUmakefile
 | 
|---|
 | 101 | echo 'ifdef EROSCXX' >> GNUmakefile
 | 
|---|
 | 102 | echo '  @echo "Sophya will be installed under:"' >> GNUmakefile
 | 
|---|
 | 103 | echo '  @echo "  $(DPCDEVREP)/Include" ' >> GNUmakefile
 | 
|---|
 | 104 | echo '  @echo "  $(DPCDEVREP)/`uname`-$(EROSCXX)" ' >> GNUmakefile
 | 
|---|
 | 105 | echo '  if [ -d Mgr ] ; then cd Mgr; \' >> GNUmakefile
 | 
|---|
 | 106 | echo '  ./crerep_sophya $(DPCDEVREP) `uname`-$(EROSCXX); \' >> GNUmakefile
 | 
|---|
 | 107 | echo '  ./makefileuser.csh; \' >> GNUmakefile
 | 
|---|
 | 108 | echo '  ./mkmflien -copy ; \' >> GNUmakefile
 | 
|---|
 | 109 | echo '  fi' >> GNUmakefile
 | 
|---|
 | 110 | echo 'else' >> GNUmakefile
 | 
|---|
 | 111 | echo '  @echo "Variable EROSCXX must be define with setenv"' >> GNUmakefile
 | 
|---|
 | 112 | echo 'endif' >> GNUmakefile
 | 
|---|
 | 113 | echo 'else' >> GNUmakefile
 | 
|---|
 | 114 | echo '  @echo "Variable DPCDEVREP must be define with setenv"' >> GNUmakefile
 | 
|---|
 | 115 | echo 'endif' >> GNUmakefile
 | 
|---|
 | 116 | echo '#--------------------------------------------------------------------' >> GNUmakefile
 | 
|---|
 | 117 | echo '' >> GNUmakefile
 | 
|---|
 | 118 | 
 | 
|---|
| [751] | 119 | #  Attention, ne pas changer l'ordre de libnames dependances cxx  ????? 
 | 
|---|
| [740] | 120 | set libnames = ($modules_pres $extmodules_pres)
 | 
|---|
| [218] | 121 | set i = 1
 | 
|---|
 | 122 | set j = $#libnames ; @ j--
 | 
|---|
 | 123 | while ($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++
 | 
|---|
 | 137 | end
 | 
|---|
 | 138 | 
 | 
|---|
 | 139 | 
 | 
|---|
 | 140 | if ( -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] | 145 | endif
 | 
|---|
| [1834] | 146 | if ( -d ../PIGcont ) then 
 | 
|---|
 | 147 |   set cmd = './mkmfPI PIGcont BaseTools'
 | 
|---|
 | 148 |   echo "mkmf: Creation makefile lib PIGcont"
 | 
|---|
 | 149 |   echo "   execution $cmd"
 | 
|---|
 | 150 |   $DODBG  $cmd
 | 
|---|
 | 151 | endif
 | 
|---|
| [218] | 152 | if ( -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] | 157 | endif
 | 
|---|
 | 158 | echo '.PHONY: PI' >> GNUmakefile
 | 
|---|
 | 159 | echo 'PI:' >> GNUmakefile
 | 
|---|
 | 160 | echo '  if [ -d PI ] ; then cd PI ; $(MAKE) ; fi' >> GNUmakefile
 | 
|---|
| [1834] | 161 | echo '  if [ -d PIGcont ] ; then cd PIGcont ; $(MAKE) ; fi' >> GNUmakefile
 | 
|---|
| [218] | 162 | echo '  if [ -d PIext ] ; then cd PIext ; $(MAKE) ; fi' >> GNUmakefile
 | 
|---|
 | 163 | 
 | 
|---|
 | 164 | 
 | 
|---|
| [751] | 165 | echo 'mkmf: Writing shared library building part of the makefile :'
 | 
|---|
| [1783] | 166 | if ( `uname` == "Darwin" ) then
 | 
|---|
 | 167 |   set sosfx = "dylib"
 | 
|---|
 | 168 | else
 | 
|---|
 | 169 |   set sosfx = "so"
 | 
|---|
 | 170 | endif
 | 
|---|
| [740] | 171 | 
 | 
|---|
 | 172 | echo '#  Shared library creation part of the Makefile'       >> GNUmakefile
 | 
|---|
| [2424] | 173 | echo ''                                 >> GNUmakefile
 | 
|---|
| [740] | 174 | echo '#  List of libraries (.a)'         >> GNUmakefile
 | 
|---|
 | 175 | echo 'PSLB = ' $module_libnames          >> GNUmakefile
 | 
|---|
 | 176 | echo 'EXTPSLB = ' $extmodule_libnames    >> GNUmakefile
 | 
|---|
| [2424] | 177 | echo 'PIPSLB =  $(LIB)libPI.a $(LIB)libPIGcont.a $(LIB)libPIext.a'   >> GNUmakefile
 | 
|---|
| [740] | 178 | echo '#  List of external library references'       >> GNUmakefile
 | 
|---|
| [2424] | 179 | echo 'EXTLIBL  = -L$(EXTLIBPATH)' $extlib_list       >> GNUmakefile
 | 
|---|
 | 180 | echo 'EXTSLBL  = -L$(EXTSLBPATH)' $extslb_list       >> GNUmakefile
 | 
|---|
 | 181 | echo ''                                   >> GNUmakefile
 | 
|---|
 | 182 | echo '# defining the other external libraries needed on different systems'   >> GNUmakefile
 | 
|---|
 | 183 | echo ''                                   >> GNUmakefile
 | 
|---|
 | 184 | echo '# On Linux   lapack and blas and f2c/g2c ere needed'   >> GNUmakefile
 | 
|---|
 | 185 | echo 'ifeq ($(MACHEROS),Linux)'   >> GNUmakefile
 | 
|---|
 | 186 | echo '#EXTLIB = $(EXTLIBL) -llapack -lblas -lf2c'   >> GNUmakefile
 | 
|---|
 | 187 | echo '#EXTSLB = $(EXTSLBL) -llapack -lblas -lf2c'   >> GNUmakefile
 | 
|---|
 | 188 | echo 'EXTLIB = $(EXTLIBL) -llapack -lblas -lg2c'   >> GNUmakefile
 | 
|---|
 | 189 | echo 'EXTSLB = $(EXTSLBL) -llapack -lblas -lg2c'   >> GNUmakefile
 | 
|---|
 | 190 | echo 'endif'   >> GNUmakefile
 | 
|---|
 | 191 | echo '# On OSF1 libdxml contains Lapack, but the fortran support library is needed'   >> GNUmakefile
 | 
|---|
 | 192 | echo 'ifeq ($(MACHEROS),OSF1)'   >> GNUmakefile
 | 
|---|
 | 193 | echo 'EXTLIB = $(EXTLIBL) -ldxml -lfor'   >> GNUmakefile
 | 
|---|
 | 194 | echo 'EXTSLB = $(EXTSLBL) -ldxml -lfor'   >> GNUmakefile
 | 
|---|
 | 195 | echo 'endif'   >> GNUmakefile
 | 
|---|
 | 196 | echo ''                                   >> GNUmakefile
 | 
|---|
 | 197 | echo '# On IRIX , complib.sgimath contains Lapack'   >> GNUmakefile
 | 
|---|
 | 198 | echo 'ifeq ($(MACHEROS),IRIX64)'   >> GNUmakefile
 | 
|---|
 | 199 | echo 'EXTLIB = $(EXTLIBL) -lcomplib.sgimath '   >> GNUmakefile
 | 
|---|
 | 200 | echo 'EXTSLB = $(EXTSLBL) -lcomplib.sgimath '   >> GNUmakefile
 | 
|---|
 | 201 | echo 'endif'   >> GNUmakefile
 | 
|---|
 | 202 | echo ''                                   >> GNUmakefile
 | 
|---|
| [740] | 203 | echo 'XPILIBS = $(LIBXPIPATH) $(LIBXPILIST)'        >> GNUmakefile
 | 
|---|
| [1783] | 204 | echo ''                                   >> GNUmakefile
 | 
|---|
 | 205 | echo '#  main dependence list'            >> GNUmakefile
 | 
|---|
 | 206 | echo 'slball : slb slbext slbpi '         >> GNUmakefile
 | 
|---|
 | 207 | echo 'slb : $(SLB)libsophya.'$sosfx       >> GNUmakefile
 | 
|---|
 | 208 | echo 'slbext : $(SLB)libextsophya.'$sosfx >> GNUmakefile
 | 
|---|
 | 209 | echo 'slbpi : $(SLB)libPI.'$sosfx         >> GNUmakefile
 | 
|---|
| [2424] | 210 | echo ''                                  >> GNUmakefile
 | 
|---|
| [740] | 211 | 
 | 
|---|
 | 212 | echo '# List of .o files for each module'  >> GNUmakefile
 | 
|---|
 | 213 | set objalls =  ''
 | 
|---|
 | 214 | foreach f ($modules_pres)
 | 
|---|
 | 215 |   echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)'  >> GNUmakefile
 | 
|---|
 | 216 |   set objalls = ( $objalls '$(OBJ'$f')' )
 | 
|---|
 | 217 | end
 | 
|---|
 | 218 | echo 'ALLOBJS =' $objalls                >> GNUmakefile
 | 
|---|
| [2424] | 219 | echo ''                                 >> GNUmakefile
 | 
|---|
| [740] | 220 | 
 | 
|---|
 | 221 | echo '# List of .o files modules with reference to external libraries'  >> GNUmakefile
 | 
|---|
 | 222 | set objalls =  ''
 | 
|---|
 | 223 | foreach f ($extmodules_pres)
 | 
|---|
 | 224 |   echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)'  >> GNUmakefile
 | 
|---|
 | 225 |   set objalls = ( $objalls '$(OBJ'$f')' )
 | 
|---|
 | 226 | end
 | 
|---|
 | 227 | echo 'ALLEXTOBJS =' $objalls             >> GNUmakefile
 | 
|---|
| [2424] | 228 | echo ''                                 >> GNUmakefile
 | 
|---|
| [740] | 229 | 
 | 
|---|
 | 230 | echo '# List of .o files for PI modules '  >> GNUmakefile
 | 
|---|
 | 231 | set objalls =  ''
 | 
|---|
| [1834] | 232 | foreach f (PI PIGcont PIext)
 | 
|---|
| [740] | 233 |   echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)'  >> GNUmakefile
 | 
|---|
 | 234 |   set objalls = ( $objalls '$(OBJ'$f')' )
 | 
|---|
 | 235 | end
 | 
|---|
 | 236 | echo 'ALLPIOBJS =' $objalls              >> GNUmakefile
 | 
|---|
| [2424] | 237 | echo ''                                 >> GNUmakefile
 | 
|---|
| [740] | 238 | 
 | 
|---|
 | 239 | echo '# Building Sophya shared library'  >> GNUmakefile
 | 
|---|
| [1783] | 240 | echo '$(SLB)libsophya.'$sosfx' : $(PSLB)'                       >> GNUmakefile
 | 
|---|
| [740] | 241 | echo '  $(CMDTILSHL) '                                          >> GNUmakefile
 | 
|---|
 | 242 | echo '  cd  $(OBJ); \'                                          >> GNUmakefile
 | 
|---|
| [1783] | 243 | echo '  $(CMDSHLCXX) -o $(SLB)libsophya.'$sosfx'  \'            >> GNUmakefile
 | 
|---|
| [740] | 244 | echo '  $(FGSHLACXX) $(ALLOBJS)  $(FGSHLNCXX)\'                 >> GNUmakefile
 | 
|---|
 | 245 | echo '  -L$(SLB) $(LIBLSHL)'                                    >> GNUmakefile
 | 
|---|
| [2424] | 246 | echo ''                                                        >> GNUmakefile
 | 
|---|
| [740] | 247 | 
 | 
|---|
 | 248 | echo '# Building ExtSophya shared library'  >> GNUmakefile
 | 
|---|
| [1783] | 249 | echo '$(SLB)libextsophya.'$sosfx' : $(EXTPSLB)'                 >> GNUmakefile
 | 
|---|
| [740] | 250 | echo '  $(CMDTILSHL) '                                          >> GNUmakefile
 | 
|---|
 | 251 | echo '  cd  $(OBJ); \'                                          >> GNUmakefile
 | 
|---|
| [1783] | 252 | echo '  $(CMDSHLCXX) -o $(SLB)libextsophya.'$sosfx'  \'         >> GNUmakefile
 | 
|---|
| [740] | 253 | echo '  $(FGSHLACXX) $(ALLEXTOBJS)  $(FGSHLNCXX)\'              >> GNUmakefile
 | 
|---|
| [751] | 254 | echo '  -L$(SLB) -lsophya $(EXTLIB) $(LIBLSHL)'                 >> GNUmakefile
 | 
|---|
| [2424] | 255 | echo ''                                                        >> GNUmakefile
 | 
|---|
| [740] | 256 | 
 | 
|---|
 | 257 | echo '# Building PI shared library'  >> GNUmakefile
 | 
|---|
| [1783] | 258 | echo '$(SLB)libPI.'$sosfx' : $(PIPSLB)'                         >> GNUmakefile
 | 
|---|
| [740] | 259 | echo '  $(CMDTILSHL) '                                          >> GNUmakefile
 | 
|---|
 | 260 | echo '  cd  $(OBJ); \'                                          >> GNUmakefile
 | 
|---|
| [1783] | 261 | echo '  $(CMDSHLCXX) -o $(SLB)libPI.'$sosfx'  \'                >> GNUmakefile
 | 
|---|
| [751] | 262 | echo '  $(FGSHLACXX) $(ALLPIOBJS) $(FGSHLNCXX) \'               >> GNUmakefile
 | 
|---|
 | 263 | echo '  -L$(SLB) -lsophya -lextsophya $(EXTLIB) $(XPILIBS) $(LIBLSHL)'      >> GNUmakefile
 | 
|---|
| [2424] | 264 | echo ''                                                        >> GNUmakefile
 | 
|---|
| [740] | 265 | 
 | 
|---|
 | 266 | 
 | 
|---|
| [218] | 267 | cat >> GNUmakefile << __END__
 | 
|---|
 | 268 | 
 | 
|---|
 | 269 | clean:
 | 
|---|
 | 270 |         if [ -d \$(LIB) ] ; then cd \$(LIB)/. ; rm -f *.a  ; fi
 | 
|---|
| [1783] | 271 |         if [ -d \$(SLB) ] ; then cd \$(SLB)/. ; rm -f *.$sosfx ; fi
 | 
|---|
| [740] | 272 |         if [ -d \$(OBJ) ] ; then cd \$(OBJ)/. ; rm -f *.o  rm -rf cxxrep* ; fi
 | 
|---|
 | 273 | #       if [ -d PI ]     ; then cd PI/.     ; \$(MAKE) clean ; fi
 | 
|---|
| [218] | 274 | 
 | 
|---|
 | 275 | __END__
 | 
|---|
 | 276 | 
 | 
|---|
 | 277 | mv GNUmakefile ../GNUmakefile
 | 
|---|
 | 278 | 
 | 
|---|
 | 279 | echo '*** mkmf done ***'
 | 
|---|
 | 280 | 
 | 
|---|