#######################################################################
# This file is part of the argtable2 library.
# Copyright (C) 1998,1999,2000,2001,2003 Stewart Heitmann
# sheitmann@users.sourceforge.net
#
# The argtable2 library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
#######################################################################
@SET_MAKE@
SHELL  = /bin/sh

CC        = @CC@
CFLAGS    += @CFLAGS@ -ggdb  -Wall -ansi
LDFLAGS   += @LDFLAGS@ 
LDLIBS    += -largtable2

TARGETS = fntests test_lit test_int test_dbl

check: 
#   note: OS X cant make static because there is no static version of libcrt.o
	$(MAKE) CFLAGS="-I../src $(CFLAGS) -static" LDFLAGS="-L../src $(LDFLAGS)" clean $(TARGETS)
	./check.sh > check.log
	@echo "ALL CHECKS PASSED"

memcheck:
	$(MAKE) CFLAGS="-I../src $(CFLAGS) -static" LDFLAGS="-L../src -L/usr/local/lib $(LDFLAGS)" LDLIBS="$(LDLIBS) -lmemcheck"  clean $(TARGETS)
	./check.sh > check.log
	@echo "ALL MEMCHECKS PASSED"

installcheck:
	$(MAKE) CFLAGS="-I@prefix@/include $(CFLAGS)" LDFLAGS="-L@prefix@/lib $(LDFLAGS)" clean $(TARGETS)
	./check.sh > check.log
	@echo "INSTALL CHECKS PASSED"	
    
clean:
	rm -f core core.* *.core *.o *~ $(TARGETS) memcheck.log check.log

distclean: clean
	rm -f Makefile


