LIB1DIR = lib1-dir LIB2DIR = lib2-dir all: both $(LIB1DIR): mkdir $(LIB1DIR) $(LIB2DIR): # mkdir $(LIB2DIR) lib1: lib1-build touch lib1 lib1-build: $(LIB2DIR) $(LIB1DIR) Nothing sleep 5s touch lib1-build lib2: lib2-build touch lib2 lib2-build: $(LIB2DIR) sleep 15s touch lib2-build a: b: c: d: e: f: g: h: i: j: k: l: m: n: o: p: q: r: s: t: u: v: w: x: y: z: both: lib1-build a b c d e f g h i j k l m n o p q r s t u v w x y z lib2-build $(MAKE) both-build touch both both-build: sleep 2s touch both-build clean: rm -rf [a-z]* # This make sure that all variables in this file are exported to the # environment for each command. .EXPORT_ALL_VARIABLES: # This avoids make deleting intermediate files in our implicit rules, # such as ...configure and ...Makefile, which are needed in later builds. .SECONDARY: