Index: /trunk/SophyaLib/Mgr/Makefile.h
===================================================================
--- /trunk/SophyaLib/Mgr/Makefile.h	(revision 739)
+++ /trunk/SophyaLib/Mgr/Makefile.h	(revision 740)
@@ -1,7 +1,7 @@
 #  -*- makefile -*-
-# ######################### PEIDA++ ############################# 
+# #########################  Sophya ############################# 
 # ##### LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA #####
 # ############################################################### 
-# General setup GNU Makefile for EROS. To be included in all makefiles.  
+# General setup GNU Makefile for Sopyha/Planck. To be included in all makefiles.  
 # Define  makefile variables according to CPU 
 # MACHEROSD = `uname | sed 's/-//'`   i.e. { AIX HPUX OSF1 Linux ... }
@@ -153,22 +153,19 @@
 endif
 
-
-# Chemin pour la librairie cfitsio
-# les *.h doivent etre sous $CFITSIODIR
-# la librairie *.a sous $CFITSIODIR
-# ifdef CFITSIODIR
-#  FITSIOREP := -I$(CFITSIODIR)
-#  FITSIOLIB := -L$(CFITSIODIR)/$(MACHDIR) -lcfitsio
-# endif
-
 # Chemin pour les include et fichiers d'autres librairies
-EXTINC := 
-EXTLIB := 
-EXTSLB := 
+EXTINCPI := 
+EXTLIBPL := 
+EXTSLBPL := 
+EXTINCPATH := 
+EXTLIBPATH := 
+EXTSLBPATH := 
 
 ifdef EXTLIBDIR
- EXTINC := $(EXTLIBDIR)/Include/
- EXTLIB := $(EXTLIBDIR)/$(MACHDIR)/Libs/
- EXTSLB := $(EXTLIBDIR)/$(MACHDIR)/ShLibs/
+ EXTINCPI := -I$(EXTLIBDIR)/Include/
+ EXTLIBPL := -L$(EXTLIBDIR)/$(MACHDIR)/Libs/
+ EXTSLBPL := -L$(EXTLIBDIR)/$(MACHDIR)/ShLibs/
+ EXTINCPATH := $(EXTLIBDIR)/Include/
+ EXTLIBPATH := $(EXTLIBDIR)/$(MACHDIR)/Libs/
+ EXTSLBPATH := $(EXTLIBDIR)/$(MACHDIR)/ShLibs/
 endif
 
@@ -178,5 +175,5 @@
 #endif
 
-CPPFLAGS     :=  -I${INC} -I$(EXTINC) -D${MACHEROSD} $(MODULECPPFLAGS)
+CPPFLAGS     :=  -I${INC} $(EXTINCPI) -D${MACHEROSD} $(MODULECPPFLAGS)
 
 # Les options selon les divers compilateurs
Index: /trunk/SophyaLib/Mgr/Makefile.slb
===================================================================
--- /trunk/SophyaLib/Mgr/Makefile.slb	(revision 739)
+++ /trunk/SophyaLib/Mgr/Makefile.slb	(revision 740)
@@ -1,15 +1,19 @@
-
-ifndef NOSHLIB
-
-ifdef CFITSIODIR
-PSLB = $(LIB)libSysTools.a $(LIB)libNTools.a $(LIB)libSamba.a $(LIB)libSkyT.a $(LIB)libFitsIOServer.a 
-else
-PSLB = $(LIB)libSysTools.a $(LIB)libNTools.a $(LIB)libSamba.a $(LIB)libSkyT.a
-endif
-slb : $(SLB)libtools.so
-slbpi: slb $(SLB)libPI.so
+#  -*- makefile -*-
+# #########################  Sophya ############################# 
+# ##### LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA #####
+# ############################################################### 
+# General setup GNU Makefile for Sopyha/Planck. To be included 
+# for building shared libraries
+#---------------------------------------------------------------------------
 
 #  Chemin des librairies Motifs / X11 (pour chemin non standard)
