# written by Guido Socher 
BUILD_ROOT=/
PREFIX=$(BUILD_ROOT)/usr
INSTALL=install
#-----------
# Linux and other platforms with gcc
CC=gcc 
CFLAGS= -Wall -O2
CFLAGS= -Wall -Wno-unused 
#-----------
BINDIR=$(PREFIX)/sbin

all: linuxwd

linuxwd: linuxwd.o 
	$(CC) -o $@ linuxwd.o 
linuxwd.o: linuxwd.c 
	$(CC) $(CFLAGS) -c linuxwd.c 

install: linuxwd 
	@echo Using the program \"$(INSTALL)\" to install the software 
	[ -d "$(BINDIR)" ] || mkdir -p $(BINDIR)
	$(INSTALL) -m 755 linuxwd $(BINDIR)
	[ -d "$(BUILD_ROOT)/etc/rc.d/init.d/" ] || mkdir -p $(BUILD_ROOT)/etc/rc.d/init.d/
	$(INSTALL) -m 755 linuxwd_rc $(BUILD_ROOT)/etc/rc.d/init.d/
	@echo "Intallation ready."
	@echo "You must now manually create links from $(BUILD_ROOT)/etc/rc.d/rc3.d/S21linuxwd_rc"
	@echo "and $(BUILD_ROOT)/etc/rc.d/rc5.d/S21linuxwd_rc to $(BUILD_ROOT)/etc/rc.d/init.d/linuxwd_rc"
	@echo "For Redhat/Mandrake: you can also use chkconfig to create these links"

clean:
	rm -f linuxwd *.o core
