# If Makefile exists (generated by ./configure in this directory), delegate
# directly to it so that in-tree builds work normally as if this file were absent.
# Otherwise, redirect all targets to linux/Makefile for out-of-tree builds.
# Named GNUmakefile so it takes precedence in GNU Make without conflicting with
# Makefile on case-insensitive filesystems (Windows/macOS).
ifeq ($(wildcard Makefile),Makefile)
include Makefile
else ifeq ($(wildcard linux/Makefile),linux/Makefile)
all:
	$(MAKE) -C linux $@

doc:
	$(MAKE) -C linux $@
	cp -a linux/doc/*.1 linux/doc/*.txt doc/

.DEFAULT:
	$(MAKE) -C linux $@

.PHONY: all doc
else
$(error SnapRAID is not configured. Run './configure')
endif
