#---------------------------------------------------------------------------
# Makefile for the SINQ hist mem client Programs in the sinqhm directory.
# These are:
#            sinqhm_ctrl
#            sinqhm_client
#            sinqhm_bootutil_client
#            lwl_client
#
# David Maden, Oct-2000
#--------------------------------------------------------------------------
#
#------------ for DigitalUnix (add -DFORTIFY to CFLAGS for fortified version)
#FF     = f90
#CC     = cc
#CFLAGS =  -g -I. -I../hardsup -I$(PGPLOT_DIR) -I/data/koenneck/include
#BIN    = ../bin
#LFLAGS = -L../hardsup -L$PGPLOT_DIR -L/data/lnslib/lib -lX11
#------------ for Linux
FF     = g77
CC     = gcc
CFLAGS = -g -I. -I../hardsup -I/afs/psi.ch/project/sinq/sl-linux/include -DLINUX
BIN    = ./
LFLAGS = -L../hardsup -L/afs/psi.ch/project/sinq/sl-linux/lib -L/usr/X11R6/lib
#------------

#----------------------------------------------------------

all:    $(BIN)/sinqhm_ctrl \
        $(BIN)/sinqhm_client \
        $(BIN)/sinqhm_bootutil_client \
        $(BIN)/lwl_client
	@ echo
	@ echo " This directory contains SINQ histogram memory software."
	@ echo " The make file will make the histogram memory client programs:"
	@ echo
	@ echo "     sinqhm_ctrl"
	@ echo "     sinqhm_client"
	@ echo "     sinqhm_bootutil_client"
	@ echo "     lwl_client"
	@ echo
	@ echo " To make them, simply specify:"
	@ echo
	@ echo "    make"
	@ echo

#----------------------------------------------------------

$(BIN)/sinqhm_ctrl: SinqHM_def.h sinqhm_ctrl.c
	@ rm -f $(BIN)/sinqhm_ctrl.old
	@ if test -f $(BIN)/sinqhm_ctrl; then \
           mv -f $(BIN)/sinqhm_ctrl \
                 $(BIN)/sinqhm_ctrl.old; \
        fi
	$(CC) $(CFLAGS) -o $(BIN)/sinqhm_ctrl sinqhm_ctrl.c $(LFLAGS) -lhlib -lX11

sinqhm_client: SinqHM_def.h sinqhm_client.c
	$(FF) $(CFLAGS) -nofor_main -o sinqhm_client \
                   sinqhm_client.c $(LFLAGS) -lhlib -lcpgplot -lpgplot -lX11

$(BIN)/sinqhm_bootutil_client:  SinqHM_def.h \
                   sinqhm_bootutil_client.c
	@ rm -f $(BIN)/sinqhm_bootutil_client.old
	@ if test -f $(BIN)/sinqhm_bootutil_client; then \
           mv -f $(BIN)/sinqhm_bootutil_client \
                 $(BIN)/sinqhm_bootutil_client.old; \
        fi
	$(CC) $(CFLAGS) -o $(BIN)/sinqhm_bootutil_client \
                   sinqhm_bootutil_client.c $(LFLAGS) -lhlib -lX11

$(BIN)/lwl_client: SinqHM_def.h lwl_client.c
	@ rm -f $(BIN)/lwl_client.old
	@ if test -f $(BIN)/lwl_client; then \
           mv -f $(BIN)/lwl_client \
                 $(BIN)/lwl_client.old; \
        fi
	$(CC) $(CFLAGS) -o $(BIN)/lwl_client \
                   lwl_client.c $(LFLAGS) -lhlib -lX11

#----------------------------------------------------------

clean:
	- rm -f *.o
	- rm -f $(BIN)/sinqhm_ctrl \
                $(BIN)/sinqhm_client \
                $(BIN)/sinqhm_bootutil_client \
                $(BIN)/lwl_client
	- rm -f $(BIN)/sinqhm_ctrl.old \
                $(BIN)/sinqhm_client.old \
                $(BIN)/sinqhm_bootutil_client.old \
                $(BIN)/lwl_client.old

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


