################################################################################
##
##  Makefile:   test/sysUtils
##
##  $Revision: 1.16 $  $Name: not supported by cvs2svn $
##  $Date: 2004-06-26 03:05:12 $
##
##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
##
###############################################################################

ifndef prefix
    export prefix=$(shell cd ../..;pwd)
endif

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

PSLIB_INCL_DIR = ../../include

PSLIB_LIB_DIR = ../../lib

TARGET = atst_psAbort_01  \
         atst_psAbort_02  \
         atst_psAbort_03  \
         tst_psMemory     \
         tst_psError      \
         tst_psHash00     \
         tst_psHash01     \
         tst_psHash02     \
         tst_psHash03     \
         tst_psHash04     \
         tst_psLogMsg00   \
         tst_psLogMsg01   \
         tst_psLogMsg02   \
         tst_psLogMsg03   \
         tst_psStringCopy \
         tst_psTrace00    \
         tst_psTrace01    \
         tst_psTrace02    \
         tst_psTrace03    \
         tst_psTrace04

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) $(OBJS) *.lint

distclean: clean
	$(RM) $(TARGET)

cleandependencies:
	$(RM) $(DEPENDENCIES)

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

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

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

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

install: $(testbindir) $(testbindir)/verified $(TARGET)
	install $(TARGET) $(testbindir)
	install verified/*.stderr verified/*.stdout $(testbindir)/verified

$(testbindir):
	mkdir -p $(testbindir)

$(testbindir)/verified:
	mkdir -p $(testbindir)/verified

