###################################################
GCC	= gcc
OPTIONS	= -Wall -O4 -pipe

default:
	@echo ""
	@echo "Bzzzzz. must use one of the following parameters"
	@echo ""
	@echo "make dev ........ compile for use with burnm module"
	@echo "make io ......... compile to use IO routines (dangerous to use)"
	@echo "make clean ...... cleans dist."
	@echo "make install .... install burn into /usr/local/bin"
	@echo "make uninstall .. remove burn from /usr/local/bin"
	@echo ""

dev:
	@make burn "IF=if_dev.o"
	@make port_test "IF=if_dev.o"
	@make loopback_test "IF=if_dev.o"

io:
	@make burn "IF=if_io.o"
	@make port_test "IF=if_io.o"
	@make loopback_test "IF=if_io.o"

install:
	install -s -m 0755 -o root -g root burn /usr/local/bin

uninstall:
	rm -rf /usr/local/bin/burn

###################################################
OBJS_1	= common.o $(IF) if_misc.o pio_6821.o \
		target_2051.o target_at24cx.o target_at89c51.o burn.o
burn: $(OBJS_1)
	$(GCC) $(OPTIONS) -o burn $(OBJS_1)
	strip burn

###################################################
OBJS_2	= common.o $(IF) if_misc.o pio_6821.o port_test.o
port_test: $(OBJS_2)
	$(GCC) $(OPTIONS) -o port_test $(OBJS_2)
	strip port_test

###################################################
OBJS_3	= common.o $(IF) if_misc.o pio_6821.o loopback_test.o
loopback_test: $(OBJS_3)
	$(GCC) $(OPTIONS) -o loopback_test $(OBJS_3)
	strip loopback_test

###################################################
clean:
	rm -f *.o burn port_test loopback_test

###################################################
%.o: %.c *.h
	$(GCC) $(OPTIONS) -c $< -o $@
