SUBDIRS=my_lib product LIBDIR=lib .PHONY: clean subdirs $(SUBDIRS) subdirs: $(SUBDIRS) $(SUBDIRS): $(MAKE) -C $@ all: $(LIBDIR) subdirs product: my_lib $(LIBDIR): mkdir $@ clean: for dir in $(SUBDIRS); do \ $(MAKE) -C $$dir clean; \ done