#
# Makefile - NetLED Make File
#
# make
# make clean    - Clean up after creating (remove o files, core, debug, etc)
# make install  - Install the binary (and make it if you haven't already)
# make update   - Download the update patch and inflict it on your computer.
#

EXE = netled
app = netled.c
led = netleds.c
location = /usr/local/bin
CC = gcc -DLINUX 
CCFLAGS = -Wall -O9

## Uncomment the next line to make the program work with 2.1/2.2 kernels
## without trying to use the patch files.
# define=-d newkernel

all:	$(EXE)

netled: netleds
	$(CC) $(CCFLAGS) -c   $(app)          -o netled.o    $(define)
	$(CC) -o netled netled.o netleds.o $(define)

netleds: 
	$(CC) $(CCFLAGS) -c   $(led)          -o netleds.o   $(define)

netled.o: netled.c netleds.h
	$(CC) $(CCFLAGS) -c   $(app)          -o netled.o    $(define)

install: all
	install $(EXE) $(location)/$(EXE) --mode 6755
	install netled.conf /etc/netled.conf
	install netled.1 /usr/local/man/man1/netled.1

clean: 
	rm -f netled
	rm -f *.o
	rm -f *.out
	rm -f core debug

update:
	lynx -dump http://mars.ark.com/~mbevan/download/netled/update.patch > update.patch
	patch -i update.patch
