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