# If you need to change this to gcc or pcc or whatever, go ahead.
CC =		cc

# Uncommenting NO_LEAKFINDER makes the program *not* check for memory leaks.
# The default, once leakfinder is installed, is to check.
#NO_LEAKFINDER = -DNO_LEAKFINDER

# Most of these compiler flags are for adding extra checks. If your
# compiler doesn't support them, feel free to get rid of them.
CFLAGS =	-O -ansi -pedantic -U__STRICT_ANSI__ -Wall -Wpointer-arith -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wno-long-long $(NO_LEAKFINDER)

LDFLAGS =	-g

all:		leakfinder_test

leakfinder_test:	leakfinder_test.c leakfinder.h leakfinder.o
	$(CC) $(CFLAGS) leakfinder_test.c $(LDFLAGS) leakfinder.o -o leakfinder_test

leakfinder.o:	leakfinder.c leakfinder.h
	$(CC) $(CFLAGS) -c leakfinder.c

clean:
	rm -f e leakfinder_test *.o core core.* *.core

tar:
	@name=`sed -n -e '/^\*\* Version /!d' -e 's/.* Version /leakfinder-/' -e 's/ .*//p' leakfinder.h` ; \
	  rm -rf $$name ; \
	  mkdir $$name ; \
	  tar cf - `cat FILES` | ( cd $$name ; tar xfBp - ) ; \
	  chmod 644 $$name/Makefile ; \
	  tar cf $$name.tar $$name ; \
	  rm -rf $$name ; \
	  gzip $$name.tar
