#---------------------------------------------------------------------------
# Makefile for the TECS Client library and TecsServer
#
# Markus Zolliker, March 2000
#--------------------------------------------------------------------------
LIBR_OBJ= coc_util.o err_handling.o str_util.o str_buf.o
DLOG_OBJ= sys_util.o tecs_dlog.o
SERV_OBJ= tecs.o coc_server.o tecs_lsc.o tecs_serial.o coc_logfile.o $(LIBR_OBJ) $(DLOG_OBJ)
CLI_OBJ= tecs_cli.o coc_client.o $(LIBR_OBJ)
TCLI_OBJ= tecs_client.o tecs_plot.o tecs_for.o sys_aunix.o sys_aunix_c.o str.o cho.o $(CLI_OBJ) $(DLOG_OBJ)

#------------ for DigitalUnix (add -DFORTIFY to CFLAGS for fortified version)
CC=cc

#CFLAGS= -std1 -g -warnprotos -I../ -I. -I../hardsup -DFORTIFY 
CFLAGS= -std1 -g -warnprotos -I../ -I. -I../hardsup

.f.o:
	f77 -c -g $*.f

.c.o:
	$(CC) $(CFLAGS) -c $*.c

libtecsl.a: $(CLI_OBJ)
	- rm libtecsl.a
	ar cr libtecsl.a $(CLI_OBJ)
	ranlib libtecsl.a

all: libtecsl.a bin/TecsServer tecs

tecs_plot.o: tecs_plot.f90
	f90 -c -g tecs_plot.f90

bin/TecsServer: $(SERV_OBJ)
	- rm bin/TecsServer
	$(CC) $(CFLAGS) -o bin/TecsServer -g $(SERV_OBJ) fortify1.c \
          -lm -L../hardsup -lhlib -lfor

tecs: $(TCLI_OBJ)
	f77 -o tecs -g $(TCLI_OBJ) \
           -L/data/lnslib/lib -lpgplot -so_archive -lreadline -ltermcap -lX11 -lXm

clean:
	- rm *.o
	- rm *.a
	- rm bin/TecsServer
	- rm tecs
