#
# $RCSfile: Makefile,v $  $Revision: 1.5 $  $Name:  $
# $Id: Makefile,v 1.5 2007/01/04 15:43:28 bpaauwe Exp $
# $Author: bpaauwe $
# $Date: 2007/01/04 15:43:28 $
# ----------------------------------------------------------------------------
#
#  Copyright (c) Bob Paauwe (2006)
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by the Free
#  Software Foundation; either version 2 of the License, or (at your option)
#  any later version.
#
#  This program 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 General Public License for
#  more details.
#
#  You should have received a copy of the GNU General Public License along
#  with this program; if not, write to the Free Software Foundation, Inc.,
#  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ----------------------------------------------------------------------------


CFLAGS = -g -Wall -I/usr/local/include -I../libilib
LIBS = -L /usr/local/lib -lusb
ILIB = ../libilib/libilib.a

ifeq ($(INCLUDE_LIBHID), "1")
LIBS += -lhid
endif

all: download icmd timers monitor mem

$(ILIB):
	(cd ../libilib; make)

timers: timers.c ../timer_funcs.c ../timers.h $(ILIB) ../libilib/ilib.h
	$(CC) $(CFLAGS) -o timers timers.c ../timer_funcs.c $(ILIB) $(LIBS)

download: download.c $(ILIB) ../libilib/ilib.h
	$(CC) $(CFLAGS) -o download download.c $(ILIB) $(LIBS)

mem: mem.c $(ILIB) ../libilib/ilib.h
	$(CC) $(CFLAGS) -o mem mem.c $(ILIB) $(LIBS)

icmd: icmd.c $(ILIB) ../libilib/ilib.h
	$(CC) $(CFLAGS) -o icmd icmd.c $(ILIB) $(LIBS)

monitor: monitor.c $(ILIB) ../libilib/ilib.h
	$(CC) $(CFLAGS) -o monitor monitor.c $(ILIB) $(LIBS)

.c.o :
	$(CC) $(DEBUG) $(CFLAGS) $(LIBUSB) -c $<

clean:
	-rm download icmd timers monitor
