diff --git a/Chapter1/Makefile b/Chapter1/Makefile index 10b36b2..ee6cf96 100644 --- a/Chapter1/Makefile +++ b/Chapter1/Makefile @@ -1,4 +1,11 @@ SOURCES := $(wildcard *.c) +PROGRAMS := $(subst .c,,$(SOURCES)) -all: $(SOURCES) - @echo $(SOURCES) +all: $(PROGRAMS) + @echo "Building sources: " $(SOURCES) + @echo "Built: " $(PROGRAMS) + +.PHONY: clean + +clean: $(PROGRAMS) + rm $(PROGRAMS) diff --git a/Makefile b/Makefile index 240bd5d..a735b19 100644 --- a/Makefile +++ b/Makefile @@ -8,3 +8,8 @@ subdirs: $(SUBDIRS) $(SUBDIRS): $(MAKE) -C $@ + +.PHONY: clean + +clean: $(SUBDIRS) + $(MAKE) -C $< clean