########################################################################
#
########################################################################
CUR_REL_PATH := "utils/rtdisp"

include ../../config.mk

CFLAGS_ALL	= -D${MACH_OS} -DMOTIF -DSYSV -DXT_CODE -DXOPEN_CATALOG \
                  -I./  -I../../include -I${IRIS_ROOT}/include

CFLAGS		= -c ${DEBUGFLAG} ${C_OPT}  ${CFLAGS_ALL}
CXXFLAGS        = -c ${DEBUGFLAG} ${CC_OPT} ${CFLAGS_ALL}
CCFLAGS = ${CXXFLAGS}

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

RTDISP		= rtdisp
RTD_INSERT	= rtd_insert

RTDISP_CC_SRCS =	rtdisp.C \
			color.C \
			colorDiag.C \
			overlay.C \
			overlayDiag.C \
			rng.C \
			rngDiag.C \
			rhiOpt.C \
			rhiOptDiag.C \
			rtdAS.C \
			rtdApplShell.C \
			siteStat.C \
			siteStatDiag.C \
			rtdFunc.C \
			sharedMem.C
RTDISP_CC_OBJS		= $(RTDISP_CC_SRCS:.C=.o)

RTD_INSERT_CC_SRCS =	rtdInsert.C \
			sharedMem.C
RTD_INSERT_CC_OBJS	= $(RTD_INSERT_CC_SRCS:.C=.o)


LLIBS		= -luxsig -ltvsubs -lXpm -lbxutils -lXm -lXt -lX11 \
	          -lconfig -lmaps -lmisc -lvtv -lfileformats ${LTIFF} ${LJPEG} \
		  -lhimath -luser -lXmu -lm

MKDEPEND_CSRCS = ${RTDISP_CC_SRCS} ${RTD_INSERT_CC_SRCS}

all: $(RTDISP) $(RTD_INSERT)

depend: makefile.d

makefile.d: ${MKDEPEND_CSRCS}
	touch makefile.d
	makedepend -fmakefile.d -- ${CFLAGS} -- ${MKDEPEND_CSRCS}

$(RTDISP): $(RTDISP_CC_OBJS)
	$(CXX) $(LD_OPT) $^ $(LDFLAGS) $(LLIBS) -o $@

$(RTD_INSERT):	$(RTD_INSERT_CC_OBJS)
	$(CXX) $(LD_OPT) $^ $(LDFLAGS) $(LLIBS) -o $@

install: all ${IRIS_BIN} ${IRIS_APP_DEFAULTS}
	install -m 0775 -o ${IRIS_USER} -g ${IRIS_GROUP} -s \
			$(RTDISP) $(RTD_INSERT) ${IRIS_BIN}
	install -m 0664 -o ${IRIS_USER} -g ${IRIS_GROUP} \
			${RTDISP}.rf $(IRIS_APP_DEFAULTS)/$(RTDISP)
	install -m 0664 ${RTDISP}.rf $(SYS_APP_DEFAULTS)/$(RTDISP)

uninstall:
	rm -f $(IRIS_APP_DEFAULTS)/$(RTDISP) \
	      $(SYS_APP_DEFAULTS)/$(RTDISP)
	cd ${IRIS_BIN}; rm $(RTDISP) $(RTD_INSERT)

cleanexe:
	rm -f $(RTDISP) $(RTD_INSERT) core

clean: cleanexe 
	rm -f *.o *~ *.d *.d.bak

install_src: ${INST_SRC_DIR}
	install -m 0664 -o ${IRIS_USER} -g ${IRIS_GROUP} Makefile *.[Ch] *.uil *.rf ${INST_SRC_DIR}

uninstall_src:
	rm -rf ${INST_SRC_DIR}

-include makefile.d
