CUR_REL_PATH := libs/tvsubs

include ../shared/config.mk

LIB = libtvsubs.a
INST_INCLUDES = tvsubs_lib.h

OBJS =	bothout.o \
	colors.o \
	DrawCatch.o \
	DrawOverlay.o \
	getstep.o \
	initialize.o \
	inside.o \
	LabelAxis.o \
	lat_long_grid.o \
	max_side_grid.o \
	NearestColor.o \
	overlay.o \
	plot.o \
	protected.o \
	rangerings.o \
	ReprojectTable.o \
	ReprojectVtv.o \
	rtdisp_ray.o \
	tvsubs_lib_nls_init.o \
	vertical_grids.o \
	xscreateimage.o

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

# C++ linking
LINK.o = $(LINK.C)

PRE_CPPFLAGS += -I../fileformats_lib -I../himath_lib -I../include -I../misc_lib -I../user_lib -I../vtv_lib
LDLIBS +=  -luser 

all: $(LIB_DIR)/$(LIB)

check: test_tv
	./test_tv

test_tv: test_tv.o $(LIB_DIR)/$(LIB)

clean:
	rm -f *.o *~ *.a *.d *.d.bak $(LIB_DIR)/$(LIB)

install: all $(IRIS_INCLUDE) $(IRIS_LIB)
	install -m 0664 -o $(IRIS_USER) -g $(IRIS_GROUP) $(INST_INCLUDES) $(IRIS_INCLUDE)
	install -m 0664 -o $(IRIS_USER) -g $(IRIS_GROUP) $(LIB) $(IRIS_LIB)

test:

uninstall:
	rm -f $(IRIS_LIB)/$(LIB)
	if [ -d $(IRIS_INCLUDE) ]; then \
		cd $(IRIS_INCLUDE) && rm -f $(INST_INCLUDES); fi

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

$(OBJS): Makefile

-include $(DEPS)
