LIB = ../lib/librtq.a

CFLAGS = -c ${DEBUGFLAG} ${C_OPT} -D${MACH_OS} \
        -I./  -I../../include -I${IRIS_ROOT}/include

CXXFLAGS= -c  ${DEBUGFLAG}  ${CC_OPT} -D${MACH_OS} \
        -I./  -I../../include -I${IRIS_ROOT}/include
CCFLAGS = ${CXXFLAGS}

CPPMSG= -DMESSAGE_ONLY -I./

LDFLAGS = -L../../libs/lib -L${IRIS_ROOT}/libs/lib

LIB_DIR = ../lib

EXES = rtd_v1_xmt rtd_v2_xmt rtd_nids3_xmt

RTQLIB_SRCS =	RtqGlobal.C

RTQLIB_OBJS = ${RTQLIB_SRCS:.C=.o}

C_SRCS =	rtd_v1_xmt.C rtd_v2_xmt.C rtd_nids3_xmt.C RtdSupport.C

C_OBJS = ${C_SRCS:.C=.o}

all:	${EXES} ${LIB} iris_signal116.cat

messages.usg : messages.msg
	${MKMSGUSG}

iris_signal116.cat : messages.usg
	rm -f iris_signal116.cat*
	gencat iris_signal116.cat messages.usg
	chmod 664 iris_signal116.cat*

MKDEPEND_CSRCS = ${RTQLIB_SRCS} ${C_SRCS}
depend: makefile.d

makefile.d:
	touch makefile.d
	makedepend -fmakefile.d -- ${CFLAGS} -- ${MKDEPEND_CSRCS} 
	makedepend -fmakefile.d -a -o.usg -- ${CPPMSG} -- messages.msg

rtd_v1_xmt: rtd_v1_xmt.o RtdSupport.o ${LIB}
		${CXX} ${LD_OPT} rtd_v1_xmt.o RtdSupport.o \
			 ${LDFLAGS} -lrtq -lconfig -luser -lm ${LSEARCH_BSD} -o rtd_v1_xmt
		rootchown operator rtd_v1_xmt ; rootchmod 6775 rtd_v1_xmt

rtd_v2_xmt: rtd_v2_xmt.o RtdSupport.o ${LIB}
		${CXX} ${LD_OPT} rtd_v2_xmt.o RtdSupport.o \
			 ${LDFLAGS} -lrtq -lconfig -luser -lm ${LSEARCH_BSD} -o rtd_v2_xmt
		rootchown operator rtd_v2_xmt ; rootchmod 6775 rtd_v2_xmt

rtd_nids3_xmt: rtd_nids3_xmt.o RtdSupport.o ${LIB}
		${CXX} ${LD_OPT} rtd_nids3_xmt.o RtdSupport.o \
			 ${LDFLAGS} -lrtq -lmisc -lconfig -luser -lm ${LSEARCH_BSD} -o rtd_nids3_xmt
		rootchown operator rtd_nids3_xmt ; rootchmod 6775 rtd_nids3_xmt

${LIB}:	${RTQLIB_OBJS}
		rm -f ${LIB}
		$(AR) -rsc ${LIB} ${RTQLIB_OBJS}
		rootchmod 664 ${LIB}

install: all
		rootcp -p ${EXES} ${IRIS_BIN}
		( cd ${IRIS_BIN} ; \
		  strip ${EXES} ; \
		  rootchown operator ${EXES} ; \
		  rootchmod 6775 ${EXES} ; \
		)
		cp iris_signal116.cat* ${IRIS_NLS}

cleanexe:;	rm -f ${EXES} core
clean:		cleanexe
		rm -f *.o *.usg *.cat* *.d *.d.bak

-include makefile.d
