Index: trunk/ArchTOIPipe/SMakefile
===================================================================
--- trunk/ArchTOIPipe/SMakefile	(revision 1985)
+++ trunk/ArchTOIPipe/SMakefile	(revision 1987)
@@ -1,157 +1,123 @@
-USERFLAGS = -I$(EXTLIBDIR)/Include/FitsIO -DWITH_SOPHYA
-include $(DPCBASEREP)/Include/MakefileUser.h
+# ####################### ArchTOIPipe ###########################
+# ##### LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA #####
+# ###############################################################
+#   Top level makefile to build ArchTOIPipe library with SOPHYA
+# Usage : make -f SMakefile mkmf
+#         make -f SMakefile libs
+#         make -f SMakefile slb 
+# ###############################################################
 
-ALIB := ./$(MACHDIR)/
-AOBJ := ./$(MACHDIR)/
+# include files defining compiler/linker options 
+include SMakefile.h
+include ${DPCBASEREP}/Include/Makefile.slb
 
-$(AOBJ)%.o:%.cc
-	$(COMPILE.cc) $(USERFLAGS) -o $@ $<
-$(AOBJ)%.o:%.c
-	$(COMPILE.c) $(CFLAGS) $(USERFLAGS) -o $@ $<
+LIBF =  $(MYLIB)libKernel.a $(MYLIB)libProcessors.a $(MYLIB)libProcWSophya.a
 
-LIBOLIST := $(AOBJ)asciitoiwtr.o $(AOBJ)fitstoirdr.o $(AOBJ)fitstoiwtr.o \
-            $(AOBJ)toi.o $(AOBJ)toimanager.o $(AOBJ)toiprocessor.o $(AOBJ)genwproc.o \
-            $(AOBJ)toisqfilter.o $(AOBJ)toiregwindow.o $(AOBJ)toiseqbuff.o \
-            $(AOBJ)toisegment.o \
-            $(AOBJ)simtoipr.o $(AOBJ)map2toi.o $(AOBJ)toi2map.o $(AOBJ)nooppr.o \
-            $(AOBJ)ring33.o $(AOBJ)PSB2ring.o $(AOBJ)Bolos2ring.o
-EXEOLIST := $(AOBJ)fits2asc.o $(AOBJ)tsttoi.o $(AOBJ)tsttoi2.o $(AOBJ)simtst.o \
-            $(AOBJ)tstrztoi.o $(AOBJ)rztoi.o $(AOBJ)sfftc.o $(AOBJ)mesovh.o \
-            $(AOBJ)fits2ascii.o $(AOBJ)tgenw.o $(AOBJ)tstmap2toi.o $(AOBJ)tsttoi2map.o \
-            $(AOBJ)tstflag.o $(AOBJ)tstdemopipe.o $(AOBJ)gph425_ring.o
-EXELIST := $(AOBJ)sfftc $(AOBJ)simtst $(AOBJ)mesovh $(AOBJ)tstrztoi $(AOBJ)fits2asc $(AOBJ)tsttoi \
-           $(AOBJ)tsttoi2 $(AOBJ)fits2ascii $(AOBJ)tgenw $(AOBJ)tstmap2toi $(AOBJ)tsttoi2map \
-           $(AOBJ)tstflag $(AOBJ)tstdemopipe $(AOBJ)gph425_ring
+defaut: libs
 
-INCLIST := asciitoiwtr.h fitstoirdr.h fitstoiwtr.h toi.h config.h conf.h \
-           toiprocessor.h genwproc.h toimanager.h toiseqbuff.h toiregwindow.h \
-           simtoipr.h map2toi.h toi2map.h nooppr.h toisegment.h ring33.h PSB2ring.h Bolos2ring.h
+all: libs slb
 
