# Cfish (Stockfish in C) - AROS (PPC) build

EXE = CFish_AROS

CC = gcc

OBJS = benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o \
	material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o \
	search.o tbprobe.o thread.o timeman.o tt.o uci.o ucioption.o \
	settings.o polybook.o

# GCC 4.6.4 predates C11 (stdatomic.h needs GCC 4.9+): use gnu99, and
# stdatomic_compat.h (see the files that include <stdatomic.h>) steps in
# automatically based on __GNUC__/__GNUC_MINOR__.
#
# -Wno-missing-braces/-Wno-missing-field-initializers silence warnings
# about standard, intentional C idioms (= { 0 }, = { NULL },
# PTHREAD_MUTEX_INITIALIZER) that this GCC version is overly pedantic
# about. -Wno-array-bounds silences a false positive in thread.c (this
# GCC version's array-bounds checker can't follow the index through
# pthread_create()).
CFLAGS = -Wall -std=gnu99 -Wextra -Wshadow -DNDEBUG -O3 -DNO_PREFETCH \
	-Wno-missing-braces -Wno-missing-field-initializers -Wno-array-bounds
LDFLAGS = -lm -lpthread

.PHONY: help build clean

default: build

help:
	@echo ""
	@echo "Cfish for AROS (PPC). Just run:"
	@echo ""
	@echo "  make build"
	@echo "  make clean"
	@echo ""

build: $(EXE)

$(EXE): $(OBJS)
	$(CC) -o $@ $(OBJS) $(LDFLAGS)

clean:
	rm -f $(EXE) *.o
