CUR_REL_PATH := "iris/mcidas_pipe"

include ../shared/config.mk

APPS = mcidasview
PIPES = McIdasSatToIris IrisToMcidas
CONFS = McIdasSatToIris.conf IrisToMcidas.conf

PRE_CPPFLAGS += -I../pipesup_lib

LDLIBS += -lpipesup -lhimath -lmisc -luser -lpopt -lsiglog -lboost_system

TEMPL_PIPES_DIR = $(IRIS_ROOT)/config_template/pipes

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

# Use C++ default linking rule
LINK.o = $(LINK.cc)

all: $(PIPES) $(APPS)

IrisToMcidas: IrisToMcidas.o
McIdasSatToIris: McIdasSatToIris.o
mcidasview: mcidasview.o

install: all $(IRIS_PIPES) $(IRIS_PIPES_TMPL) $(IRIS_CONFIG_TMPL)
	install -m 0775 -o $(IRIS_USER) -g $(IRIS_GROUP) $(STRIP_OPT) $(PIPES) $(IRIS_PIPES)
	install -m 0775 -o $(IRIS_USER) -g $(IRIS_GROUP) $(STRIP_OPT) $(PIPES) $(IRIS_PIPES_TMPL)
	install -m 0664 -o $(IRIS_USER) -g $(IRIS_GROUP)    $(CONFS) $(IRIS_CONFIG_TMPL)
	install -m 0775 -o $(IRIS_USER) -g $(IRIS_GROUP) $(STRIP_OPT) $(APPS)  $(IRIS_BIN)

test:

uninstall:
	if [ -d $(IRIS_PIPES) ]; then \
		cd $(IRIS_PIPES) && rm -f $(PIPES); fi
	if [ -d $(IRIS_PIPES_TMPL) ]; then \
		cd $(IRIS_PIPES_TMPL) && rm -f $(PIPES); fi
	if [ -d $(IRIS_CONFIG_TMPL) ]; then \
		cd $(IRIS_CONFIG_TMPL) && rm -f $(CONFS); fi
	if [ -d $(IRIS_BIN) ]; then \
		cd $(IRIS_BIN) && rm -f $(APPS); fi

clean:
	rm -f $(PIPES) $(APPS) *.o *.d *.d.bak *~

$(OBJS): Makefile

-include $(DEPS)
