kusano 2b45e8
UTEST_CHECK = 1
kusano 2b45e8
TOPDIR	= ..
kusano 2b45e8
include $(TOPDIR)/Makefile.system
kusano 2b45e8
kusano 2b45e8
TARGET=openblas_utest
kusano 2b45e8
kusano 2b45e8
CUNIT_URL=http://downloads.sourceforge.net/project/cunit/CUnit/2.1-2/CUnit-2.1-2-src.tar.bz2
kusano 2b45e8
CUNIT_DIR=$(CURDIR)/CUnit-2.1-2
kusano 2b45e8
kusano 2b45e8
CUNIT_LIB=$(CUNIT_DIR)/lib/libcunit.a
kusano 2b45e8
kusano 2b45e8
CFLAGS+=-I$(CUNIT_DIR)/include
kusano 2b45e8
kusano 2b45e8
OBJS=main.o test_rot.o test_swap.o test_axpy.o test_dotu.o test_rotmg.o test_dsdot.o test_amax.o
kusano 2b45e8
kusano 2b45e8
all : run_test
kusano 2b45e8
kusano 2b45e8
CUnit-2.1-2-src.tar.bz2:
kusano 2b45e8
ifeq ($(OSNAME), Darwin)
kusano 2b45e8
	curl -O $(CUNIT_URL)
kusano 2b45e8
else
kusano 2b45e8
	wget $(CUNIT_URL)
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
$(CUNIT_DIR): CUnit-2.1-2-src.tar.bz2
kusano 2b45e8
	@if test `$(MD5SUM) CUnit-2.1-2-src.tar.bz2 | $(AWK) '{print $$1}'` = 31c62bd7a65007737ba28b7aafc44d3a; then \
kusano 2b45e8
		echo $(TAR) xjf $< ;\
kusano 2b45e8
		$(TAR) xjf $< ; \
kusano 2b45e8
	else \
kusano 2b45e8
		rm -rf $(CUNIT_DIR) ;\
kusano 2b45e8
		echo "	Cannot download CUnit-2.1-2-src.tar.bz2 or the MD5 check sum is wrong (Please use orignal)."; \
kusano 2b45e8
		exit 1; \
kusano 2b45e8
	fi
kusano 2b45e8
kusano 2b45e8
kusano 2b45e8
$(CUNIT_LIB): $(CUNIT_DIR)
kusano 2b45e8
	(cd $(CUNIT_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" ./configure --prefix=$(CUNIT_DIR))
kusano 2b45e8
	$(MAKE) -C $(CUNIT_DIR)
kusano 2b45e8
	$(MAKE) -C $(CUNIT_DIR) install
kusano 2b45e8
kusano 2b45e8
$(TARGET): $(CUNIT_LIB) $(OBJS)
kusano 2b45e8
	$(CC) $(CFLAGS) -o $@ $^ ../$(LIBNAME) $(CUNIT_LIB) $(EXTRALIB)
kusano 2b45e8
kusano 2b45e8
run_test: $(TARGET)
kusano 2b45e8
	./$(TARGET)
kusano 2b45e8
kusano 2b45e8
clean:
kusano 2b45e8
	-rm -f *.o $(TARGET) 
kusano 2b45e8
	-rm -rf $(CUNIT_DIR)
kusano 2b45e8
kusano 2b45e8
libs:
kusano 2b45e8