If I have a rule like this in my make file:
CC = g++
CFLAGS = -Wall
COMPILE = $(CC) $(CFLAGS) -c
src = A.cpp \
main.cpp
test_src = Test.cpp
test = testAll
OBJFILES := $(patsubst %.cpp,%.o,$(src))
TEST_OBJS := $(patsubst %.cpp,%.o,$(test_src))
%.o: %.cpp
$(COMPILE) -I UnitTest++/src -LUnitTest++/ -l UnitTest++ -o $@ $<
I end up including and linking UnitTest++ to non test files such as main and A.cpp How can I make only make Test classes link with the test libraries?