Bob Yoplait
Bob Yoplait

Reputation: 2499

Library update and Makefile

It is a long time since I haven't done Makefiles. My actual Makefile works except that if a lib in $(LIB) changes, I get a message that make has nothing to do. The dependency on libs in $(LIB) isn't taken into account. Note that in $(LIB) I have libraries with their full path.

all:   $(OBJ_LIST) $(TEST_LOAD) $(TEST_CPP_UNIT) $(LIB)

%.o:    %.cpp
    g++ -c $(CPPFLAGS) -o $@ $<

Upvotes: 0

Views: 58

Answers (1)

Oliver Charlesworth
Oliver Charlesworth

Reputation: 272557

You haven't really expressed any useful dependencies. If you want something specific to be rebuilt when something in $(LIB) changes, you'll need to specify that explicitly. For instance:

all: my_app

# my_app will be rebuilt if something in $(LIB) changes
my_app: $(OBJ_LIST) $(LIB)
    g++ -o $@ $<

%.o: %.cpp
    g++ -c $(CPPFLAGS) -o $@ $<

Upvotes: 2

Related Questions