-LIBXPATH :=
+LIBXPIPATH :=
+# et liste des librairies pour PI (X11, Motif) 
+LIBXPILIST := -lXm -lXt -lX11
+
+#  External libraries
+EXTLIB := 
+EXTSLB := 
+
 #  Commande de construction de shared-lib 
 CMDSHL := ld -partage
@@ -18,11 +22,11 @@
 FGSHLN := -rien
 #  Librairies specifiques 
-LIBLSHL := 
+LIBLSHL := -lm -lc
 #  Librairie d'instanciation des templates 
 TILSHL := 
 TILSHLPI := 
 #   Commande de construction de la librairie d'instanciation des templates 
-CMDTILSHL := echo 'Cas Non Prevu'
-CMDTILSHLPI := echo 'Cas Non Prevu'
+CMDTILSHL := echo 'No Template instanciation library (.a)'
+CMDTILSHLPI  := echo 'No Template instanciation library (.a)'
 # Utilisation du compilo C++ comme driver pour fabrication des shared-libs
 CMDSHLCXX := $(LINK.cc) 
@@ -30,5 +34,5 @@
 FGSHLNCXX := 
 #  S'il faut utiliser $(CMDSHLCXX) pour fabrication des shared-libs
-USECXX4SO := N
+USECXX4SO := Y
 # On utilise le compilo g++ pour la fabrication des shared libs
 ifeq ($(EROSCXX), g++)
@@ -56,17 +60,14 @@
   override LIBLSHL := -lcxxstd -lcxx -lexc -lm -lc -lrt
   override TILSHL := $(LIB)libertcxx.a
-  override CMDTILSHL := rm -f $(LIB)libertcxx.a ; cd $(REP); $(AR) $(ARFLAGS) $(LIB)libertcxx.a *.o
-  override TILSHLPI := $(LIB)libertcxxpi.a
-  override CMDTILSHLPI := rm -f $(LIB)libertcxxpi.a ; cd $(REPPI); $(AR) $(ARFLAGS) $(LIB)libertcxxpi.a *.o
+  override CMDTILSHL := rm -f $(LIB)libsotcxx.a ; cd $(REP); $(AR) $(ARFLAGS) $(LIB)libsotcxx.a *.o
+  override TILSHLPI := $(LIB)libsotcxxpi.a
+  override CMDTILSHLPI := rm -f $(LIB)libsotcxxpi.a ; cd $(REPPI); $(AR) $(ARFLAGS) $(LIB)libsotcxxpi.a *.o
   ifeq ($(CXX),g++)
     override LIBLSHL := $(LIBG) -lm -lc
     override TILSHL := 
-    override CMDTILSHL := echo 'No Template instanciation library'
     override TILSHLPI := 
-    override CMDTILSHLPI := echo 'No Template instanciation library'
-    override USECXX4SO := N
   endif
 #  Attention - Dangereux de mettre -expect_unresolved , enleve  Reza 17/11/99
-  override CMDSHLCXX := $(LINK.cc) -shared  
+  override CMDSHLCXX :=  $(CXX) $(CXXFLAGS) -shared 
   override FGSHLACXX := 
   override FGSHLNCXX := 
@@ -86,6 +87,6 @@
   override LIBLSHL := $(LIBG) -lm -ldl
   override TILSHL := 
-  override CMDTILSHL := echo 'No Template instanciation library'
-  override LIBXPATH := -L/usr/X11/lib -L/usr/X11R6/lib
+  override LIBXPIPATH := -L/usr/X11/lib 
+  override LIBXPILIST := -lXm -lXt -lXext -lX11
 endif
 
@@ -97,6 +98,5 @@
   override LIBLSHL := $(LIBG) -lm -lc
   override TILSHL := 
-  override CMDTILSHL := echo 'No Template instanciation library'
-  override LIBXPATH := -L/usr/X11/lib
+  override LIBXPIPATH := -L/usr/X11/lib 
   override USECXX4SO := Y
 endif
@@ -109,51 +109,10 @@
   override LIBLSHL := $(LIBG) -lm -lc
   override TILSHL := 
