# ####################### ArchTOIPipe ###########################
# ##### LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA #####
# ###############################################################
#  Makefile to build test ArchTOIPipe programs with ArchTOIPipe
#  and SOPHYA libraries
#  DPCBASEREP (for SOPHYA) and ARCHPDEVREP variable should be 
#  defined 
#  Usage: make -f SMakefile name_of_program
#         make -f SMakefile clean 
#  *** Warning: GNU make should be used  ***
# ###############################################################

include ../SMakefile.h

ifdef NOSHLIB

LIBS = -L$(MYLIB) -lKernel -lProcessors -lProcWSophya \
       -L$(LIB) -lFitsIOServer -lSamba -lSkyMap -lSkyT -lNTools \
        -lHiStats -lTArray -lBaseTools -lSysTools -lm

ifeq ($(CXX),cxx)
# librairie des instances de templates cxx
LIBS := $(LIBS) -lrt
endif

else

LIBF =  $(MYSLB)libpipe.so  $(SLB)libextsophya.so $(SLB)libsophya.so 
LIBS = -L$(MYSLB) -lpipe -L$(SLB) -lextsophya -lsophya -lpthread -lm 
ifeq ($(MACHEROS),OSF1)
LIBS := $(LIBS) -lfor
endif
ifeq ($(MACHEROS),Linux)
LIBS := $(LIBS) -ldl 
endif

endif

LDLIBS := $(LIBS) $(LDLIBS) 

%:%.cc
%:%.o
%.o:%.cc
%.o:%.c
%:%.c

.PRECIOUS: $(AEXE)% $(OBJ)%.o


#  --- Compilation and linking rules
%:$(AEXE)%
	echo '---' $@ build '-->' $<

$(AEXE)%:$(OBJ)%.o
	$(LINK.cc)  -o $@ $< $(LIBS)

$(OBJ)%.o:%.cc
	$(COMPILE.cc)   $(USERFLAGS) -o $@ $<

%:%.c
	$(LINK.c)  $(USERFLAGS) -o $@ $< $(LIBS) 

dump :
	echo $(LIBS)

clean : 
	../cleantstpipes.csh

all :  mesovh mesovh2 tsttoi2map simtst simofftst aksj02 tstmap2toi toistat toi2toi_addsp
