How to make the target depend on lib file, but exclude it from $^ (VPATH involved)?
问题 Imagine this structure: root/ | +-- include/ +-- src/ +-- build/ +-- lib/ +-- tests/ | +-- common +-- test1 +-- test2 +-- test3 In tests/ , the folder common/ contains a couple of source files that generate data or read data from logged file etc, which are shared between all tests. Each test therefore has only one file; main.c (currently). The Makefile of each test looks like this: .SUFFIXES: .SUFFIXES: .c .o TARGET := test # OS dependent stuff omitted for brevity CFLAGS += -I../../include -I