CC = /usr/bin/gcc
LD = /usr/bin/ld
DD = /bin/dd

all: econos boot

econos:
	@echo -e "(BUILD) ECON O\044"

boot:
	@echo "Building bootsector."
	@$(CC) -c boot.s
	@$(LD) -N -s -e init boot.o -o boot.out --oformat binary -Ttext 0x7c00
	@$(DD) if=/dev/zero of=boot.img bs=512 count=1
	@$(DD) if=boot.out of=boot.img conv=notrunc
	@make clean

clean:
	@find . -regex ".*\.*[o~]" -print |xargs -r rm
	@find . -name boot.out -print |xargs -r rm
	@echo "(CLEAN) *.o *~"
