################################################################################
##
##  Makefile:   test/sysUtils
##
##  $Revision: 1.11 $  $Name: not supported by cvs2svn $
##  $Date: 2004-06-11 19:18:41 $
##
##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
##
###############################################################################

include ../../src/Makefile.Globals

PSLIB_INCL_DIR = ../../include

PSLIB_LIB_DIR = ../../lib

TARGET = tst_psMatrix01 \
 tst_psMatrix02 \
 tst_psMatrix03 \
 tst_psMatrix04 \
 tst_psMatrix05 \
 tst_psMatrix06 \
 tst_psMatrix07 \
 tst_psStats00 \
 tst_psStats01 \
 tst_psStats02 \
 tst_psStats03 \
 tst_psStats05 \
 tst_psStats06 \
 tst_psStats07 \
 tst_psStats08 \
 tst_psStats09 \
 tst_psHist00 \
 tst_psHist01 \
 tst_psHist02 \
 tst_psFunc00 \
 tst_psFunc01 \
 tst_psImageStats00 \
 tst_psImageStats01 \
 tst_psImageStats02 \
 tst_psImageIO

DEPENDENCIES = $(addprefix builddir/,$(addsuffix .d,$(TARGET)))
OBJS = $(addprefix builddir/,$(addsuffix .o,$(TARGET)))

all: builddir $(TARGET)

builddir:
	mkdir builddir

include $(DEPENDENCIES)

clean:
	@echo "    Deleting executable and binary files for 'test/sysUtils'"
	$(RM) $(TARGET) $(OBJS) *.lint

builddir/%.o : %.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -I.. -I$(PSLIB_INCL_DIR) -c -o $@ $<

%   : builddir/%.o
	$(CC) -o $@ $< -L$(PSLIB_LIB_DIR) -lpslib -lpstest -lgsl -lgslcblas $(LDFLAGS)

distclean: clean
	$(RM) $(TARGET)

%.lint: %.c
	splint +posixlib -exportlocal -realcompare $(INCLUDE_GLOBAL) $? > $@; cat $@

builddir/%.d: %.c
	$(CC) -MM $(CFLAGS) -I$(PSLIB_INCL_DIR) $< > $@.tmp
	sed 's|\($*\)\.o[ :]*|builddir\/\1.o $@ : |g' $@.tmp > $@
	$(RM) -f $@.tmp

