+# clean all
+clean: objclean profileclean
+ @rm -f .depend *~ core
+
+# evaluation network (nnue)
+net:
+ $(eval nnuenet := $(shell grep EvalFileDefaultName evaluate.h | grep define | sed 's/.*\(nn-[a-z0-9]\{12\}.nnue\).*/\1/'))
+ @echo "Default net: $(nnuenet)"
+ $(eval nnuedownloadurl := https://tests.stockfishchess.org/api/nn/$(nnuenet))
+ $(eval curl_or_wget := $(shell if hash curl 2>/dev/null; then echo "curl -skL"; elif hash wget 2>/dev/null; then echo "wget -qO-"; fi))
+ @if test -f "$(nnuenet)"; then \
+ echo "Already available."; \
+ else \
+ if [ "x$(curl_or_wget)" = "x" ]; then \
+ echo "Automatic download failed: neither curl nor wget is installed. Install one of these tools or download the net manually"; exit 1; \
+ else \
+ echo "Downloading $(nnuedownloadurl)"; $(curl_or_wget) $(nnuedownloadurl) > $(nnuenet);\
+ fi; \
+ fi;
+ $(eval shasum_command := $(shell if hash shasum 2>/dev/null; then echo "shasum -a 256 "; elif hash sha256sum 2>/dev/null; then echo "sha256sum "; fi))
+ @if [ "x$(shasum_command)" != "x" ]; then \
+ if [ "$(nnuenet)" != "nn-"`$(shasum_command) $(nnuenet) | cut -c1-12`".nnue" ]; then \
+ echo "Failed download or $(nnuenet) corrupted, please delete!"; exit 1; \
+ fi \
+ else \
+ echo "shasum / sha256sum not found, skipping net validation"; \
+ fi
+
+# clean binaries and objects
+objclean:
+ @rm -f $(EXE) *.o ./syzygy/*.o ./nnue/*.o ./nnue/features/*.o
+
+# clean auxiliary profiling files
+profileclean:
+ @rm -rf profdir
+ @rm -f bench.txt *.gcda *.gcno ./syzygy/*.gcda ./nnue/*.gcda ./nnue/features/*.gcda *.s
+ @rm -f stockfish.profdata *.profraw