-all : $(EXELIST) 
-lib : $(LIBOLIST)
+
+libs: archlibs
+slb: archslb
+
+archlibs: Kernel Processors ProcWSophya
+
+#--- Create directory and copy includes for install
+depend:
+ifdef ARCHPDEVREP
+ifdef EROSCXX
+	@echo "ArchTOIPipe will be installed under:"
+	@echo "  $(ARCHPDEVREP)/Include" 
+	@echo "  $(ARCHPDEVREP)/`uname`-$(EROSCXX)" 
+	./crerep_pipe $(ARCHPDEVREP) `uname`-$(EROSCXX); \
+#	./makefileuser.csh; \
+	./mkmflien -copy ; \
+else
+	@echo "Variable EROSCXX must be define with setenv"
+endif
+else
+	@echo "Variable ARCHPDEVREP must be define with setenv"
+endif
+#--------------------------------------------------------------------
+
+#--- Create library module Makefiles
+mkmf:
+	@echo 'Running ./smkmf'
+	./smkmf
+#--------------------------------------------------------------------
+
+.PHONY:  Kernel
+Kernel:
+	if [ -d Kernel ] ; then cd  Kernel ; $(MAKE) ; fi
+
+.PHONY:  Processors
+Processors:
+	if [ -d Processors ] ; then cd  Processors ; $(MAKE) ; fi
+
+.PHONY:  ProcWSophya
+ProcWSophya:
+	if [ -d ProcWSophya ] ; then cd  ProcWSophya ; $(MAKE) ; fi
+
+#  Shared library creation part of the Makefile
+ 
+#  List of libraries (.a)
+PSLB =  $(MYLIB)libKernel.a $(MYLIB)libProcessors.a $(MYLIB)libProcWSophya.a
+
+#  List of external library references
+EXTLIBL  = -L$(EXTLIBPATH) -lcfitsio -lfftw -lrfftw -lxastro
+EXTSLBL  = -L$(EXTSLBPATH) -lcfitsio -lfftw -lrfftw -lxastro
+
+# defining the other external libraries needed on different systems
+
+# On Linux   lapack and blas and f2c/g2c ere needed
+ifeq ($(MACHEROS),Linux)
+#EXTLIB = $(EXTLIBL) -llapack -lblas -lf2c
+#EXTSLB = $(EXTSLBL) -llapack -lblas -lf2c
+EXTLIB = $(EXTLIBL) -llapack -lblas -lg2c
+EXTSLB = $(EXTSLBL) -llapack -lblas -lg2c
+endif
+
+# On OSF1 libdxml contains Lapack, but the fortran support library is needed
+ifeq ($(MACHEROS),OSF1)
+EXTLIB = $(EXTLIBL) -ldxml -lfor
+EXTSLB = $(EXTSLBL) -ldxml -lfor
+endif
+
+# On IRIX , complib.sgimath contains Lapack
+ifeq ($(MACHEROS),IRIX64)
+EXTLIB = $(EXTLIBL) -lcomplib.sgimath 
+EXTSLB = $(EXTSLBL) -lcomplib.sgimath 
+endif
+
+
+
+# XPILIBS = $(LIBXPIPATH) $(LIBXPILIST)
+
+#  main dependence list
+archslb : $(SLB)libpipe.so 
+ 
+# List of .o files for each module
+# OBJKernel = $(shell echo `cat ./Kernel/objlist.list `)
+# OBJProcessors = $(shell echo `cat ./Processors/objlist.list `)
+# OBJProcWSophya = $(shell echo `cat ./ProcWSophya/objlist.list `)
+OBJKernel = $(shell echo `cat ./Kernel/Kernel.o.list `)
+OBJProcessors = $(shell echo `cat ./Processors/Processors.o.list `)
+OBJProcWSophya = $(shell echo `cat ./ProcWSophya/ProcWSophya.o.list `)
+
+ALLOBJS = $(OBJKernel) $(OBJProcessors) $(OBJProcWSophya) 
+ 
+# Building ArchTOIPipe shared library
+$(SLB)libpipe.so : $(PSLB)
+	cd  $(OBJ); \
+	$(CMDSHLCXX) -o $(MYSLB)libpipe.so  \
+	$(FGSHLACXX) $(ALLOBJS)  $(FGSHLNCXX)\
+	-L$(SLB) -lsophya -lextsophya $(EXTLIB) $(LIBLSHL)
+ 
+ 
 
 clean:
-	rm -f  $(LIBOLIST)
-	rm -f  $(EXEOLIST)
-	rm -f  $(EXELIST)
+	if [ -d $(MYLIB) ] ; then cd $(MYLIB)/. ; rm -f *.a  ; fi
+	if [ -d $(MYSLB) ] ; then cd $(MYSLB)/. ; rm -f *.so ; fi
+	if [ -d $(OBJ) ] ; then cd $(OBJ)/. ; rm -f *.o  rm -rf cxxrep* ; fi
 
