CUR_REL_PATH := iris/out_lib
PACKAGE := iris-out_lib

include ../shared/config.mk

SUBDIRS := sws_icons
ifdef ENABLE_NLS
  SUBDIRS :=  $(SUBDIRS) po
endif

PRE_CPPFLAGS += -I../include -I../link_lib -I../prodsup_lib -I../share_lib -I../sws_lib -I../wrdata_lib
LIB = libout.a
CONF_FILES = OUTPUT_LEGEND.DAT

OBJS =	catch_draw.o \
	collegend.o \
	colormap.o \
	copyimage.o \
	FindColorLegend.o \
	forecast.o \
	header_from_onscreen.o \
	ilayout.o \
	image_draw.o \
	ndop_draw.o \
	out_apo.o \
	out_legend.o \
	out_legend_load.o \
	out_lib_nls_init.o \
	overlay_buffer.o \
	prod_to_tiff.o \
	psitext.o \
	sline_draw.o \
	sws_draw.o \
	tdwr_draw.o \
	track_draw.o \
	vad_draw.o \
	vtv_to_printer.o \
	vtv_to_file_format.o \
	vvp_draw.o \
	warn_draw.o \
	wind_draw.o

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

all: $(LIB_DIR)/$(LIB)
	$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@;)

clean:
	$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@;)
	rm -f *.o *~ *.a *.d *.d.bak $(LIB_DIR)/$(LIB)

install: all $(IRIS_LIB) $(IRIS_CONFIG_TMPL) 
	$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@;)
	install -m 0664 -o $(IRIS_USER) -g $(IRIS_GROUP) $(LIB) $(IRIS_LIB)
	install -m 0664 -o $(IRIS_USER) -g $(IRIS_GROUP) $(CONF_FILES) $(IRIS_CONFIG_TMPL)

test:
	$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@;)

uninstall:
	$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@;)
	rm -f $(IRIS_LIB)/$(LIB)
	if [ -d $(IRIS_CONFIG_TMPL) ]; then \
		cd $(IRIS_CONFIG_TMPL) && rm -f $(CONF_FILES); fi

$(LIB): $(OBJS)
	rm -f $@; $(AR) -rsc $@ $^

$(OBJS): Makefile

-include $(DEPS)