-  override CMDTILSHL := echo 'No Template instanciation library'
   ifeq ($(EROSCXX), CC)
     override CMDSHLCXX := CC -shared 
     override LIBLSHL := -lm -lc
   endif
-  override LIBXPATH := -L/usr/X11/lib
+  override LIBXPIPATH := -L/usr/X11/lib 
   override USECXX4SO := Y
 endif
 
-# Liste des .o associes a une librairie
-OBJSysTools = $(shell echo `cat ./SysTools/SysTools.o.list`)
-OBJNTools = $(shell echo `cat ./NTools/NTools.o.list`)
-# OBJBlitz = $(shell echo `cat ./Blitz/Blitz.o.list`)
-OBJSamba = $(shell echo `cat ./Samba/Samba.o.list`)
-OBJSkyT = $(shell echo `cat ./SkyT/SkyT.o.list`)
-OBJFitsIOServer = $(shell echo `cat ./FitsIOServer/FitsIOServer.o.list`)
-OBJPI         = $(shell echo `cat ./PI/PI.o.list`)
-OBJPIext      = $(shell echo `cat ./PIext/PIext.o.list`)
-
-ifdef CFITSIODIR
-AllObjs := $(OBJSysTools) $(OBJNTools) $(OBJSamba) $(OBJSkyT) $(OBJFitsIOServer)
-else
-AllObjs := $(OBJSysTools) $(OBJNTools) $(OBJSamba) $(OBJSkyT) 
-endif
-
-# Creation des librairies partagees
-
-
-#------------------------------------------------------------
-$(SLB)libtools.so : $(PSLB) 
-	$(CMDTILSHL)
-	cd $(OBJ); \
-	$(CMDSHLCXX) -o $(SLB)libtools.so \
-	$(FGSHLACXX) $(AllObjs)  $(TILSHL) \
-	$(FGSHLNCXX) -L$(SLB) $(LIBLSHL)  $(FITSIOLIB) 
-
-
-$(SLB)libPI.so : $(LIB)libPI.a $(LIB)libPIext.a
-	$(CMDTILSHLPI)
-	cd $(OBJ); \
-	$(CMDSHLCXX) -o $(SLB)libPI.so \
-	$(FGSHLACXX) $(OBJPI) $(OBJPIext) $(TILSHLPI) \
-	$(FGSHLN) -L$(SLB) -ltools \
-	$(LIBXPATH) -lXm -lXt -lX11 $(LIBLSHL)
-
-else
-slb :
-endif
-
Index: /trunk/SophyaLib/Mgr/extlibdirs
===================================================================
--- /trunk/SophyaLib/Mgr/extlibdirs	(revision 740)
+++ /trunk/SophyaLib/Mgr/extlibdirs	(revision 740)
@@ -0,0 +1,2 @@
+FitsIOServer
+
Index: /trunk/SophyaLib/Mgr/libdirs
===================================================================
--- /trunk/SophyaLib/Mgr/libdirs	(revision 739)
+++ /trunk/SophyaLib/Mgr/libdirs	(revision 740)
@@ -3,3 +3,2 @@
 Samba
 SkyT
-FitsIOServer
Index: /trunk/SophyaLib/Mgr/mkmf
===================================================================
--- /trunk/SophyaLib/Mgr/mkmf	(revision 739)
+++ /trunk/SophyaLib/Mgr/mkmf	(revision 740)
@@ -1,8 +1,11 @@
 #!/bin/csh 
-# $Id: mkmf,v 1.7 2000-02-22 16:31:26 ansari Exp $
-
-# Librairie cfitsio
+# $Id: mkmf,v 1.8 2000-02-25 18:34:48 ansari Exp $
+
+#  Pour debugger 
+set DODBG = 'echo'
+
+# Librairies externe
 if( ! $?EXTLIBDIR ) then
- echo 'EXTLIBDIR library: EXTLIBDIR variable need to be set'
+  echo 'mkmf- WARNING (External libraries) EXTLIBDIR variable not set'
 endif
 