-LIBF =  $(SLB)libsophya.so $(SLB)libextsophya.so 
-LIBS =  -L$(SLB) -lextsophya -lsophya -lpthread -lm
-####ifeq ($(MACHEROS),OSF1)
-####LIBS := $(LIBS) -lfor
-####endif
-
-########################################
-#### Les Executables des Programmes ####
-########################################
-tstrztoi: $(AOBJ)tstrztoi
-	@echo done
-$(AOBJ)tstrztoi: $(AOBJ)tstrztoi.o $(AOBJ)rztoi.o $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-sfftc: $(AOBJ)sfftc
-	@echo done
-$(AOBJ)sfftc: $(AOBJ)sfftc.o  $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-mesovh: $(AOBJ)mesovh
-	@echo done
-$(AOBJ)mesovh: $(AOBJ)mesovh.o  $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-simtst: $(AOBJ)simtst
-	@echo done
-$(AOBJ)simtst: $(AOBJ)simtst.o  $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-fits2asc: $(AOBJ)fits2asc
-	@echo done
-$(AOBJ)fits2asc: $(AOBJ)fits2asc.o $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-tsttoi: $(AOBJ)tsttoi
-	@echo done
-$(AOBJ)tsttoi: $(AOBJ)tsttoi.o $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-tsttoi2: $(AOBJ)tsttoi2
-	@echo done
-$(AOBJ)tsttoi2: $(AOBJ)tsttoi2.o $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-fits2ascii: $(AOBJ)fits2ascii
-	@echo done
-$(AOBJ)fits2ascii: $(AOBJ)fits2ascii.o $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-tgenw: $(AOBJ)tgenw
-	@echo done
-$(AOBJ)tgenw: $(AOBJ)tgenw.o  $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-tstmap2toi: $(AOBJ)tstmap2toi
-	@echo done
-$(AOBJ)tstmap2toi: $(AOBJ)tstmap2toi.o $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-tsttoi2map: $(AOBJ)tsttoi2map
-	@echo done
-$(AOBJ)tsttoi2map: $(AOBJ)tsttoi2map.o $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-tstflag: $(AOBJ)tstflag
-	@echo done
-$(AOBJ)tstflag: $(AOBJ)tstflag.o $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-tstdemopipe: $(AOBJ)tstdemopipe
-	@echo done
-$(AOBJ)tstdemopipe: $(AOBJ)tstdemopipe.o $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-gph425_ring: $(AOBJ)gph425_ring
-	@echo done
-$(AOBJ)gph425_ring: $(AOBJ)gph425_ring.o $(LIBOLIST)
-	$(LINK.cc)  -o $@ $^ $(LIBS)
-
-
-################################################
-#### Compilation des Sources des Programmes ####
-################################################
-$(AOBJ)simtst.o: simtst.cc $(INCLIST)
-$(AOBJ)sfftc.o: sfftc.cc $(INCLIST)
-$(AOBJ)mesovh.o: mesovh.cc $(INCLIST)
-$(AOBJ)tstrztoi.o: tstrztoi.cc rztoi.h $(INCLIST)
-$(AOBJ)rztoi.o: rztoi.cc rztoi.h $(INCLIST)
-$(AOBJ)fits2asc.o: fits2asc.cc $(INCLIST)
-$(AOBJ)tsttoi.o: tsttoi.cc $(INCLIST)
-$(AOBJ)tsttoi2.o: tsttoi2.cc $(INCLIST)
-$(AOBJ)fits2ascii.o: fits2ascii.cc $(INCLIST)
-$(AOBJ)tgenw.o: tgenw.cc $(INCLIST)
-$(AOBJ)tstmap2toi.o: tstmap2toi.cc $(INCLIST)
-$(AOBJ)tsttoi2map.o: tsttoi2map.cc $(INCLIST)
-$(AOBJ)tstflag.o: tstflag.cc $(INCLIST)
-$(AOBJ)tstdemopipe.o: tstdemopipe.cc $(INCLIST)
-$(AOBJ)gph425_ring.o: gph425_ring.cc $(INCLIST)
-
-################################################
-#### Compilation des Sources des Librairies ####
-################################################
-$(AOBJ)asciitoiwtr.o: asciitoiwtr.cc asciitoiwtr.h toi.h config.h conf.h toiprocessor.h toimanager.h 
-$(AOBJ)fitstoirdr.o: fitstoirdr.cc fitstoirdr.h toiprocessor.h config.h conf.h
-$(AOBJ)fitstoiwtr.o: fitstoiwtr.cc fitstoiwtr.h toi.h config.h conf.h
-$(AOBJ)toi.o: toi.cc toiprocessor.h config.h conf.h toi.h 
-$(AOBJ)toimanager.o: toimanager.cc toimanager.h
-$(AOBJ)toiprocessor.o: toiprocessor.cc toiprocessor.h config.h conf.h toi.h toimanager.h
-$(AOBJ)genwproc.o: genwproc.h toiprocessor.h toimanager.h
-$(AOBJ)toisqfilter.o: toisqfilter.cc toisqfilter.h toiprocessor.h config.h conf.h toi.h toimanager.h
-$(AOBJ)toiseqbuff.o: toiseqbuff.cc toiprocessor.h config.h conf.h toi.h toiseqbuff.h 
-$(AOBJ)toiregwindow.o: toiregwindow.cc toiprocessor.h config.h conf.h toi.h toiregwindow.h 
-$(AOBJ)simtoipr.o: simtoipr.cc toiprocessor.h config.h conf.h toi.h simtoipr.h 
-$(AOBJ)map2toi.o: map2toi.cc map2toi.h 
-$(AOBJ)toi2map.o: toi2map.cc toi2map.h 
-$(AOBJ)nooppr.o: nooppr.cc nooppr.h 
-$(AOBJ)toisegment.o: toisegment.cc toiprocessor.h config.h conf.h toi.h
-$(AOBJ)ring33.o: ring33.cc ring33.h 
-$(AOBJ)PSB2ring.o: PSB2ring.cc PSB2ring.h 
-$(AOBJ)Bolos2ring.o: Bolos2ring.cc Bolos2ring.h 
