CC := gcc CFLAGS := -Wall -Wextra -Wpedantic BIND := bin CSRCS = $(shell find . -type f -name '*.c') .PHONY: all clean all: $(CSRCS:%.c=$(BIND)/%) clean: rm -rf $(BIND) $(BIND)/%: %.c mkdir -p $(dir $@)p $(CC) $(CFLAGS) $^ -o $@