@@ -13,10 +16,52 @@
 # creation des liens pour les includes
 echo 'mkmf: Creating links for *.h (call mkmflien)'
-./mkmflien
+$DODBG ./mkmflien
+
+# Liste des modules a construire
+# modules : Liste de module SOPHYA, sans dependance exterieure
+# extmodules : Liste de modules avec dependance exterieures
+#        _pres : Liste des modules presents
+
+set modules = `cat libdirs`
+set extmodules = `cat extlibdirs` 
+set modules_pres = ''
+set extmodules_pres = ''
+
+set module_libnames = ''
+set extmodule_libnames = ''
+set extlib_list = ''
+set extslb_list = ''
+#  Constitution de la liste de modules present
+foreach f ($modules)
+  if (-d ../$f ) then
+    set modules_pres = ( $modules_pres $f )
+    set module_libnames = ( $module_libnames '$(LIB)lib'$f.a )
+  endif
+end
+foreach f ($extmodules)
+  if (-d ../$f ) then
+    set extmodules_pres = ( $extmodules_pres $f )
+    set extmodule_libnames = ( $extmodule_libnames '$(LIB)lib'$f.a )
+    set lil = "../$f/extlib_list"
+    if (-f $lil ) set extlib_list = ($extlib_list `sed -e 's/.*/-l&/' $lil`) 
+    set lil = "../$f/extslb_list"
+    if (-f $lil ) set extslb_list = ($extslb_list `sed -e 's/.*/-l&/' $lil`) 
+  endif
+end
+
+echo 'mkmf: List of modules ' 
+echo '  ... modules= ' $modules_pres
+echo $module_libnames 
+echo '  ... extmodules= ' $extmodules_pres
+echo $extmodule_libnames 
 
 echo 'mkmf: Creating makefile global :'
 rm -f GNUmakefile
 
+echo '# include files defining compiler/linker options '  >> GNUmakefile
+echo 'MODULECXXREPNAME := PI'  >> GNUmakefile
 echo 'include Mgr/Makefile.h' >> GNUmakefile
+echo 'include Mgr/Makefile.slb' >> GNUmakefile
+echo ''   >> GNUmakefile
 
 echo 'LIBF = ' `sed -e 's/.*/$(LIB)lib&.a/' libdirs` >> GNUmakefile
@@ -31,18 +76,22 @@
 defaut: libs
 
-all: libs PI
-
+all: libs extlibs PI
 
 libs: cxxlibs
+
+extlibs: cxxextlibs
+
+EOF
+
 # Dans cet ordre pour les templates de cxx, a cause des dependances
 # pour instantiation automatique/manuels
 
-cxxlibs: FitsIOServer SkyT Samba NTools SysTools Blitz
-
-EOF
+echo 'cxxlibs: ' $modules_pres >>    GNUmakefile
+echo ' ' >> GNUmakefile 
+echo 'cxxextlibs: ' $extmodules_pres >> GNUmakefile
 
 
 #  Attention, ne pas changer l'ordre de libnames dependances cxx
-set libnames = (FitsIOServer SkyT Samba NTools SysTools Blitz )
+set libnames = ($modules_pres $extmodules_pres)
 set i = 1
 set j = $#libnames ; @ j--
@@ -54,5 +103,5 @@
     echo "mkmf: Creation makefile lib $f"
     echo "   execution $cmd"
-    $cmd
+    $DODBG $cmd
   endif
   echo '.PHONY: ' $f >> GNUmakefile
@@ -68,11 +117,11 @@
   echo "mkmf: Creation makefile lib PI"
   echo "   execution $cmd"
-  $cmd
+  $DODBG  $cmd
 endif
 if ( -d ../PIext ) then 
-  set cmd = './mkmfPI PIext SysTools NTools Samba SkyT PI'
+  set cmd = "./mkmfPI PIext $libnames PI"
   echo "mkmf: Creation makefile lib PIext"
   echo "   execution $cmd"
-  $cmd
+  $DODBG $cmd
 endif
 echo '.PHONY: PI' >> GNUmakefile
