SOURCES := $(wildcard *.c) PROGRAMS := $(subst .c,,$(SOURCES)) all: $(PROGRAMS) @echo "Building sources: " $(SOURCES) @echo "Built: " $(PROGRAMS) .PHONY: clean clean: $(PROGRAMS) rm $(PROGRAMS)