PROGRAM=cubi

CC=gcc

CFLAGS=-I. -Wall -O3
LDFLAGS=

SOURCES=$(wildcard *.c)
HEADERS=$(wildcard *.h)

OBJECTS=$(patsubst %.c,%.o,$(SOURCES))

COLORS=blue green yellow purple orange red

all:		$(PROGRAM)

$(PROGRAM):	$(OBJECTS)
		$(CC) -o $(PROGRAM) $(OBJECTS) $(LDFLAGS)

%.o:		%.c $(HEADERS)
		$(CC) $(CFLAGS) -c -o $@ $<

clean:
		rm -f $(PROGRAM) $(OBJECTS)

test:		$(PROGRAM)
		for c in $(COLORS); do ./$(PROGRAM) -o output/std-cube-$$c.txt nets/cube.txt parts/std-$$c.txt; done
		for c in $(COLORS); do ./$(PROGRAM) -o output/exp-cube-$$c.txt nets/cube.txt parts/exp-$$c.txt; done
		for c in $(COLORS); do ./$(PROGRAM) -o output/std-flat-$$c.txt nets/flat/std-flat-$$c.txt parts/std-$$c.txt; done
		for c in $(COLORS); do ./$(PROGRAM) -o output/exp-flat-$$c.txt nets/flat/exp-flat-$$c.txt parts/exp-$$c.txt; done

test-clean:
		for c in $(COLORS); do rm -f output/std-cube-$$c.txt; done
		for c in $(COLORS); do rm -f output/exp-cube-$$c.txt; done
		for c in $(COLORS); do rm -f output/std-flat-$$c.txt; done
		for c in $(COLORS); do rm -f output/exp-flat-$$c.txt; done