@@ -81,5 +130,78 @@
 echo '	if [ -d PIext ] ; then cd PIext ; $(MAKE) ; fi' >> GNUmakefile
 
-cat Makefile.slb >> GNUmakefile
+
+
+echo '#  Shared library creation part of the Makefile'       >> GNUmakefile
+echo ' '                                 >> GNUmakefile
+echo '#  List of libraries (.a)'         >> GNUmakefile
+echo 'PSLB = ' $module_libnames          >> GNUmakefile
+echo 'EXTPSLB = ' $extmodule_libnames    >> GNUmakefile
+echo 'PIPSLB =  $(LIB)libPI.a  $(LIB)libPIext.a'   >> GNUmakefile
+echo '#  List of external library references'       >> GNUmakefile
+echo 'EXTLIB  = -L$(EXTLIBPATH)' $extlib_list       >> GNUmakefile
+echo 'EXTSLB  = -L$(EXTSLBPATH)' $extlib_list       >> GNUmakefile
+echo 'XPILIBS = $(LIBXPIPATH) $(LIBXPILIST)'        >> GNUmakefile
+echo ''                                  >> GNUmakefile
+echo '#  main dependence list'           >> GNUmakefile
+echo 'slball : slb slbext slbpi '        >> GNUmakefile
+echo 'slb : $(SLB)libsophya.so '         >> GNUmakefile
+echo 'slbext : $(SLB)libextsophya.so   ' >> GNUmakefile
+echo 'slbpi : $(SLB)libPI.so'            >> GNUmakefile
+echo ' '                                 >> GNUmakefile
+
+echo '# List of .o files for each module'  >> GNUmakefile
+set objalls =  ''
+foreach f ($modules_pres)
+  echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)'  >> GNUmakefile
+  set objalls = ( $objalls '$(OBJ'$f')' )
+end
+echo 'ALLOBJS =' $objalls                >> GNUmakefile
+echo ' '                                 >> GNUmakefile
+
+echo '# List of .o files modules with reference to external libraries'  >> GNUmakefile
+set objalls =  ''
+foreach f ($extmodules_pres)
+  echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)'  >> GNUmakefile
+  set objalls = ( $objalls '$(OBJ'$f')' )
+end
+echo 'ALLEXTOBJS =' $objalls             >> GNUmakefile
+echo ' '                                 >> GNUmakefile
+
+echo '# List of .o files for PI modules '  >> GNUmakefile
+set objalls =  ''
+foreach f (PI PIext)
+  echo 'OBJ'$f '= $(shell echo' '`cat' "./$f/$f.o.list" '`)'  >> GNUmakefile
+  set objalls = ( $objalls '$(OBJ'$f')' )
+end
+echo 'ALLPIOBJS =' $objalls              >> GNUmakefile
+echo ' '                                 >> GNUmakefile
+
+echo '# Building Sophya shared library'  >> GNUmakefile
+echo '$(SLB)libsophya.so : $(PSLB)'                             >> GNUmakefile
+echo '	$(CMDTILSHL) '                                          >> GNUmakefile
+echo '	cd  $(OBJ); \'                                          >> GNUmakefile
+echo '	$(CMDSHLCXX) -o $(SLB)libsophya.so  \'                  >> GNUmakefile
+echo '	$(FGSHLACXX) $(ALLOBJS)  $(FGSHLNCXX)\'                 >> GNUmakefile
+echo '	-L$(SLB) $(LIBLSHL)'                                    >> GNUmakefile
+echo ' '                                                        >> GNUmakefile
+
+echo '# Building ExtSophya shared library'  >> GNUmakefile
+echo '$(SLB)libextsophya.so : $(EXTPSLB)'                       >> GNUmakefile
+echo '	$(CMDTILSHL) '                                          >> GNUmakefile
+echo '	cd  $(OBJ); \'                                          >> GNUmakefile
+echo '	$(CMDSHLCXX) -o $(SLB)libextsophya.so  \'               >> GNUmakefile
+echo '	$(FGSHLACXX) $(ALLEXTOBJS)  $(FGSHLNCXX)\'              >> GNUmakefile
+echo '	-L$(SLB) -lsophya $(EXTSLB) $(LIBLSHL)'                 >> GNUmakefile
+echo ' '                                                        >> GNUmakefile
+
+echo '# Building PI shared library'  >> GNUmakefile
+echo '$(SLB)libPI.so : $(PIPSLB)'                               >> GNUmakefile
+echo '	$(CMDTILSHL) '                                          >> GNUmakefile
+echo '	cd  $(OBJ); \'                                          >> GNUmakefile
+echo '	$(CMDSHLCXX) -o $(SLB)libPI.so  \'                      >> GNUmakefile
+echo '	$(FGSHLACXX) $(ALLPIOBJS) $(FGSHLNCXX) \'                >> GNUmakefile
+echo '	-L$(SLB) -lsophya -lextsophya $(EXTSLB) $(XPILIBS) $(LIBLSHL)'      >> GNUmakefile
+echo ' '                                                        >> GNUmakefile
+
 
 cat >> GNUmakefile << __END__
