#
# Makefile for Checker
# 

# Your compiler
CC = gcc
AS = as

MDIR= l-malloc/

# Flags for your compiler.
# Those are for Gcc
# O2 means high optimization and Wall enables (nearly) all warnings.
# please, do not add -fomit-frame-pointer
CPPFLAGS = -I.. -I../lib -I../$(MDIR)
CFLAGS = -O2 -Wall -g

# LIBOBJ is an object file, that contains all the library for safety link.
LIBOBJ= #../libchecker.o

all: try_checker try_detector try_maccess

try_checker: try_checker.o $(LIBOBJ)
	gcc -o try_checker try_checker.o $(LIBOBJ) libtermcap.a -g

try_detector: try_detector.o $(LIBOBJ)
	gcc -o try_detector try_detector.o $(LIBOBJ) -g

try_maccess.o: try_maccess.c
	checkergcc -c try_maccess.c -o try_maccess.o -Wall

try_maccess: try_maccess.o $(LIBOBJ)
	checkergcc try_maccess.o -o try_maccess

.depend: Makefile
	@echo "You have not make the dependency file"	# have a beep
	@echo "Try 'make dep'"

clean:
	$(RM) -f core *.o a.out try_checker try_detector try_maccess
	$(RM) -f .depend *~

dep:
	$(CPP) -M *.c $(CPPFLAGS) > .depend

#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
