
LIB = ../lib/libantenna.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../../include -I${IRIS_ROOT}/include

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

LIB_DIR = ../lib

CLIB_SRCS =	ant_control.c \
		AntInsert.c \
		ant_iosubs.c \
		ant_misc.c \
		ant_model.c \
		ant_motion.c \
		ant_netrcv.c \
		ant_history.c \
		AntSet.c \
		antsim_control.c \
		antsim_misc.c \
		antsim_motion.c \
		bitsim_driver.c \
		iant_pwrp.c \
		iantsim_pwrp.c \
		bite_driver.c \
		sun_position.c

CLIB_OBJS = ${CLIB_SRCS:.c=.o}

C_SRCS =	ant_rcv.c \
		ant_xmt.c \
		antsim_rcv.c \
		antsim_xmt.c \
		ant_log.c

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

LLIBS= -lantenna -lconfig -luser -lm ${LSEARCH_BSD}

ROOTEXES = ant_rcv ant_xmt antsim_rcv antsim_xmt ant_log

all:	${ROOTEXES} ${LIB} iris_signal100.cat

messages.usg : messages.msg
	${MKMSGUSG}

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

MKDEPEND_CSRCS = ${CLIB_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

ant_rcv:	ant_rcv.o ${LIB} 
		rm -rf ant_rcv
		${CXX} ${LD_OPT} ant_rcv.o ${LDFLAGS} ${LLIBS} -o ant_rcv
		rootchown root ant_rcv ; rootchmod 6775 ant_rcv

ant_xmt:	ant_xmt.o ${LIB} 
		rm -rf ant_xmt
		${CXX} ${LD_OPT} ant_xmt.o ${LDFLAGS} ${LLIBS} -o ant_xmt
		rootchown root ant_xmt ; rootchmod 6775 ant_xmt

antsim_rcv:	antsim_rcv.o ${LIB} 
		rm -rf antsim_rcv
		${CXX} ${LD_OPT} antsim_rcv.o ${LDFLAGS} ${LLIBS} -o antsim_rcv
		rootchown root antsim_rcv ; rootchmod 6775 antsim_rcv

antsim_xmt:	antsim_xmt.o ${LIB} 
		rm -rf antsim_xmt
		${CXX} ${LD_OPT} antsim_xmt.o ${LDFLAGS} ${LLIBS} -o antsim_xmt
		rootchown root antsim_xmt ; rootchmod 6775 antsim_xmt

ant_log:	ant_log.o ${LIB} 
		rm -rf ant_log
		${CXX} ${LD_OPT} ant_log.o ${LDFLAGS} ${LLIBS} -o ant_log
		rootchown root ant_log ; rootchmod 6775 ant_log

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

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

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

-include makefile.d
