#	Makefile for udfArraySort
#
ifndef ESP_ROOT
$(error ESP_ROOT must be set -- Please fix the environment...)
endif
#
ifndef ESP_ARCH
$(error ESP_ARCH must be set -- Please fix the environment...)
endif
#
IDIR  = $(ESP_ROOT)/include
include $(IDIR)/$(ESP_ARCH)
LDIR  = $(ESP_ROOT)/lib
BDIR  = $(ESP_ROOT)/bin
ifdef ESP_BLOC
ODIR  = $(ESP_BLOC)/obj
else
ODIR  = .
endif

$(LDIR)/arraysort.so:	$(ODIR)/udfArraySort.o
	touch $(LDIR)/arraysort.so
	rm $(LDIR)/arraysort.so
	$(CC) $(SOFLGS) -o $(LDIR)/arraysort.so $(ODIR)/udfArraySort.o \
		-L$(LDIR) -legads -lm $(RPATH)

$(ODIR)/udfArraySort.o:	udfArraySort.c $(IDIR)/udpUtilities.c $(IDIR)/udpUtilities.h
	$(CC) -c $(COPTS) $(DEFINE) -I$(IDIR) -I. \
		udfArraySort.c -o $(ODIR)/udfArraySort.o

lint:
#	$(LINT) -I../../include -I$(IDIR) -I../utils $(wildcard *.c) -exportlocal -nestcomment -evalorder -retvalother

.PHONY: test
test : $(LDIR)/arraysort.so
	$(MAKE) -C test

clean:
	-rm $(ODIR)/udfArraySort.o

cleanall:	clean
	-rm $(LDIR)/arraysort.so
