# Bootstrap Makefile for utun
# All build artifacts (.o) go to build/ directory
# Final binary (utun) is copied to project root

BUILD_DIR = build

all:
	@mkdir -p $(BUILD_DIR)
	@if test ! -f $(BUILD_DIR)/config.status || test ./configure -nt $(BUILD_DIR)/config.status; then \
		echo "Configuring in $(BUILD_DIR)/..."; \
		cd $(BUILD_DIR) && ../configure; \
	fi
	@$(MAKE) -C $(BUILD_DIR)

clean:
	-rm -rf $(BUILD_DIR)

distclean: clean
	-rm -f config.status config.log config.h stamp-h1
	-rm -rf autom4te.cache/

check: all
	@$(MAKE) -C $(BUILD_DIR) check

install:
	@$(MAKE) -C $(BUILD_DIR) install

.PHONY: all clean distclean check install
