CUR_REL_PATH := "rda/rdautils"

include ../shared/config.mk

PRE_CPPFLAGS += -I../pcicards -I../rdasubs_lib -I../softplane -I../netcards_lib -I../user_lib -I../config_lib

PRE_LDFLAGS = -L${LIB_DIR} -L../intelipp
LDFLAGS  += -L${IRIS_RDA_LIB} -Wl,-rpath-link -Wl,../intelipp

LDLIBS_rdadiags += -lpcicards -lsoftplane -lrdasubs -lconfig
LDLIBS_wsr98d_test +=  -lnetcards -lhimath -lpcicards -lrdasubs -lantenna -lconfig -lipps
LDLIBS_wsr98d_amuxIO_monitor +=  -lnetcards -lhimath -lpcicards -lrdasubs -lantenna -lconfig -lipps
LDLIBS_wsr98d_typetest +=  -lnetcards -lhimath -lpcicards -lrdasubs -lantenna -lconfig -lipps
LDLIBS_rcp903_test +=  -lnetcards -lhimath -lpcicards -lrdasubs -lantenna -lconfig -lipps
LDLIBS_pstr1163_tool += -lm
LDLIBS_bite_export += -lconfig -lantenna -luser
LDLIBS          += -luser -lrt -lpthread -lm

EXES =		rdadiags rcp903_test rcp903_burnin wsr98d_test wsr98d_amuxIO_monitor wsr98d_typetest pstr1163_tool bite_export

OBJS = $(patsubst %,%.o,$(EXES))
DEPS = $(patsubst %.o,%.d,$(OBJS))

all: $(EXES)

rdadiags: rdadiags.o
wsr98d_test: wsr98d_test.o
wsr98d_amuxIO_monitor: wsr98d_amuxIO_monitor.o
wsr98d_typetest: wsr98d_typetest.o
rcp903_test: rcp903_test.o
rcp903_burnin: rcp903_burnin.o
pstr1163_tool: pstr1163_tool.o
bite_export: bite_export.o

install: all $(IRIS_BIN)
	install -m 0775 -o $(IRIS_USER) -g $(IRIS_GROUP) $(STRIP_OPT)   $(EXES) $(IRIS_BIN)
	install -m 0664 -o $(IRIS_USER) -g $(IRIS_GROUP) bite_export.rc $(IRIS_CONFIG_TMPL_RCD)/bite_export
	install -m 0775 -o root         -g root          bite_export.rc $(SYS_INIT_D)/bite_export
	install -m 0644 -o ${IRIS_USER} -g ${IRIS_GROUP} sigmet-bite_export $(IRIS_CONFIG_TMPL_LOGROTATE)

test:

uninstall:
	if [ -d $(IRIS_BIN) ]; then \
		cd $(IRIS_BIN) && rm -f $(EXES); fi
	if [ -d $(SYS_INIT_D) ]; then cd $(SYS_INIT_D) && rm -f bite_export; fi
	if [ -d $(IRIS_CONFIG_TMPL_RCD) ]; then cd $(IRIS_CONFIG_TMPL_RCD) && rm -f bite_export; fi
	if [ -d ${IRIS_CONFIG_TMPL_LOGROTATE} ]; then \
		cd ${IRIS_CONFIG_TMPL_LOGROTATE} && rm -f sigmet-bite_export; fi


clean:
	rm -f $(EXES) core *.o *.a *~ *.d *.d.bak

$(OBJS): Makefile

-include $(DEPS)
