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

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)

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) $< > $@.tmp
	sed 's|\($*\)\.o[ :]*|builddir\/\1.o $@ : |g' $@.tmp > $@
	$(RM) -f $@.tmp
