CLIBS=
CINCLUDES=
CFLAGS=-Wall -std=c++98 -O2
CC=c++
NASM=nasm
OBJS=hex2bin.o
STRIP=strip

default:
	make hex2bin
	make bin2hex 
	make hex2c
	make runbin

all:
	make clean
	make hex2bin
	make bin2hex
	make hex2c
	make runbin

win:
	wine cmd /c build.bat

test: 
	make test.bin
	./bin2hex ./test.bin ./test.hex
	./hex2bin ./test.hex ./test2.bin
	./runbin ./test2.bin

test2:
	./hex2bin ./test.hex ./test2.bin
	./runbin ./test2.bin

test.bin:test.asm
	${NASM} -f bin ./test.asm -o ./test.bin

hex2c.o:hex2c.cpp
	${CC} hex2c.cpp -c ${CFLAGS} ${CLIBS} ${CINCLUDES}

hex2bin.o:hex2bin.cpp
	${CC} hex2bin.cpp -c ${CFLAGS} ${CLIBS} ${CINCLUDES}

bin2hex.o:bin2hex.cpp
	${CC} bin2hex.cpp -c ${CFLAGS} ${CLIBS} ${CINCLUDES}

runbin.o:runbin.cpp
	${CC} runbin.cpp -c ${CFLGS} ${CLIBS} ${CINCLUDES}

hex2c:hex2c.o
	${CC} -o hex2c hex2c.o ${CFLAGS} ${CLIBS} ${CINCLUDES}
	strip ./hex2c

bin2hex:bin2hex.o
	${CC} -o bin2hex bin2hex.o ${CFLAGS} ${CLIBS} ${CINCLUDES}
	strip ./bin2hex

hex2bin:hex2bin.o
	${CC} -o hex2bin hex2bin.o ${CFLAGS} ${CLIBS} ${CINCLUDES}
	strip ./hex2bin

runbin:runbin.o
	${CC} -o runbin runbin.o ${CFLAGS} ${CLIBS} ${CINCLUDES}
	strip ./runbin

clean:
	rm -f hex2bin.o
	rm -f hex2bin
	rm -f bin2hex.o
	rm -f bin2hex
	rm -f runbin.o
	rm -f runbin
	rm -f *.core
