BIN2HEX=../../utils/ihex/bin2hex
NEWLINE_LF=nkf -Lu
NEWLINE_CRLF=nkf -Lw
NEWLINE_CR=nkf -Lm

all: \
     ato-shuttle.hex       \
     ato-endless.hex       \
     ato-reverse.hex       \
     ato-wreverse.hex      \
     ato-wreverse-x.hex    \
     ato-sta1-shuttle.hex  \
     ato-sta1-endless1.hex \
     ato-sta1-endless2.hex \
     ato-switchback.hex    \
     ato-endless-lf.hex      \
     ato-endless-crlf.hex    \
     ato-endless-cr.hex     

clean: 
distclean: 
	-rm -f core *.core *~ 
veryclean:
	-rm -f *.hex

ato-shuttle.hex:       ato-shuttle.txt
	$(BIN2HEX) -f  ato-shuttle.txt       ato-shuttle.hex
ato-endless.hex:       ato-endless.txt
	$(BIN2HEX) -f  ato-endless.txt       ato-endless.hex
ato-reverse.hex:       ato-reverse.txt
	$(BIN2HEX) -f  ato-reverse.txt       ato-reverse.hex
ato-wreverse.hex:      ato-wreverse.txt
	$(BIN2HEX) -f  ato-wreverse.txt      ato-wreverse.hex
ato-wreverse-x.hex:    ato-wreverse-x.txt
	$(BIN2HEX) -f  ato-wreverse-x.txt    ato-wreverse-x.hex
ato-sta1-shuttle.hex:  ato-sta1-shuttle.txt
	$(BIN2HEX) -f  ato-sta1-shuttle.txt  ato-sta1-shuttle.hex
ato-sta1-endless1.hex: ato-sta1-endless1.txt
	$(BIN2HEX) -f  ato-sta1-endless1.txt ato-sta1-endless1.hex
ato-sta1-endless2.hex: ato-sta1-endless2.txt
	$(BIN2HEX) -f  ato-sta1-endless2.txt ato-sta1-endless2.hex
ato-switchback.hex:    ato-switchback.txt
	$(BIN2HEX) -f  ato-switchback.txt    ato-switchback.hex

ato-endless-lf.hex:      ato-endless.txt
	$(NEWLINE_LF)    ato-endless.txt     > ato-endless-lf.txt
	$(BIN2HEX) -f    ato-endless-lf.txt    __.hex
	$(NEWLINE_LF)    __.hex              > ato-endless-lf.hex
	rm -f            __.hex
ato-endless-crlf.hex:    ato-endless.txt
	$(NEWLINE_CRLF)  ato-endless.txt     > ato-endless-crlf.txt
	$(BIN2HEX) -f    ato-endless-crlf.txt  __.hex
	$(NEWLINE_CRLF)  __.hex              > ato-endless-crlf.hex
	rm -f            __.hex
ato-endless-cr.hex:      ato-endless.txt
	$(NEWLINE_CR)    ato-endless.txt     > ato-endless-cr.txt
	$(BIN2HEX) -f    ato-endless-cr.txt    __.hex
	$(NEWLINE_CR)    __.hex              > ato-endless-cr.hex
	rm -f            __.hex
