### Makefile for the utilities

# you can change this for taste
CC=gcc -Wall -O2

OBJS= atob.o atob1.o btoa.o btoa1.o
FILS= atob atob1 btoa btoa1
# files used in testing
TESTF= btoa.undump btoa.dump btoa.undump2
# example files
XTRA= createetc createetc.bin

all: $(FILS)

atob.o  : atob.c
atob1.o : atob1.c
btoa.o  : btoa.c
btoa1.o : btoa1.c

.PHONY : clean delstuff test

clean: 
	-rm -f $(OBJS) $(FILS) *~
   
delstuff: 
	-rm -f $(OBJS) $(TESTF)

test:
	@echo "testing btoa and atob"
	./btoa < btoa | ./atob > btoa.undump
	@if cmp -s btoa btoa.undump ; then echo "test passed" ;\
	else echo "test failed"; exit 1; fi
	@echo "testing btoa1 and atob1"
	./btoa1 btoa btoa.dump
	./atob1 btoa.dump btoa.undump2
	@if cmp -s btoa btoa.undump2 ; then echo "test passed" ;\
	else echo "test failed"; exit 1; fi
