#
# Make file for lcdd
# daemon that reads named pipe (fifo) and sends anything read from 
#  that to an I2C connected HD44780 compatible char. LCD
# 

SHELL		= /bin/sh

DEMOS		= 
PROGS		= lcdd

srcdir		= .

# **** CUSTOMISE THESE ******

includedir	= /usr/local/include
INSDIR		= /usr/local/bin
MANDIR		= /usr/local/man/man1
#LOCALINS	= $(HOME)/bin
#LOCALMAN	= $(HOME)/man/man1

lcdd		= lcdd.o lcd_func_ansi.o timersubs.o lcddriver.o i2csubs.o

timtest		= timtest.o timersubs.o

# ***************************
CC		= gcc
#CFLAGS		= -O -msoft-float
CFLAGS		= -O2
CPPFLAGS	= -I. -I$(includedir)

CCFLAGS		= $(CFLAGS) $(CPPFLAGS)

LINK		= $(CC)

#
# libraries

#LDFLAGS	= 
#LDFLAGS	= 
#LDFLAGS	= -static

# if there is an include file uncomment this. Add any other dependancies
#adio.o: adio.h

.c.o:
	$(CC) -c $(CCFLAGS) $<

all:	
	@cat README

clean:
	rm -f *~ *.o $(PROGS)

backup:	dist

dist:	lcdd
	rm -f *~ *.o
	(d=`basename $$PWD` ; cd .. ; tar cfz $$d.tgz $$d)

timtest:	$(timtest)
	$(CC) $(timtest) $(LDFLAGS) -o $@

lcdd:	$(lcdd)
	$(CC) $(lcdd) $(LDFLAGS) -o $@

i2csubs.o:	i2csubs.c i2csubs.h
lcdd.o:		lcdd.c lcdd.h timersubs.h
timersubs.o:	timersubs.c timersubs.h

install:	$(PROGS)
	@for f in $(PROGS) $(DEMOS) ; do \
	 echo "Copying $$f to $(INSDIR)" ;\
	 install -D --backup $$f $(INSDIR)/$$f; done


