target = marcille.exe
source = marcille.c

$(target): $(source)
	gcc -O2 -Wall -pedantic $< -o $@

test: \
	test_passed.compile_all \
	test_passed.check_args \
	test_passed.36x12 \
	test_passed.64x12 \
	test_passed.36x64 \
	test_passed.128x36 \
	test_passed.36x128 \
	test_passed.53x71 \
	test_passed.131x97 \
	test_passed.param_sweep

test_passed.compile_all: $(source) test_compile_all.sh
	./test_compile_all.sh $< && touch $@

test_passed.check_args: $(target) test_check_args.sh
	./test_check_args.sh $< && touch $@

test_passed.36x12: $(target) test_dungeon_attributes.sh check_expected_size.pl single_connected_space.pl
	./test_dungeon_attributes.sh $< 36 12 && touch $@

test_passed.64x12: $(target) test_dungeon_attributes.sh check_expected_size.pl single_connected_space.pl
	./test_dungeon_attributes.sh $< 64 12 && touch $@

test_passed.36x64: $(target) test_dungeon_attributes.sh check_expected_size.pl single_connected_space.pl
	./test_dungeon_attributes.sh $< 36 64 && touch $@

test_passed.128x36: $(target) test_dungeon_attributes.sh check_expected_size.pl single_connected_space.pl
	./test_dungeon_attributes.sh $< 128 36 && touch $@

test_passed.36x128: $(target) test_dungeon_attributes.sh check_expected_size.pl single_connected_space.pl
	./test_dungeon_attributes.sh $< 36 128 && touch $@

test_passed.53x71: $(target) test_dungeon_attributes.sh check_expected_size.pl single_connected_space.pl
	./test_dungeon_attributes.sh $< 53 71 && touch $@

test_passed.131x97: $(target) test_dungeon_attributes.sh check_expected_size.pl single_connected_space.pl
	./test_dungeon_attributes.sh $< 131 97 && touch $@

test_passed.param_sweep: $(target) test_param_sweep.sh
	./test_param_sweep.sh $< && touch $@

clean:
	-rm -f $(target) test_passed.*
