CC	= gcc
LD	= gcc

# for debug
#CFLAGS	= -Wall -g
#LDFLAGS = -N

PALMDEVICE="/dev/palm"
# allow maintainers to customize the device name

# for production code
CFLAGS	= -Wall -O3 -fomit-frame-pointer

autopilot:	autopilot.o
	$(LD) $(LDFLAGS) -o autopilot autopilot.o

autopilot.o: autopilot.c
	$(CC) $(CFLAGS) -c autopilot.c -DPALMDEVICE=\"$(PALMDEVICE)\"

install: autopilot
	install -m 555 autopilot /usr/local/bin/autopilot
	install -m 444 autopilot.1 /usr/local/man/man1/autopilot.1

clean:
	$(RM) autopilot autopilot.o core *~

dist:	autopilot.c Makefile autopilot.1 README
	$(RM) autopilot autopilot.o core autopilot-1.0.tar.gz *~
	cd .. ; tar -czvf autopilot-1.0.tar.gz autopilot-1.0
