# Makefile for the nibbles lab.
# ---> Compile with gamke on BSD systems! <---

all: nibbles_c nibbles_asm nibbles_asm_start

# Rule for compiling C source
.c.o:
	gcc -Os -std=c11 -m32 -march=i686 -Wall -g -c $<

# Rule for compiling assembly source
.S.o:
	#as --32 -gstabs $^ -o $@
	gcc -m32 -march=i686 -c $<


# C game
nibbles_c: main.o cnibbles.o
	gcc -m32 -lcurses $^ -o $@

# ASM game
nibbles_asm: main.o nibbles.o helpers.o
	gcc -m32 -lcurses $^ -o $@

# ASM game
nibbles_asm_start: start.o nibbles.o helpers.o
	gcc -m32 -lcurses -lc -nostdlib $^ -o $@

# Documentation
docs: cnibbles.c nibbles.S start.S
	docco --languages=docco-languages.json $^

clean:
	rm -f *.o
	rm -f nibbles_c nibbles_asm nibbles_asm_start
