I’ve got a little problem understanding following gmake syntax:
OBJ = foo.o bar.o
$(OBJ): %.o: %.cpp
$(CC) -c -MMD -MP $(INCLUDES) $(CFLAGS) $< -o $@
@sed (...create empty targets in file...)
I’m not sure what $(…): %.o: %.cpp does!?
I think it might translate the “%.o: %.cpp” in correct %.cpp dependencies – does it? Google is not much of a help here – it finds just the usual double colon (target::) which is something different!
Any advice? Thanks!
This is a static pattern rule.
$(OBJ)is a list of targets. The%.o : %.cppmeans “for each target in the list that matches%.o, it is dependent on%.cpp” (where the%is substituted accordingly).