@@ -88,7 +210,6 @@
 	if [ -d \$(LIB) ] ; then cd \$(LIB)/. ; rm -f *.a  ; fi
 	if [ -d \$(SLB) ] ; then cd \$(SLB)/. ; rm -f *.so ; fi
-	if [ -d \$(OBJ) ] ; then cd \$(OBJ)/. ; rm -f *.o  ; fi
-	if [ -d \$(OBJ)/cxxrep ] ; then cd \$(OBJ)/cxxrep/. ; rm -f *.o  ; fi
-	if [ -d PI ]     ; then cd PI/.     ; \$(MAKE) clean ; fi
+	if [ -d \$(OBJ) ] ; then cd \$(OBJ)/. ; rm -f *.o  rm -rf cxxrep* ; fi
+#	if [ -d PI ]     ; then cd PI/.     ; \$(MAKE) clean ; fi
 
 __END__
Index: /trunk/SophyaLib/Mgr/mkmflib
===================================================================
--- /trunk/SophyaLib/Mgr/mkmflib	(revision 739)
+++ /trunk/SophyaLib/Mgr/mkmflib	(revision 740)
@@ -1,8 +1,12 @@
 #!/bin/csh
-# $Id: mkmflib,v 1.3 1999-10-25 16:24:49 ansari Exp $
+# $Id: mkmflib,v 1.4 2000-02-25 18:34:49 ansari Exp $
 
 cd ../$1
 
 if ( ! -f exclude ) touch exclude
+if ( ! -f flags_compil ) touch flags_compil
+if ( ! -f extlib_list ) touch extlib_list
+if ( ! -f extslb_list ) touch extslb_list
+
 if ( ! $?TMPDIR ) set TMPDIR = /tmp
 sort exclude >! $TMPDIR/exclude.sort
@@ -30,7 +34,10 @@
 end
 
+set extlib_list = `cat extlib_list`
+set hfcxxlibs = ($hfcxxlibs '-L$(EXTLIBPATH)' $extlib_list)
 
 rm -f GNUmakefile
 
+cat flags_compil >> GNUmakefile 
 echo 'include ../Mgr/Makefile.h' >> GNUmakefile 
 
Index: /trunk/SophyaLib/Mgr/mkmflien
===================================================================
--- /trunk/SophyaLib/Mgr/mkmflien	(revision 739)
+++ /trunk/SophyaLib/Mgr/mkmflien	(revision 740)
@@ -1,4 +1,4 @@
 #!/bin/csh 
-# $Id: mkmflien,v 1.4 2000-02-22 16:31:27 ansari Exp $
+# $Id: mkmflien,v 1.5 2000-02-25 18:34:49 ansari Exp $
 
 #########################################################
@@ -52,5 +52,5 @@
 ####  Les includes du code C++ a mettre dans Include
 ####################################################
-foreach d (`cat libdirs` PI PIext  )
+foreach d (`cat libdirs` `cat extlibdirs` PI PIext  )
   if ( -d $src/$d ) then
     echo $src/$d
