# Pattern rules, automatic variables, and conditional directives. Recipe lines use real TABs and
# are `echo` only. Included by the main Makefile in a real project; standalone here.

BUILD_DIR := build
VERBOSE   ?= 0

ifeq ($(VERBOSE),1)
QUIET :=
else
QUIET := @
endif

ifdef STRICT
CFLAGS += -Werror
endif

vpath %.c src

$(BUILD_DIR)/%.o: %.c
	$(QUIET)echo "compile $< -> $@ (stem $*)"

$(BUILD_DIR)/%.d: %.c
	$(QUIET)echo "depend $< -> $@"

%.checked: %
	$(QUIET)echo "check $< with prerequisites $^"

define announce
	@echo "== $(1) =="
endef

.PHONY: banner
banner:
	$(call announce,build $(BUILD_DIR))
