Changeset 740 in Sophya for trunk/SophyaLib/Mgr/mkmf


Ignore:
Timestamp:
Feb 25, 2000, 7:34:49 PM (26 years ago)
Author:
ansari
Message:

Mise en place nouveau schema de creation des Makefile et shared-libs , Reza 25/02/2000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Mgr/mkmf

    r737 r740  
    11#!/bin/csh
    2 # $Id: mkmf,v 1.7 2000-02-22 16:31:26 ansari Exp $
    3 
    4 # Librairie cfitsio
     2# $Id: mkmf,v 1.8 2000-02-25 18:34:48 ansari Exp $
     3
     4#  Pour debugger
     5set DODBG = 'echo'
     6
     7# Librairies externe
    58if( ! $?EXTLIBDIR ) then
    6  echo 'EXTLIBDIR library: EXTLIBDIR variable need to be set'
     9  echo 'mkmf- WARNING (External libraries) EXTLIBDIR variable not set'
    710endif
    811
     
    1316# creation des liens pour les includes
    1417echo 'mkmf: Creating links for *.h (call mkmflien)'
    15 ./mkmflien
     18$DODBG ./mkmflien
     19
     20# Liste des modules a construire
     21# modules : Liste de module SOPHYA, sans dependance exterieure
     22# extmodules : Liste de modules avec dependance exterieures
     23#        _pres : Liste des modules presents
     24
     25set modules = `cat libdirs`
     26set extmodules = `cat extlibdirs`
     27set modules_pres = ''
     28set extmodules_pres = ''
     29
     30set module_libnames = ''
     31set extmodule_libnames = ''
     32set extlib_list = ''
     33set extslb_list = ''
     34#  Constitution de la liste de modules present
     35foreach f ($modules)
     36  if (-d ../$f ) then
     37    set modules_pres = ( $modules_pres $f )
     38    set module_libnames = ( $module_libnames '$(LIB)lib'$f.a )
     39  endif
     40end
     41foreach f ($extmodules)
     42  if (-d ../$f ) then
     43    set extmodules_pres = ( $extmodules_pres $f )
     44    set extmodule_libnames = ( $extmodule_libnames '$(LIB)lib'$f.a )
     45    set lil = "../$f/extlib_list"
     46    if (-f $lil ) set extlib_list = ($extlib_list `sed -e 's/.*/-l&/' $lil`)
     47    set lil = "../$f/extslb_list"
     48    if (-f $lil ) set extslb_list = ($extslb_list `sed -e 's/.*/-l&/' $lil`)
     49  endif
     50end
     51
     52echo 'mkmf: List of modules '
     53echo '  ... modules= ' $modules_pres
     54echo $module_libnames
     55echo '  ... extmodules= ' $extmodules_pres
     56echo $extmodule_libnames
    1657
    1758echo 'mkmf: Creating makefile global :'
    1859rm -f GNUmakefile
    1960
     61echo '# include files defining compiler/linker options '  >> GNUmakefile
     62echo 'MODULECXXREPNAME := PI'  >> GNUmakefile
    2063echo 'include Mgr/Makefile.h' >> GNUmakefile
     64echo 'include Mgr/Makefile.slb' >> GNUmakefile
     65echo ''   >> GNUmakefile
    2166
    2267echo 'LIBF = ' `sed -e 's/.*/$(LIB)lib&.a/' libdirs` >> GNUmakefile
     
    3176defaut: libs
    3277
    33 all: libs PI
    34 
     78all: libs extlibs PI
    3579
    3680libs: cxxlibs
     81
     82extlibs: cxxextlibs
     83
     84EOF
     85
    3786# Dans cet ordre pour les templates de cxx, a cause des dependances
    3887# pour instantiation automatique/manuels
    3988
    40 cxxlibs: FitsIOServer SkyT Samba NTools SysTools Blitz
    41 
    42 EOF
     89echo 'cxxlibs: ' $modules_pres >>    GNUmakefile
     90echo ' ' >> GNUmakefile
     91echo 'cxxextlibs: ' $extmodules_pres >> GNUmakefile
    4392
    4493
    4594#  Attention, ne pas changer l'ordre de libnames dependances cxx
    46 set libnames = (FitsIOServer SkyT Samba NTools SysTools Blitz )
     95set libnames = ($modules_pres $extmodules_pres)
    4796set i = 1
    4897set j = $#libnames ; @ j--
     
    54103    echo "mkmf: Creation makefile lib $f"
    55104    echo "   execution $cmd"
    56     $cmd
     105    $DODBG $cmd
    57106  endif
    58107  echo '.PHONY: ' $f >> GNUmakefile
     
    68117  echo "mkmf: Creation makefile lib PI"
    69118  echo "   execution $cmd"
    70   $cmd
     119  $DODBG  $cmd
    71120endif
    72121if ( -d ../PIext ) then
    73   set cmd = './mkmfPI PIext SysTools NTools Samba SkyT PI'
     122  set cmd = "./mkmfPI PIext $libnames PI"
    74123  echo "mkmf: Creation makefile lib PIext"
    75124  echo "   execution $cmd"
    76   $cmd
     125  $DODBG $cmd
    77126endif
    78127echo '.PHONY: PI' >> GNUmakefile
     
    81130echo '  if [ -d PIext ] ; then cd PIext ; $(MAKE) ; fi' >> GNUmakefile
    82131
    83 cat Makefile.slb >> GNUmakefile
     132
     133
     134echo '#  Shared library creation part of the Makefile'       >> GNUmakefile
     135echo ' '                                 >> GNUmakefile
     136echo '#  List of libraries (.a)'         >> GNUmakefile
     137echo 'PSLB = ' $module_libnames          >> GNUmakefile
     138echo 'EXTPSLB = ' $extmodule_libnames    >> GNUmakefile
     139echo 'PIPSLB =  $(LIB)libPI.a  $(LIB)libPIext.a'   >> GNUmakefile
     140echo '#  List of external library references'       >> GNUmakefile
     141echo 'EXTLIB  = -L$(EXTLIBPATH)' $extlib_list       >> GNUmakefile
     142echo 'EXTSLB  = -L$(EXTSLBPATH)' $extlib_list       >> GNUmakefile
     143echo 'XPILIBS = $(LIBXPIPATH) $(LIBXPILIST)'        >> GNUmakefile
     144echo ''                                  >> GNUmakefile
     145echo '#  main dependence list'           >> GNUmakefile
     146echo 'slball : slb slbext slbpi '        >> GNUmakefile
     147echo 'slb : $(SLB)libsophya.so '         >> GNUmakefile
     148echo 'slbext : $(SLB)libextsophya.so   ' >> GNUmakefile
     149echo 'slbpi : $(SLB)libPI.so'            >> GNUmakefile
     150echo ' '                                 >> GNUmakefile
     151
     152echo '# List of .o files for each module'  >> GNUmakefile
     153set objalls =  ''
     154foreach f ($modules_pres)
     155  echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)'  >> GNUmakefile
     156  set objalls = ( $objalls '$(OBJ'$f')' )
     157end
     158echo 'ALLOBJS =' $objalls                >> GNUmakefile
     159echo ' '                                 >> GNUmakefile
     160
     161echo '# List of .o files modules with reference to external libraries'  >> GNUmakefile
     162set objalls =  ''
     163foreach f ($extmodules_pres)
     164  echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)'  >> GNUmakefile
     165  set objalls = ( $objalls '$(OBJ'$f')' )
     166end
     167echo 'ALLEXTOBJS =' $objalls             >> GNUmakefile
     168echo ' '                                 >> GNUmakefile
     169
     170echo '# List of .o files for PI modules '  >> GNUmakefile
     171set objalls =  ''
     172foreach f (PI PIext)
     173  echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)'  >> GNUmakefile
     174  set objalls = ( $objalls '$(OBJ'$f')' )
     175end
     176echo 'ALLPIOBJS =' $objalls              >> GNUmakefile
     177echo ' '                                 >> GNUmakefile
     178
     179echo '# Building Sophya shared library'  >> GNUmakefile
     180echo '$(SLB)libsophya.so : $(PSLB)'                             >> GNUmakefile
     181echo '  $(CMDTILSHL) '                                          >> GNUmakefile
     182echo '  cd  $(OBJ); \'                                          >> GNUmakefile
     183echo '  $(CMDSHLCXX) -o $(SLB)libsophya.so  \'                  >> GNUmakefile
     184echo '  $(FGSHLACXX) $(ALLOBJS)  $(FGSHLNCXX)\'                 >> GNUmakefile
     185echo '  -L$(SLB) $(LIBLSHL)'                                    >> GNUmakefile
     186echo ' '                                                        >> GNUmakefile
     187
     188echo '# Building ExtSophya shared library'  >> GNUmakefile
     189echo '$(SLB)libextsophya.so : $(EXTPSLB)'                       >> GNUmakefile
     190echo '  $(CMDTILSHL) '                                          >> GNUmakefile
     191echo '  cd  $(OBJ); \'                                          >> GNUmakefile
     192echo '  $(CMDSHLCXX) -o $(SLB)libextsophya.so  \'               >> GNUmakefile
     193echo '  $(FGSHLACXX) $(ALLEXTOBJS)  $(FGSHLNCXX)\'              >> GNUmakefile
     194echo '  -L$(SLB) -lsophya $(EXTSLB) $(LIBLSHL)'                 >> GNUmakefile
     195echo ' '                                                        >> GNUmakefile
     196
     197echo '# Building PI shared library'  >> GNUmakefile
     198echo '$(SLB)libPI.so : $(PIPSLB)'                               >> GNUmakefile
     199echo '  $(CMDTILSHL) '                                          >> GNUmakefile
     200echo '  cd  $(OBJ); \'                                          >> GNUmakefile
     201echo '  $(CMDSHLCXX) -o $(SLB)libPI.so  \'                      >> GNUmakefile
     202echo '  $(FGSHLACXX) $(ALLPIOBJS) $(FGSHLNCXX) \'                >> GNUmakefile
     203echo '  -L$(SLB) -lsophya -lextsophya $(EXTSLB) $(XPILIBS) $(LIBLSHL)'      >> GNUmakefile
     204echo ' '                                                        >> GNUmakefile
     205
    84206
    85207cat >> GNUmakefile << __END__
     
    88210        if [ -d \$(LIB) ] ; then cd \$(LIB)/. ; rm -f *.a  ; fi
    89211        if [ -d \$(SLB) ] ; then cd \$(SLB)/. ; rm -f *.so ; fi
    90         if [ -d \$(OBJ) ] ; then cd \$(OBJ)/. ; rm -f *.o  ; fi
    91         if [ -d \$(OBJ)/cxxrep ] ; then cd \$(OBJ)/cxxrep/. ; rm -f *.o  ; fi
    92         if [ -d PI ]     ; then cd PI/.     ; \$(MAKE) clean ; fi
     212        if [ -d \$(OBJ) ] ; then cd \$(OBJ)/. ; rm -f *.o  rm -rf cxxrep* ; fi
     213#       if [ -d PI ]     ; then cd PI/.     ; \$(MAKE) clean ; fi
    93214
    94215__END__
Note: See TracChangeset for help on using the changeset viewer.